1. Which parameter passing mechanism makes a copy of the argument so the called function cannot modify the caller’s original object? A) Call by value B) Call by reference C) Call by pointer D) Call by rvalue reference Answer: A 2. Which parameter type allows a function to modify the original argument and does not
1. Which of the following statements in C++ is used to exit from a loop immediately? A) continue B) goto C) break D) exit Answer: C) break 2. The continue statement in C++ causes the program to: A) Exit from the current loop B) Terminate the program C) Skip the rest of the loop body
1. Which of the following operators cannot be overloaded in C++? A) + B) C) :: D) () Answer: C) :: 2. What is the associativity of the assignment operator (=) in C++? A) Left to Right B) Right to Left C) Top to Bottom D) Undefined Answer: B) Right to Left 3. The
1. What is the output of this code? int main(){ int a = 5; if(a > 3) if(a < 10) cout << “X”; else cout << “Y”; else cout << “Z”; } A) X B) Y C) Z D) Compiler error Answer: A 2. Which statement is true about the continue statement inside a for
1. Which of the following is guaranteed by the C++ standard about the size of char? A) sizeof(char) may be greater than sizeof(int) B) sizeof(char) is always 2 bytes C) sizeof(char) is always equal to sizeof(short) D) sizeof(char) is defined to be 1 (as the unit of size) Answer: D) sizeof(char) is defined to be
1. Which of the following is a valid variable name in C++? A) 9count B) total$sum C) count_9 D) int Answer: C) count_9 2. What is the correct keyword to define a constant variable in C++? A) static B) final C) define D) const Answer: D) const 3. What is the storage class specifier that
1. Which of the following is a valid identifier in C++? A) 123name B) name@cpp C) _result D) for Answer: C) _result 2. In C++, identifiers can begin with which of the following characters? A) A digit B) A special character (#, $, @) C) An underscore or an alphabet D) A space Answer: C)
Q1. In C++, the smallest individual unit in a program is known as a: A) Identifier B) Keyword C) Token D) Character Answer: Token Q2. Which of the following is not a category of tokens in C++? A) Keywords B) Identifiers C) Literals D) Headers Answer: Headers Q3. Which of the following is a valid
1. Which of the following best describes polymorphism in OOP? A) A design pattern for UI components B) The ability of a function to access private data C) The ability of different objects to be treated through a common interface D) A mechanism to prevent subclassing Answer: C — The ability of different objects to
1. An abstract class in OOP is best described as: A) A class that cannot contain methods. B) A class that may contain abstract methods and cannot be instantiated directly. C) A class that has no data members. D) A class that always has only static methods. Answer: B 2. Which of the following statements