Void C++ MCQ

Errorlogger
0
1. Which of the following will not return a value?
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?
  1.     #include <iostream>
  2.     using namespace std;
  3.     int main()
  4.     {
  5.         void a = 10, b = 10;
  6.         int c;
  7.         c = a + b;
  8.         cout << c;
  9.         return 0;
  10.     }
a) 20
b) compile time error
c) runtime error
d) none of the mentioned

Answer:b
Tags

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(30)

Our website uses cookies to enhance your experience. Check Now
Accept !