Programming Languages NTA UGC NET Question Analysis
Q1➡ | A member function can always access the data in ……………. ,(in C++).
i ➥ the class of which it is memberii ➥ the object of which it is a memberiii ➥ the public part of its classiv ➥ the private part of its class
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q2➡ | ‘*ptrdata’ is a pointer to a data type. The expression *ptrdata++ is evaluated as (in C++):
i ➥ *(ptrdata++)ii ➥ (*ptrdata++)iii ➥ (*ptrdata++)iv ➥ *(ptrdata)++
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q3➡ | The associativity of which of the following operators is Left to Right, in C++?
i ➥ Unary Operatorii ➥ Logical notiii ➥ Array element accessiv ➥ addressof
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q4➡ | If a function is friend of a class, which one of the following is wrong?
i ➥ A function can only be declared a friend by a class itself.ii ➥ Friend functions are not members of a class, they are associated with it.iii ➥ Friend functions are members of a class.iv ➥ It can have access to all members of the class, even private ones.
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q5➡ | Which of the following is not a member of class ?
i ➥ Static functionii ➥ Friend functioniii ➥ Const functioniv ➥ Virtual function
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q6➡ | ……………… allows to create classes which are derived from other classes, so that they automatically include some of its “parent’s” members, plus its own members.
i ➥ Overloadingii ➥ Inheritanceiii ➥ Polymorphismiv ➥ Encapsulation
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q7➡ | Member of a class specified as …………… are accessible only to method of the class.
i ➥ privateii ➥ publiciii ➥ protectediv ➥ derive
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q8➡ | Match the following: Set-I (a) Garbage collection in (b) Nameless object (c) Template support (d) A forward reference (e) Derived class inherits from base class Set-II 1- Java 2- generic programming 3- defines a class 4- member function 5- within a statement Codes :(a) (b) (c) (d) (e)
i ➥ 1 5 4 2 3ii ➥ 1 5 2 3 4iii ➥ 5 1 2 3 4iv ➥ 5 4 3 1 2
Show Answer With Best Explanation Answer: I (Marks to all ) Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q9➡ | The data type created by the data abstraction process is called.
i ➥ classii ➥ structureiii ➥ abstract data typeiv ➥ user defined data type
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q10➡ | Which of the statements are true? I. Function overloading is done at compile time. II. Protected members are accessible to the member of derived class. III. A derived class inherits constructors and destructors. IV. A friend function can be called like a normal function. V. Nested class is a derived class.
i ➥ I, II, IIIii ➥ II, III, Viii ➥ III, IV, Viv ➥ I, II, IV
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q11➡ | A copy constructor is invoked when:
i ➥ a function returns by valueii ➥ an argument is passed by valueiii ➥ a function returns by referenceiv ➥ none of the above
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q12➡ | How many constructors can a class have?
i ➥ zeroii ➥ 1iii ➥ 2iv ➥ any number
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q13➡ | Which of the following is true?
i ➥ A “static” member of a class cannot be inherited by its derived class.ii ➥ A “static” member of a class can be initialized only within the class it is a member of.iii ➥ A “static” member of a class can be initialized before an object of that class is created.iv ➥ Since “static” member of a class is actually a global element, it does not require a class/object qualifier to access it independently of class/object.
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q14➡ | What keyword in class specification helps to hide data:
i ➥ Publicii ➥ Privateiii ➥ Staticiv ➥ Void
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q15➡ | Data members and member function of a class by default is respectively:
i ➥ private and publicii ➥ publiciii ➥ public and privateiv ➥ private
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q16➡ | Match the following with respect to I/O classes in object oriented programming : List – I List – II a. fopen() i. returns end of file b. fclose() ii. return for any problem report c. ferror() iii. returns 0 d. feof() iv. returns a file pointer Codes : a,b,c,d
i ➥ iv i ii iiiii ➥ iii i iv iiiii ➥ ii iii iv iiv ➥ iv iii i ii
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q17➡ | Which one of the following is correct, when a class grants friend status to another class?
i ➥ The member functions of the class generating friendship can access the members of the friend class.ii ➥ All member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.iii ➥ Class friendship is reciprocal to each otheriv ➥ There is no such concept.
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q18➡ | When a method in a subclass has the same name and type signatures as a method in the super-class, then the method in the subclass ……………… the method in the super-class.
i ➥ Overloadsii ➥ Friendshipsiii ➥ Inheritsiv ➥ Overrides
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q19➡ | A …………….. is a special method used to initialize the instance variable of a class.
i ➥ Member functionii ➥ Destructoriii ➥ Constructoriv ➥ Structure
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
i ➥ Dynamic bindingii ➥ A mechanism to associate the code and data.iii ➥ Data abstractioniv ➥ Creating new class
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q21➡ | Assume that we have constructor function for both Base and Derived classes. Now consider the declaration : main ( ) Base *p = new Derived; In what sequence, the constructor will be executed?
i ➥ Derived class constructor is followed by Base class constructor.ii ➥ Base class constructor is followed by Derived class constructor.iii ➥ Base class constructor is never called.iv ➥ Derived class constructor is never called.
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q22➡ | Match the following interfaces of Java. Servlet package : List – I a. Servlet Config b. Servlet Context c. Servlet Request d. Servlet Response List – II i. Enables Servlets to log events ii. Read data from a client iii. Write data to a client iv. To get initialization parameters Codes : a b c d
i ➥ ii iv ii iii ➥ iii ii iv iiii ➥ ii iii iv iiv ➥ iv i ii iii
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q23➡ | The pure object oriented programming language with extensive metadata available and modifiable at run time is
i ➥ Small talkii ➥ C++iii ➥ Javaiv ➥ Eiffel
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q24➡ | Which method is called first by an applet program ?
i ➥ start( )ii ➥ run( )iii ➥ init( )iv ➥ begin( )
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q25➡ | What is true about UML stereotypes ?
i ➥ Stereotype is used for extending the UML language.ii ➥ Stereotyped class must be abstractiii ➥ The stereotype indicates that the UML element cannot be changediv ➥ UML profiles can be stereotyped for backward compatibility
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q26➡ | Converting a primitive type data into its corresponding wrapper class object instance is called
i ➥ Boxingii ➥ Wrappingiii ➥ Instantiationiv ➥ Autoboxing
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q27➡ | Which one of the following is correct?
i ➥ Java applets cannot be written in any programming languageii ➥ An applet is not a small program.iii ➥ An applet can be run on its own.iv ➥ Applets are embedded in another applications.
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q28➡ | In Java, when we implement an interface method, it must be declared as:
i ➥ Privateii ➥ Protectediii ➥ Publiciv ➥ Friend
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q29➡ | Which of the following is/are correct with reference to Abstract class and interface ? (a) A class can inherit only one Abstract class but may inherit several interfaces. (b) An Abstract class can provide complete and default code but an interface has no code. Codes :
i ➥ a) is trueii ➥ (b) is trueiii ➥ Both (a) and (b) are trueiv ➥ Neither (a) nor (b) is true
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q30➡ | Match the following with reference to object oriented modelling : List – I List – II (a) Polymorphism (i) Picking both operator and attributes with operations appropriate to model an object (b) Inheritance (ii) Hiding implementation details of methods from users of objects (c) Encapsulation (iii) Using similar operations to do similar things (d) Abstraction (iv) Create new classes from existing class Codes : (a) (b) (c) (d)
i ➥ iv) (iii) (i) (ii)ii ➥ (iii) (iv) (i) (ii)iii ➥ (iii) (i) (ii) (iv)iv ➥ iv) (iii) (ii) (i)
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q31➡ | Which of the following is used to make an Abstract class ?
i ➥ Making atleast one member function as pure virtual functionii ➥ Making atleast one member function as virtual functioniii ➥ Declaring as Abstract class using virtual keywordiv ➥ Declaring as Abstract class using static keyword
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q32➡ | When one object reference variable is assigned to another object reference variable then
i ➥ a copy of the object is created.ii ➥ a copy of the reference is created.iii ➥ a copy of the reference is not created.iv ➥ it is illegal to assign one object reference variable to another object reference variable.
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q33➡ | Which of the following statements is correct?
i ➥ Every class containing abstract method must not be declared abstract.ii ➥ Abstract class cannot be directly initiated with ‘new’ operator.iii ➥ Abstract class cannot be initiated.iv ➥ Abstract class contains definition of implementation.
Show Answer With Best Explanation Answer: II,III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q34➡ | Which of the following statements is correct?
i ➥ Aggregation is a strong type of association between two classes with full ownership.ii ➥ Aggregation is a strong type of association between two classes with partial ownership.iii ➥ Aggregation is a weak type of association between two classes with partial ownership.iv ➥ Aggregation is a weak type of association between two classes with full ownership.
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q35➡ | It is possible to define a class within a class termed as nested class. There are ………… types of nested classes.
Show Answer With Best Explanation Answer: I,III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q36➡ | Implicit return type of a class constructor is:
i ➥ not of class type itselfii ➥ class type itselfiii ➥ a destructor of class typeiv ➥ destructor not of class type
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q37➡ | Which of the following is not a correct statement?
i ➥ Every class containing abstract method must be declared abstract.ii ➥ Abstract class can directly be initiated with ‘new’ operator.iii ➥ Abstract class can be initiated.iv ➥ Abstract class does not contain any definition of implementation.
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q38➡ | Constructors have …………. return type.
i ➥ voidii ➥ chariii ➥ intiv ➥ no
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q39➡ | Which of the following statement(s) with regard to an abstract class in JAVA is/are TRUE? I. An abstract class is one that is not used to create objects. II. An abstract class is designed only to act as a base class to be inherited by other classes.
i ➥ Only lii ➥ Only IIiii ➥ Neither I nor IIiv ➥ Both l and II
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q40➡ | Consider the following JAVA program: public class First { public static int CBSE(int x) { if (x < 100) x = CBSE (x +10); return (x – 1); } public static void main(String[] args) { System.out.print(First.CBSE(60)); } } What does this program print?
i ➥ 59ii ➥ 95iii ➥ 69iv ➥ 99
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q41➡ |
i ➥ 20:20ii ➥ 18:18iii ➥ 18:20iv ➥ 20:18
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q42➡ | The goal of operator overloading is
i ➥ to help the user of a classii ➥ to help the developer of a classiii ➥ to help define friend functioniv ➥ None of the above
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q43➡ | A friend function can be used to
i ➥ avoid arguments between classes.ii ➥ allow access to classes whose source code is unavailableiii ➥ allow one class to access an unrelated class.iv ➥ None of the above
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q44➡ | A function object:
i ➥ is an instance of a class for which operator () is a member function.ii ➥ is an instance of a class for which operator → is a member function.iii ➥ is a pointer to any functioniv ➥ is a member function of a class
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q44➡ | If a data-item is declared as a protected access specifier then it can be accessed:
i ➥ Anywhere in the programii ➥ By the base and derived classesiii ➥ Only by base classiv ➥ Only by derived class
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q45➡ | Runtime polymorphism can be achieved by:
i ➥ Accessing virtual function through the pointer of the base classii ➥ Accessing virtual function through the objectiii ➥ The derived classiv ➥ None of these
Show Answer With Best Explanation Answer: I Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q46➡ | The friend functions are used in situations where:
i ➥ We want to have access to unrelated classesii ➥ Dynamic binding is requirediii ➥ Exchange of data between classes to take placeiv ➥ None of the above
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
i ➥ Dynamic bindingii ➥ A mechanism to associate the code and data.iii ➥ Data abstractioniv ➥ Creating new class
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q48➡ | A …………….. is a special method used to initialize the instance variable of a class.
i ➥ Member functionii ➥ Destructoriii ➥ Constructoriv ➥ Structure
Show Answer With Best Explanation Answer: III Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q49➡ | When a method in a subclass has the same name and typesignatures as a method in the superclass, then the method in the subclass……………… the method in the superclass.
i ➥ Overloadsii ➥ Friendshipsiii ➥ Inheritsiv ➥ Overrides
Show Answer With Best Explanation Answer: IV Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line
Q50➡ | Which one of the following is correct, when a class grants friend status to another class?
i ➥ The member functions of the class generating friendship can access the members of the friend class.ii ➥ All member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.iii ➥ Class friendship is reciprocal to each otheriv ➥ There is no such concept.
Show Answer With Best Explanation Answer: II Explanation: Upload Soon
More Discussion Explanation On YouTube Learn Topic Wise Help-Line