Question 1 of 25
Hints left: 3
Q1
What is the correct syntax to define a function named 'add' that takes two integers as parameters and returns their sum in C++?
Q2
What happens if a class does not have a name?
Q3
What is the correct way to include the C++ standard input/output library header file in a C++ program?
Q4
Which of the following escape sequence represents carriage return?
Q5
Which operator is used to access the member functions and variables of an object in C++?
Q6
What is the correct syntax to define a class named 'Rectangle' with private member variables 'length' and 'width' in C++?
Q7
What is the purpose of the 'break' statement in a loop in C++?
Q8
What is the output of the following code: cout << (10 / 4); in C++?
Q9
What are the formal parameters in C++?
Q10
In C++, what is the purpose of the 'endl' manipulator?
Q11
Which of the following is a static polymorphism mechanism?
Q12
Which of the following is true? I. All operators in C++ can be overloaded. II. The basic meaning of an operator can be changed.
Q13
What does the 'const' keyword signify when used with a member function in a C++ class declaration?
Q14
What will be the output of the following program in both C and C++? #include<stdio.h> int main(int argc, char const *argv[]) { printf("%d\n", (int)sizeof('a')); return 0; }
Q15
What does the 'new' operator return when memory allocation fails in C++?
Q16
What is the result of the expression: sizeof(char) in C++?
Q17
What is the output of the following code: int x = 5, y = 2; cout << x / y; in C++?
Q18
Which of the following is not a valid data type in C++?
Q19
What is the output of the following code: cout << "Hello\nWorld"; in C++?
Q20
Which operator is used to dereference a pointer in C++?
Q21
What is the output of the following code: cout << (10 % 3); in C++?
Q22
What is the correct way to define a constant named 'PI' with a value of 3.14159 in C++?
Q23
What is the output of the following code: cout << (5 < 2) ? "True" : "False"; in C++?
Q24
Which of the following is the correct syntax for declaring a pointer to an integer in C++?
Q25
What if we define the below structure in C and C++?