Extra 5% OFF Use Code: OL05
Free Shipping over ₹999

C++ Programming quiz

C++ Programming quiz

1 / 100

Which of the following is NOT a relational operator in C++?

2 / 100

Which header file is required to use the string class in C++?

3 / 100

What does the & operator do when used with a variable?

4 / 100

Which keyword is used to define a structure in C++?

5 / 100

Which of the following is a logical operator in C?

6 / 100

What is the correct syntax to declare a constant variable in C++?

7 / 100

How do you find the size of a string in C++?

8 / 100

What is an object in C++?

9 / 100

What is the best way to access private data members of a class from outside?

10 / 100

Which of the following is the correct way to initialize multiple variables in C++?

11 / 100

What is an object in C++?

12 / 100

Which of the following is NOT a valid variable name in C++?

13 / 100

What is a reference variable in C++?

14 / 100

What is a class in C++?

15 / 100

Which type of constructor does NOT take any parameters?

16 / 100

What is a destructor in C++?

17 / 100

What will happen if a class member is declared as public?

18 / 100

How do you define a constructor in C++?

19 / 100

What will happen if a class member is declared as private?

20 / 100

What will be the output of this code?

21 / 100

Which function is used to extract a substring in C++?

22 / 100

What is recursion in C++?

23 / 100

What is the size of a char data type in C++?

24 / 100

What is a pointer in C++?

25 / 100

What will be the output of this code?

26 / 100

What is the correct syntax for an if statement in C++?

27 / 100

What is a function in C++?

28 / 100

What is the correct way to write a ternary operator in C++?

29 / 100

What will be the output of the following code?

30 / 100

If a derived class uses private inheritance, how will the public members of the base class behave in the derived class?

31 / 100

Which of the following statements is true about arrays in C++?

32 / 100

What is a parameterized constructor?

33 / 100

What type of operator is ++ in C++?

34 / 100

What is the purpose of a constructor in C++?

35 / 100

What is function overloading in C++?

36 / 100

Which operator is used to access the memory address of a variable?

37 / 100

How do you get the total number of elements in an array arr of size 10?

38 / 100

What is the correct syntax for defining a constructor in C++?

39 / 100

What is the default access specifier for members of a class in C++?

40 / 100

How do you access the members of a structure variable in C++?

41 / 100

What is a NULL pointer?

42 / 100

How do you find the size of a string in C++?

43 / 100

What is the best way to access private data members of a class from outside?

44 / 100

Which of the following is NOT a pillar of OOP?

45 / 100

Which of the following statements about the switch statement is true?

46 / 100

What happens if you access an array index that is out of bounds?

47 / 100

What is the correct way to pass a structure to a function?

48 / 100

How do you define a structure in C++?

49 / 100

What is the default value of an uninitialized integer array element in C++?

50 / 100

What is the correct way to pass a variable by reference to a function?

51 / 100

Which operator is used for the logical AND operation in C++?

52 / 100

What is a class in C++?

53 / 100

What are the three types of access specifiers in C++?

54 / 100

How many times is a constructor called when creating 3 objects of a class?

55 / 100

What is the key characteristic of a constructor?

56 / 100

What is the correct syntax for a function with a default parameter?

57 / 100

Which access specifier allows members to be accessed from outside the class?

58 / 100

What happens when you try to change the reference to refer to another variable?

59 / 100

Which keyword is used for multiple conditions in an if statement?

60 / 100

Which of the following is a floating-point data type in C++?

61 / 100

What is function overloading?

62 / 100

What does str.empty() return?

63 / 100

Which of the following correctly initializes a C++ string?

64 / 100

What is a constructor in C++?

65 / 100

Which of the following is the correct syntax for defining a function in C++?

66 / 100

How can encapsulation be violated in C++?

67 / 100

What is the return type of a function that does not return any value?

68 / 100

What is the correct syntax for declaring a reference variable?

69 / 100

Which of the following is the assignment operator in C?

70 / 100

What is an advantage of using classes in C++?

71 / 100

What will happen if no constructor is defined in a C++ class?

72 / 100

What is the purpose of a copy constructor?

73 / 100

Which of the following is a correct variable declaration in C++?

74 / 100

Which access specifier is commonly used to implement encapsulation in C++?

75 / 100

Which data type is used to store a single character in C++?

76 / 100

What is the difference between pointers and references in C++?

77 / 100

Which of the following is used to take input in C++?

78 / 100

How do you create an object of a class named Student?

79 / 100

Which of the following is NOT a type of loop in C++?

80 / 100

Which operator is used to allocate memory dynamically in C++?

81 / 100

How do you initialize all elements of an integer array arr[5] to 0?

82 / 100

What is the index of the last element in an array of size 7?

83 / 100

What does the protected access specifier do?

84 / 100

What is the correct way to read an entire line of input as a string?

85 / 100

What is encapsulation in OOP?

86 / 100

What happens if you dereference an uninitialized pointer?

87 / 100

What is the range of values for an int data type in most 32-bit systems?

88 / 100

Which keyword is used to define a constant variable in C++?

89 / 100

What is the result of 5 / 2 in C++ (integer division)?

90 / 100

How can you stop an infinite loop in C++?

91 / 100

Which loop is guaranteed to execute at least once?

92 / 100

Which loop is best used when the number of iterations is known?

93 / 100

What is the correct way to read an entire line of input as a string?

94 / 100

What is the size of an int in most compilers?

95 / 100

What is an abstract class in C++?

96 / 100

Which access specifier allows members of a class to be accessible only within the same class?

97 / 100

How do you dynamically allocate memory for an integer using pointers?

98 / 100

How do you deallocate memory allocated with new in C++?

99 / 100

How do you declare an array of integers with 5 elements in C++?

100 / 100

Which OOP principle allows one class to inherit from another?

Your score is

The average score is 88%

0%

    Leave a Reply

    Your email address will not be published.

    Need Help?