C++ MCQ
C++ MCQ
1. Operator Functions
2. Virtual Functions
3. Constant Functions
4. All of above
2. Which one of the following cannot be used with the virtual keyword?
1. Destructor
2. Member function
3. Constructor
4. None of the above
Answer: Constructor
4. Which of the following is the correct syntax to add the header file in the C++
program?
1. #include "userdefined.h"
2. #include<userdefined>
3. <include> "userdefined.h"
4. Both A & B
5. Which of the following statements is correct about the friend function in C++
programming language?
7. Which of the following can be used to create an abstract class in the C++
programming language?
8. Which of the following can be considered as the members that can be inherited but
not accessible in any class?
1. Protected
2. Public
3. Private
4. None of the above
Answer: Private
9. Which of the following is the correct syntax to print the message in C++ language?
10. Which of the following can be considered as the correct syntax for declaring an
array of pointers of integers that has a size of 10 in C++?
11. Which one of the following statements correctly refers to the Delete and Delete[] in
C++ programming language?
1. The "Delete" is used for deleting the standard objects, while on the other hand, the
"Delete[]" is used to delete the pointer objects
2. The "Delete" is a type of keyword, whereas the "Delete[]" is a type of identifier
3. The "Delete" is used for deleting a single standard object, whereas the "Delete[]" is
used for deleting an array of the multiple objects
4. Delete is syntactically correct although, if the Delete[] is used, it will obtain an error
Answer: The "Delete" is used for deleting a single standard object, whereas the
"Delete[]" is used for deleting an array of the multiple objects
Answer: It is a C++ technique to avoid multiple copies of the base class into the derived
or child classes
13. Elements of a one-dimensional array are numbered as 0,1,2,3,4,5, and so on; these
numbers are known as ____
1. Members of Array
2. Index values
3. Subscript of Array
4. None of Above
Answer: Single-dimensional
1. Multi-Dimensional array
2. Single Dimensional array
3. 2D Array (or 2-Dimensional array)
4. All of above
18. Which one of the following is the correct definition of the "is_array();" function in
C++?
1. It returns the maximum number of elements that can be stored in the array
2. It returns the size of each dimension
3. It returns the dimension of the specified array
4. None of the above
20. How many types of the array are there in the C++ programming language?
Answer: In the C++ programming language, there are two types of arrays
Answer: Sorting is a type of process in which the data or information is ordered into a
specific order. Example increasing orders, decreasing.
1. None-contiguous
2. Contiguous
3. All of above
4. None of above
Answer: Contiguous
23. Which of the following gives the 4th element of the array?
1. Array[0];
2. Array[0];
3. Array[3];
4. None of the above
Answer: Array[3];
24. Which of the following is the correct syntax for printing the address of the first
element?
1. array[0];
2. array[2];
3. array[1];
4. None of the above
Answer: array[0];
1. varname@
2. $var_name
3. VAR_123
4. None of the above
Answer: VAR_123
26. Which of the following is the correct syntax for declaring the array?
1. 88
2. 5
3. 4
4. 3
Answer: 4
28. Which of the following is the original creator of the C++ language?
1. Dennis Ritchie
2. Ken Thompson
3. Bjarne Stroustrup
4. Brian Kernighan
29. The programming language that has the ability to create new data types is
called_______________
1. Overloaded
2. Reprehensible
3. Extensible
4. Encapsulated
Answer: Extensible
31. Which of the following features must be supported by any programming language to
become a pure object-oriented programming language?
1. Inheritance
2. Encapsulation
3. Polymorphism
4. All of the above
Answer: \t
1. &
2. #
3. %
4. @
Answer: &
34. Which of the following is the correct syntax to read the single character to console in
the C++ language?
1. get(ch)
2. Scanf(ch)
3. Read ch()
4. Getline vh()
Answer: get(ch)
35. For inserting a new line in C++ program, which one of the following statements can
be used?
1. \r
2. \n
3. \a
4. None of the above
Answer: \n
1. Middle-level language
2. High-level Language
3. Low-level language
4. None of the above
37. Which of the following statements is correct about the formal parameters in C++?
38. Which of the following comment syntax is correct to create a single-line comment in
the C++ program?
1. /Comment/
2. Comment//
3. //Comment
4. None of the above
Answer: //Comment
1. Inheritance
2. Polymorphism
3. Encapsulation
4. All of the above