QN1: How many parameters are there in getline function?
a. 1
b. 2
c. 3
d. 4
QN2: An array name is a _____
a. subscript
b. formal parameter
c. memory address
d. prototype
Answer
Answer: c. memory address
QN3: Type of Conversion in which compiler is unable to convert the datatype implicitly is ?
a. ushort to long
b. int to uint
c. ushort to long
d. byte to decimal
Answer
Answer: b. int to uint
QN4: “What is the process of defining a method in terms of itself, that is a method that calls itself?”
a. Polymorphism
b. Abstraction
c. Encapsulation
d. Recursion
Answer
Answer: c. Encapsulation
QN5: C++ was originally developed by
a. Clocksin and Melish
b. Donald E.Knuth
c. Sir Richard Hadlee
d. Bjarne Stroustrup
Answer
Answer: d. Bjarne Stroustrup
QN6: Which one of the following is a valid statement?
a. char[] c = new char();
b. char[] c = new char[5];
c. char[] c = new char(4)
d. char[] c = new char[];
Answer
Answer: b. char[] c = new char[5];
QN7: Which of the followings is/are pointer-to-member declarator?
a. ->*
b. .*
c. ::*
d. a and b
Answer
Answer: d. a and b
QN8: …………………………. is a function declared in a base class that has no definition relative to the base class
a. member function
b. virtual function
c. pure virtual function
d. pure function
Answer
Answer: c. pure virtual function
QN9: How do we declare an abstract class?
a. By providing at least one pure virtual method (function signature followed by ==0;) in a class
b. By declaring at least one method abstract using the keyword abstract in a class
c. By declaring the class abstract with the keyword abstract
d. It is not possible to create abstract classes in C++
Answer
Answer: a. By providing at least one pure virtual method (function signature followed by ==0;) in a class
QN10: Which operator is having the highest precedence?
a. postfix
b. unary
c. shift
d. equality
Answer
Answer: a. postfix
QN11: The pointer can point to any variable that is not declared with which of these?
a. const
b. volatile
c. static
d. Both 1 and 2
Answer
Answer: d. Both 1 and 2
QN12: The default access level assigned to members of a class is
a. Private
b. Public
c. Protected
d. Needs to be assigned
Answer
Answer: c. Protected
QN13: “Multiple inheritance means,”
a. one class inheriting from more super classes
b. more classes inheriting from one super class
c. more classes inheriting from more super classes
d. None of the above
Answer
Answer: a. one class inheriting from more super classes
QN14: Inline functions are invoked at the time of
a. Run time
b. Compile time
c. Depends on how it is invoked
d. Both b and c above
Answer
Answer: b. Compile time
QN15: RunTime Polymorphism is achieved by ______
a. friend function
b. virtual function
c. operator overloading
d. function overloading
Answer
Answer: b. virtual function
QN16: An array elements are always stored in ________ memory locations.
a. Sequential
b. Random
c. Sequential and Random
d. NONE of these
Answer
Answer: a. Sequential
QN17: The following can be declared as friend in a class
a. An object
b. A class
c. A public data member
d. A private data member
Answer
Answer: b. A class
QN18: Pure virtual functions?
a. have to be redefined in the inherited class
b. cannot have public access specification
c. are mandatory for a virtual class
d. None of the above
Answer
Answer: a. have to be redefined in the inherited class
QN19: Access to private data
a. Restricted to methods of the same class
b. Restricted to methods of other classes
c. Available to methods of the same class and other classes
d. Not an issue because the program will not compile
Answer
Answer: b. Restricted to methods of other classes
QN20: Inline functions are invoked at
a. Run time
b. Compile time
c. Debug time
d. None of these
Answer
Answer: b. Compile time
QN21: “C++ supports run time polymorphism with the help of virtual functions, which is called …………….. binding.”
a. dynamic
b. run time
c. early binding
d. static
Answer
Answer: a. dynamic
QN22: Which of the following statements is correct?
a. Base class pointer cannot point to derived class.
b. Derived class pointer cannot point to base class.
c. Pointer to derived class cannot be created.
d. Pointer to base class cannot be created.
Answer
Answer: b. Derived class pointer cannot point to base class.
QN23: How many kinds of classes are there in c++?
a. 1
b. 2
c. 3
d. 4
QN24: What is meaning of following declaration? int(*p[5])();
a. p is pointer to function.
b. p is array of pointer to function.
c. p is pointer to such function which return type is array.
d. p is pointer to array of function.
Answer
Answer: b. p is array of pointer to function.
QN25: How many specifiers are present in access specifiers in class?
a. 1
b. 2
c. 3
d. 4
QN26: Runtime polymorphism is achieved by
a. Friend function
b. Virtual function
c. Operator overloading
d. Function overloading
Answer
Answer: b. Virtual function
QN27: What does C++ append to the end of a string literal constant?
a. a space
b. a number sign (#)
c. an asterisk (*)
d. a null character
Answer
Answer: d. a null character
QN28: A switch construct can be used with which of the following types of variable?
a. int
b. “int, char”
c. “int, float, char”
d. Any basic datatype
Answer
Answer: b. “int, char”
QN29: this pointer
a. implicitly points to an object
b. can be explicitly used in a class
c. can be used to return an object.
d. All of the above
Answer
Answer: d. All of the above
QN30: “When a class serves as base class for many derived classes, the situation is called?”
a. polymorphism
b. hierarchical inheritance
c. hybrid inheritance
d. multipath inheritance
Answer
Answer: b. hierarchical inheritance
QN31: Overloading the function operator
a. requires a class with an overloaded operator
b. requires a class with an overloaded [ ] operator
c. allows you to create objects that act syntactically like functions
d. usually make use of a constructor that takes arguments
Answer
Answer: a. requires a class with an overloaded operator
QN32: Null character needs a space of
a. zero bytes
b. one byte
c. three bytes
d. four bytes
Answer
Answer: b. one byte
QN33: Use of virtual functions implies
a. overloading.
b. overriding.
c. static binding.
d. dynamic binding.
Answer
Answer: d. dynamic binding.
QN34: “If a class contains pure virtual function, then it is termed as____”
a. Virtual class
b. Sealed class
c. Pure Local class
d. Abstract Class
Answer
Answer: d. Abstract Class
QN35: An array element is accessed using
a. a FIFO approach
b. an index number
c. the operator
d. a member name
Answer
Answer: b. an index number
QN36: By default how the value are passed in c++?
a. call by value
b. call by reference
c. call by pointer
d. none of these
Answer
Answer: a. call by value
QN37: A virtual class is the same as
a. An abstract class
b. A class with a virtual function
c. A base class
d. None of the above
Answer
Answer: d. None of the above
QN38: Overloaded functions are required to
a. have the same return type
b. have the same number of parameters
c. perform the same basic functions
d. None of the above
Answer
Answer: d. None of the above
QN39: The members of a class by default are
a. Public
b. Protected
c. Private
d. Mandatory to specify
Answer
Answer: c. Private
QN40: Each pass through a loop is called a/an
a. enumeration
b. iteration
c. culmination
d. pass through
Answer
Answer: b. iteration
DistPub Team
Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.