Professional Documents
Culture Documents
96) In C++, the statements are enclosed within 103) 31. In C++, ………. is the statement
a) parenthesis terminator
b) square brackets a) semicolon
c) curly brackets b) colon
d) None of the above c) new line
Answer: C d) None of the above
Answer: A
97) The following tells the compiler where the
program begins 104) Modules operator (%) has higher
a) Function prototype precedence than
b) Forward declaration of class a) Divide (/) operator
c) main() b) Multiply (*) operator
d) None of the above c) Negation (unary minus)
Answer: C d) Bitwise left shift operator
Answer: C
105) The result of the following statement is 110) Data members and member functions are
int y = 7; enclosed within
int ans = ++y; a) class
cout<<”ans=”<<ans; b) structure
cout<<”y”<<y; c) union
a) ans=7, y=7 d) None of the above
b) ans=8,y=7 Answer: A
c) ans=8,y=8;
d) none of the above 111) Inline functions are
Answer: C a) Declared in the class defined outside the
class
106) Consider the following if construct b) Defined outside the class using keyword
If(x=0) intime
cout<<”Inside loop!”; c) Defined inside the class using keyword inline
cout<<”Outside loop”; d) None of the above
The result of the above code segment is. Answer: B
a) inside loop
b) outside loop 112) The default class access scope is
c) both (a) & (b) a) Private
d) none of the above b) Public
Answer: B c) Protected
d) None of the above
107) The result of 2 & 3 is Answer: A
a) 2
b) 3 113) The default scope for a structure is
c) 5 a) Private
d) none of the above b) Public
Answer: A c) Protected
d) None of the above
108) Which of the following statements Answer: B
regarding enumerators is false?
a) Enumeration is an alternative method for 114) The private data members of a class are
naming integer constants/ accessible
b) An enumerator value can’t be changed in a a) Directly to objects of that class
program b) Only to the member functions
c) An integer value may be assigned to an c) To any function defined outside a class
enumerated variable d) None of the above
d) An enum defined within a structure is local Answer: B
to the structure
Answer: C 115) The objects can directly access
a) Public members
109) Which of the following statements is b) Private members
false? c) Both (a) & (b)
a) typedef defines new data types d) None of the above
b) Using typedef does not replace the standard Answer: A
C++ data type name with the new name
c) The new name defined by typedef, can be 116) The following is a valid statement in C++
used as a type for another typedef a) int x=(int)2.50;
d) None of the above b) int x=int(2.50);
Answer: A c) Both (a) & (b)
d) None of the above
Answer: C
117) Which of the following operator can be 123) When a member function of a class call
overloaded another member function, it is
a) Member access operator ( . & .*) a) Nesting of classes
b) Conditional operator (?:) b) Nesting of functions
c) Scope resolution operator (::) c) Nesting of objects
d) None of the above d) None of the above
Answer: D Answer: B
118) Using same function name to perform 124) A function defined inside a class is called
different tasks is a) A class function
a) Function polymorphism b) A friend function
b) Runtime polymorphism c) A member function
c) Function prototype d) None of the above
d) None of the above Answer: C
Answer: A
125) Information is made shareable through
119) Default argument is a) inheritance
a) Specified in function definition b) data encapsulation
b) Specified in function declaration c) data abstraction
c) Specified from left to right d) none of the above
d) None of the above Answer: A
Answer: B
126) Functions can returns
120) What is wrong with the following a) arrays
statement? b) reference
float s_interest (float principal, int rate=0.25, c) object
int time); d) all of the above
a) variables must not be specified in function Answer: D
prototype
b) arguments may only be defaulted from right 127) The memory for date members is
to left allocated
c) the default value must be specified when a) When a class is defined
making a function call b) When an object is initialized
d) none of the above c) When an object is created
Answer: B d) None of the above
Answer: B
121) Which of the following statements
regarding function overloading is not true. 128)The memory for member functions is
a) If is used to handle different data types at allocated
one place a) When a class is defined
b) When making a function call, if no exact b) When a object is created
match is found, promotion is the only criteria c) When an object is initialized
to find a match. d) None of the above
c) The default arguments can not be used Answer: A
instead of overloading
d) Unrelated functions should not be 129) The dot operator relates
overloaded a) A class member and a class object
Answer: C b) A class object and a class
122) The private members of a class c) A class and a member of that class
implement the OOP concept of d) A class object and member of that class
a) Data abstraction Answer: D
b) Data hiding
c) Message passing
d) None of the above
Answer: B
130) A class having another class definition is 137) new operator is used
a) Nested class a) to define a new variable
b) Subordinate class b) to create a new data type
c) Enclosing class c) to allocate memory dynamically
d) None of the above d) none of the above
Answer: C Answer: C
131) A class whose member functions are 138) A constructor function is generally
friends of other class is defined
a) Friend class a) In the public section of a class
b) Abstract class b) In the private section of a class
c) Virtual class c) In the protected section of a class
d) None of the above d) None of the above
Answer: A Answer: A
132) The data members of a class are 139) A class having no public constructors is
initialized a) A private class
a) in class definition b) A public class
b) by a non-member function c) An abstract class
c) through constructor function when a class d) None of the above
object is created Answer: A
d) none of the above
Answer: C 140) If a constructor function is defined in
private section of a class, then
133) A constructor function is a) The object cannot be created
a) A friend function to a class b) Only member functions and friends may
b) A member function with the same name as declare objects of the class
its class c) Both (a) & (b)
c) A non-member function d) None of the above
d) None of the above Answer: C
Answer: B
141) A constructor with no argument is
134) An enumerated type is composed of a) Default constructor
a) Integer values with user defined name b) Parameterized constructor
b) Variables of different data types c) Copy constructor
c) Constant numeric values d) None of the above
d) None of the above Answer: A
Answer: A
142) If default arguments are provided to a
135) In C++, the arguments by default are constructor function, then it becomes
passed by a) Default constructor
a) call be reference b) Copy instructor
b) call be value c) Parameterized constructor
c) both (a) & (b) d) None of the above
d) none of the above Answer: A
Answer: B
143) The class of which the objects are not
136) is an example of instantiated is
a) unary operator a) Abstract class
b) binary operator b) Virtual class
c) ternary operator c) Static class
d) none of the above d) None of the above
Answer: C Answer: A
144) && denotes 151) Which of the following statements
a) logical OR regarding constructor is false?
b) logical AND a) A constructor may be defined static
c) Bitwise AND b) Constructor can have default arguments
d) None of the above c) Member functions may be invoked from
Answer: B within a constructor
d) None of the above
145) The parameterized constructor Answer: A
a) Needs initial values as arguments during
creation of an object 152) The antonym of constructor is
b) Can be invoked explicitly only a) Creator
c) Can be invoked implicitly only b) Destructor
d) None of the above c) Destroyer
Answer: A d) None of the above
Answer: B
146) Explicit call to a constructor means
a) Providing the constructor name explicitly to 153) Variable …………. of void type
invoke it a) May be declared
b) Not providing the construction name at all b) Cannot be declared
c) Is the shorthand method c) Can be initialized
d) None of the above d) None of the above
Answer: A Answer: B