CPP MCQ PART 3



PAGES: 1    2    3     4     6    7 


31. In C++, ………. is the statement terminator
a) semicolon
b) colon
c) new line
d) None of the above

32. Modules operator (%) has higher precedence than
a) Divide (/) operator
b) Multiply (*) operator
c) Negation (unary minus)
d) Bitwise left shift operator

33. The result of the following statement is
int y = 7;
int ans = ++y;
cout<<”ans=”<<ans;
cout<<”y”<<y;

a) ans=7, y=7
b) ans=8,y=7
c) ans=8,y=8;
d) none of the above

34. Consider the following if construct
If(x=0)
cout<<”Inside loop!”;
cout<<”Outside loop”;
The result of the above code segment is.

a) inside loop
b) outside loop
c) both (a) & (b)
d) none of the above

35. The result of 2 & 3 is
a) 2
b) 3
c) 5
d) none of the above

36. Which of the following statements regarding enumerators is false?
a) Enumeration is an alternative method for naming integer constants/
b) An enumerator value can’t be changed in a program
c) An integer value may be assigned to an enumerated variable
d) An enum defined within a structure is local to the structure

37. Which of the following statements is false?
a) typedef defines new data types
b) Using typedef does not replace the standard C++ data type name with the new name
c) The new name defined by typedef, can be used as a type for another typedef
d) None of the above

38. Data members and member functions are enclosed within
a) class
b) structure
c) union
d) None of the above

39. Inline functions are
a) Declared in the class defined outside the class
b) Defined outside the class using keyword intime
c) Defined inside the class using keyword inline
d) None of the above

40. The default class access scope is
a) Private
b) Public
c) Protected
d) None of the above

41. The default scope for a structure is
a) Private
b) Public
c) Protected
d) None of the above

42. The private data members of a class are accessible
a) Directly to objects of that class
b) Only to the member functions
c) To any function defined outside a class
d) None of the above

43. The objects can directly access
a) Public members
b) Private members
c) Both (a) & (b)
d) None of the above

44. The following is a valid statement in C++
a) int x=(int)2.50;
b) int x=int(2.50);
c) Both (a) & (b)
d) None of the above

45. Which of the following operator can be overloaded
a) Member access operator ( . & .*)
b) Conditional operator (?:)
c) Scope resolution operator (::)
d) None of the above

46. Using same function name to perform different tasks is
a) Function polymorphism
b) Runtime polymorphism
c) Function prototype
d) None of the above

47. Default argument is
a) Specified in function definition
b) Specified in function declaration
c) Specified from left to right
d) None of the above

48. What is wrong with the following statement?
float s_interest (float principal, int rate=0.25, int time);

a) variables must not be specified in function prototype
b) arguments may only be defaulted from right to left
c) the default value must be specified when making a function call
d) none of the above

49. Which of the following statements regarding function overloading is not true.
a) If is used to handle different data types at one place
b) When making a function call, if no exact match is found, promotion is the only criteria to find a match.
c) The default arguments can not be used instead of overloading
d) Unrelated functions should not be overloaded

50. The private members of a class implement the OOP concept of
a) Data abstraction
b) Data hiding
c) Message passing
d) None of the above

51. When a member function of a class call another member function, it is
a) Nesting of classes
b) Nesting of functions
c) Nesting of objects
d) None of the above

52. A function defined inside a class is called
a) A class function
b) A friend function
c) A member function
d) None of the above

53. Information is made shareable through
a) inheritance
b) data encapsulation
c) data abstraction
d) none of the above

54. Functions can returns
a) arrays
b) reference
c) object
d) all of the above

55. The memory for date members is allocated
a) When a class is defined
b) When an object is initialized
c) When an object is created
d) None of the above

56. The memory for member functions is allocated
a) When a class is defined
b) When a object is created
c) When an object is initialized
d) None of the above

57. The dot operator relates
a) A class member and a class object
b) A class object and a class
c) A class and a member of that class
d) A class object and member of that class

58. A class having another class definition is
a) Nested class
b) Subordinate class
c) Enclosing class
d) None of the above

59. A class whose member functions are friends of other class is
a) Friend class
b) Abstract class
c) Virtual class
d) None of the above

60. The data members of a class are initialized
a) in class definition
b) by a non-member function
c) through constructor function when a class object is created
d) none of the above

CHECK ANSWERS

PAGES: 1    2    3     4     6    7