C & C++ Programming Multiple Choice Questions - Set 44

1.       Which of the following cannot be legitimately passed to a function
(A) A constant.
(B) A variable.
(C) A structure.
(D) A header file.
Answer: D
2.       A property which is not true for classes is that they
(A) are removed from memory when not in use.
(B) permit data to be hidden from other classes.
(C) bring together all aspects of an entity in one place.
(D) Can closely model objects in the real world.
Answer: C
3.       You can read input that consists of multiple lines of text using
(A) the normal cout << combination.
(B) the cin.get( ) function with one argument.
(C) the cin.get( ) function with two arguments.
(D) the cin.get( ) function with three arguments.
Answer: C
4.       The keyword friend does not appear in
(A) the class allowing access to another class.
(B) the class desiring access to another class.
(C) the private section of a class.
(D) the public section of a class.
Answer: C
5.       The process of building new classes from existing one is called
(A) Structure.
(B) Inheritance.
(C) Polymorphism.
(D) Template.
Answer: B

6.       If we create a file by ‘ifstream’, then the default mode of the file is ...............
(A) ios :: out (B) ios :: in
(C) ios :: app (D) ios :: binary
Answer: B
7.       A variable defined within a block is visible
(A) from the point of definition onward in the program.
(B) from the point of definition onward in the function.
(C) from the point of definition onward in the block.
(D) throughout the function.
Answer: C
8.       A friend function to a class, C cannot access
(A) private data members and member functions.
(B) public data members and member functions.
(C) protected data members and member functions.
(D) the data members of the derived class of C.
Answer: D
9.       The operator that cannot be overloaded is
(A) ++
(B) ::
(C) ( )
(D) ~
Answer: B
10.    A struct is the same as a class except that
(A) there are no member functions.
(B) all members are public.
(C) cannot be used in inheritance hierarchy.
(D) it does have a this pointer.
Answer: C


Post a Comment

0 Comments