How can you prevent a C++ class from being inherited from?
By using the 'abstract' keyword
By declaring it with the 'final' keyword
By making all its members private
By not defining any constructors
What is the correct way to declare an integer array named 'numbers' with a size of 5 in C++?
array numbers[5];
numbers[5] as int;
int numbers(5);
int numbers[5];
How do you declare a variable named 'age' of integer type?
age as int;
int age;
declare age as integer;
variable age: int;
Which statement is used to display output to the console in C++?
cout
printf
print
cin
What is the primary purpose of a constructor in a C++ class?
To free up memory when an object is destroyed
To initialize object members when an object is created
To implement polymorphism
To define the class's interface
Which operator is used to combine two strings in C++?
/
What is the purpose of the 'return' statement in a C++ function?
It terminates the function's execution and returns control to the calling function.
It declares a new variable within the function.
It prints the function's output to the console.
It marks a section of code for debugging purposes.
In C++, a character array can be used to store a string. What is the special character that signifies the end of a string in a character array?
.
\n
'\0'
\0
What does the modulus operator (%) return?
The sum of two operands.
The product of two operands.
The quotient of a division.
The remainder of a division.
Which operator is used to access members of an object using a pointer to that object?
->
::