WorksheetsC++ Quiz
Total questions: 10
Worksheet time: 5mins
1.Who invented C++?
a) Dennis Ritchie
b) Ken Thompson
c) Brian Kernighan
d) Bjarne Stroustrup
2. Which of the following is used for comments in C++?
a) /* comment /
b) // comment /
c) // comment
d) both // comment or /* comment */
3.Which of the following is a correct identifier in C++
a) VAR_1234
b) $var_name
c) 7VARNAME
d) 7var_name
4.What happens if the following program is executed in C and C++?
#include <stdio.h>
int main(void){
int new = 5;
printf("%d", new); }
a) Error in C and successful execution in C++
b) Error in both C and C++
c) Error in C++ and successful execution in C
d) A successful run in both C and C++
5.Which of the following correctly declares an array in C++?
a) array{10};
b) array array[10];
c) int array;
d) int array[10];
6.What is the size of wchar_t in C++?
a) Based on the number of bits in the system
b) 2 or 4
c) 4
d) 2
7. Which is more effective while calling the C++ functions?
a) call by object
b) call by pointer
c) call by value
d) call by reference
8. Which of the following is used to terminate the function declaration in C++?
a) ;
b) ]
c) )
d) :
9. Which keyword is used to define the macros in c+
a) #macro
b) #define
c) macro
d) define
10. What is Inheritance in C++?
a) Deriving new classes from existing classes
b) Overloading of classes
c) Classes with same names
d) Wrapping of data into a single class
