Home

C++ Programming 1000+ MCQ with answer for FCI Recruitment

Thursday 9th of March 2023

Sharing is caring

1. In a for loop with a multi-statement loop body, semicolons should appear following
A. The for statement itself
B. The closing brace in a multi-statement loop body
C. Each statement within the loop body.
D. The test expression
Answer : C
2. In C++, the exception handler is invoked with a-
A. try block
B. throw exception
C. catch function
D. abort()
Answer : B
3. In C++, identifiers have to be declared at the beginning of the blocks.
A. True
B. False
C.
D.
Answer : A
4. Inline function specifier reduces the overheads associated with a normal function call.
A. True
B. False
C.
D.
Answer : A
5. The template function declaration specifies
A. template class
B. a generic class
C. exception
D. identifier
Answer : B
6. A function that is called automatically when an object is created is known as
A. instantiation
B. function prototype
C. constructor
D. structure
Answer : C
7. A destructor can have a return type.
A. True
B. False
C.
D.
Answer : B
8. Scope resolution operator has the highest precedence.
A. True
B. False
C.
D.
Answer : A
9. cc ___________ option is used only to create object file
A. -a
B. -o
C. -c
D. none of these
Answer : B
10. Inline functions_____________ call overload.
A. Increase
B. Reduce
C. None of the above are correct
D.
Answer : B
11. main() returns a value of type
A. real
B. char
C. int
D. null
Answer : C
12. Which of the following are good reasons to use an object oriented language?
A. You can define your data types
B. Program statements are simpler than in procedural languages.
C. An OO program can be taught to correct its own errors.
D. It's easier to conceptualize an OO program.
Answer : A
13. Static data member occurs in only class scope.
A. True
B. False
C.
D.
Answer : B
14. Classes are useful because 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 : B
15. :: is known as
A. scope resolution operator
B. global operator
C. Both (a) & (b)
D. None of these
Answer : A
16. The value of 'this' pointer can be changed.
A. True
B. False
C.
D.
Answer : B
17. Objects get destroyed in the reverse order as they are created.
A. True
B. False
C.
D.
Answer : A
18. ios containes a pointer to streambuf.
A. True
B. False
C.
D.
Answer : A
19. Which of the following relationship is known as inheritancerelationship?
A. ‘has-a’ relationship
B. ‘is-a’ relationship
C. association relationship
D. none of the above
Answer : A
20. Protected data members can be accessed
A. Only from the base class itself
B. Both form the base class and from its derived classes
C. From the class which is friend of the base class
D. None of the above are correct
Answer : B
21. Element double Array[7] is which element of the array?
A. sixth
B. seventh
C. eighth
D. impossible to tell
Answer : C
22. When a language has the capacity to produce new data type, it is said to be
A. Reprehensible
B. Encapsulated
C. Overload
D. Extensible
Answer : D
23. If class A is friend of class B and if class B is friend of class C, which of the following is true?
A. Class C is friend of class A
B. Class A is friend of class C
C. Class A and Class C do not have any friend relationship
D. None of the above
Answer : B
24. The members of a class by default are private.
A. True
B. False
C.
D.
Answer : A
25. Which of the following is true about const member functions?
A. const members can be invoked on both const as well as nonconst objects
B. const members can be invoked only on const objects and not on nonconst objects
C. nonconst members can be invoked on const objects as well as nonconst objects
D. none of the above
Answer : B
26. _______ argument(s) are passed in case of binary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : A
27. In C++, an identifier must be initialized using constant expression.
A. True
B. False
C.
D.
Answer : B
28. We cannot have the address of a constructor.
A. True
B. False
C.
D.
Answer : A
29. One of the major disadvantage with late binding is
A. the source code should be made available at compile time
B. the program runs slower
C. dynamic variables can not be used in the program
D. static variables can not be used
Answer : B
30. _______ argument(s) are passed in case of unary overloaded operators.
A. Two
B. One
C. No
D. None of the above
Answer : B
31. Static member functions have file scope.
A. True
B. False
C.
D.
Answer : A
32. A copy constructor is used to copy an object member wise to another object of the same class.
A. True
B. False
C.
D.
Answer : A
33. Operator overloading is
A. Making C++ operators work with objects
B. Making C++ operators more then they can handle
C. Giving new meaning to existing c++ operators
D. Making new C++ operators
Answer : C
34. The new operator always returns a void pointer.
A. True
B. False
C.
D.
Answer : A
35. A function that is called automatically when an object is destroyed is known as
A. instantiation
B. function prototype
C. constructor
D. destructor
Answer : D
36. The break statement causes an exit
A. Only from the innermost loop
B. Only from the innermost switch
C. From all loops and switch
D. Only from the innermost loops or switch
Answer : A
37. A class that contains at least one pure virtual function is called as
A. pure class
B. abstract class
C. base class
D. derived class
Answer : B
38. Private members of a structure can be accessed directly from the outside of the structure.
A. True
B. False
C.
D.
Answer : B
39. Data objects can be initialized when allocating memory using 'new'.
A. True
B. False
C.
D.
Answer : A
40. If a friend function is declared inside a class it can access all data members of the class.
A. True
B. False
C.
D.
Answer : A
41. The library function exit() causes an exit from
A. The loop in which it occurs
B. The block in which it occurs
C. The function in which it occurs
D. The program in which it occurs
Answer : D
42. The signature of a function is
A. The return type
B. The number and type of arguments
C. The class of a function
D. None of the above
Answer : D
43. Class members are _______________ by default
A. Private
B. protected
C. public
D. None of the above are correct
Answer : A
44. Organizing data with methods that operate on the data and creating a new data type is called encapsulation.
A. True
B. False
C.
D.
Answer : A
45. What is the value of Friday in the following - enum days { Monday, Tuesday, Wednesday = -1, Thursday, Friday, Saturday = 6, Sunday}
A. 1
B. 5
C. 0
D. -3
Answer : A
46. One of the important features of an abstract class is
A. it need not have any object
B. it should be used only as a derived class
C. it need not have any members
D. none of the above
Answer : A
47. Reference to an object behaves like a constant pointer.
A. True
B. False
C.
D.
Answer : B
48. A variable defined within a block is visible
A. From the point of definition onwards in the program
B. From the point of definition onwards in the function
C. From the point of definition onwards in the block
D. Throughout the function
Answer : C
49. Sharing of common information are achieved by the concept of
A. Virtual copying
B. Inheritance
C. Encapsulation
D. None of these
Answer : B
50. The declaration int **var1; shows that
A. var1 can not be accessed
B. var1 is a pointer to a pointer of type int
C. var1 is a protected data type of integer
D. this type declaration shows an error
Answer : B

Sharing is caring