1. Which of the following will not return a value?
a) null
b) void
c) empty
d) free
2. ____ have the return type void?
a) all functions
b) constructors
c) destructors
d) none of the mentioned
3. What does the following statement mean?
void a;
a) variable a is of type void
b) a is an object of type void
c) declares a variable with value a
d) flags an error
4. Choose the incorrect option
a) void is used when the function does not return a value.
b) void is also used when the value of a pointer is null.
c) void is used as the base type for pointers to objects of unknown type.
d) void is a special fundamental type.
5. What is the output of this program?
a) 20
b) compile time error
c) runtime error
d) none of the mentioned
a) null
b) void
c) empty
d) free
Answer:b
2. ____ have the return type void?
a) all functions
b) constructors
c) destructors
d) none of the mentioned
Answer:b
3. What does the following statement mean?
void a;
a) variable a is of type void
b) a is an object of type void
c) declares a variable with value a
d) flags an error
Answer:d
4. Choose the incorrect option
a) void is used when the function does not return a value.
b) void is also used when the value of a pointer is null.
c) void is used as the base type for pointers to objects of unknown type.
d) void is a special fundamental type.
Answer:b
5. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
void a = 10, b = 10;
int c;
c = a + b;
cout << c;
return 0;
}
b) compile time error
c) runtime error
d) none of the mentioned
Answer:b