C++ MCQ -9

Question 1:

A function can not be overloaded only by its return type.

a. True

b. False

 
Question 2:

A function can be overloaded with a different return type if it has all the parameters same.

a. True

b. False

 
Question 3:

Inline functions involves some additional overhead in running time.

a. True

b. False

 
Question 4:

A function that calls itself for its processing is known as

a. Inline Function

b. Nested Function

c. Overloaded Function

d. Recursive Function

 
Question 5:

We declare a function with ______ if it does not have any return type

a. long

b. double

c. void

d. int

 
Question 6:

Arguments of a functions are separated with

a. comma (,)

b. semicolon (Wink

c. colon (Smile

d. None of these

 
Question 7:

Variables inside parenthesis of functions declarations have _____ level access.

a. Local

b. Global

c. Module

d. Universal

 
Question 8:

Observe following function declaration and choose the best answer:

int  divide ( int a, int b = 2 )

a. Variable b is of integer  type and will always have value 2

b. Variable a and b are of int type and the initial value of both variables is 2

c. Variable b is international scope and will have value 2

d. Variable b will have value 2 if not specified when calling function

 
Question 9:

The keyword endl

a. Ends the execution of program where it is written

b. Ends the output in cout statement

c. Ends the line in program. There can be no statements after endl

d. Ends current line and starts a new line in cout statement.

 
Question 10:

Strings are character arrays. The last index of it contains the null-terminated character

a. \n

b. \t

c. \0

d. \1

 

 
Answers:

1. a. True

2. b. False

3. a. True

4. d. Recursive Function

5. c. Void

6. a. Comma (,)

7. a. Local

8. d. Variable b will have value 2 if not specified when calling function

9. d. Ends current line and starts a new line in cout statement

10. c. \0

Similar Posts

  • C++ MCQ -3

    Question 1: Find out the error in following block of code. If (x = 100)     Cout << ΓÇ£x is 100ΓÇ¥; a.       100 should be enclosed in quotations b.      There is no semicolon at the end of first line c.       Equals to operator mistake d.      Variable x should not be inside quotation   Question 2:…

  • C++ MCQ-11

    Q.31  Use of virtual functions implies (A)  overloading.  (B)  overriding. (C)  static binding.  (D)  dynamic binding. Ans: D   Q.32   this pointer      (A)  implicitly points to an object.    (B)  can be explicitly used in a class. (C)  can be used to return an object.   (D)  All of the above.    Ans: D…

  • C++ MCQ-12

    Q.1   The address of a variable temp of type float is          (A) *temp  (B) &temp     (C) float& temp  (D) float temp&     Ans: B   Q.2   What is the output of the following code           char symbol[3]={ΓÇÿaΓÇÖ,ΓÇÿbΓÇÖ,ΓÇÿcΓÇÖ};            for (int index=0; index<3; index++)         cout << symbol…

  • C++ MCQ -2

    Question 1: The void specifier is used if a function does not have return type. a.       True b.      False   Question 2: You must specify void in parameters if a function does not have any arguments. a.       True b.      False   Question 3: Type specifier is optional when declaring a function a.       True b.      False…

  • C++ MCQ -8

    Question 1 Identify the correct statement a. Programmer can use comments to include short explanations within the source code itself. b. All lines beginning with two slash signs are considered comments. c. Comments very important effect on the behaviour of the program d. both   Question 2 The directives for the preprocessors begin with a.   …

  • C++ MCQ-14

    Q.61  An array element is accessed using (A)  a FIFO approach  (B)  an index number (C)  the operator  (D)  a member name     Ans:B   Q.62   If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain…

Leave a Reply

Your email address will not be published. Required fields are marked *