A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

1. What are default arguments?
a. Arguments which are not mandatory to be passed
b. Arguments with default value that aren’t mandatory to be passed
c. Arguments which are not passed to functions
d. Arguments which always take same data value
View Answer Report Discuss Too Difficult!
Answer: (b).Arguments with default value that aren’t mandatory to be passed

2. Which is correct condition for the default arguments?
a. Those must be declared as last arguments in argument list
b. Those must be declared first in the argument list
c. Those can be defined anywhere in the argument list
d. Those are declared inside the function definition
View Answer Report Discuss Too Difficult!
Answer: (a).Those must be declared as last arguments in argument list

3. If a member function have to be made both zero argument and parameterized constructor, which among the following can be the best option?
a. Two normal and one default argument
b. At least one default argument
c. Exactly one default argument
d. Make all the arguments default
View Answer Report Discuss Too Difficult!
Answer: (d).Make all the arguments default

4. Which among the following function can be called without arguments?
a. void add(int x, int y=0)
b. void add(int=0)
c. void add(char c)
d. void add(char c)
View Answer Report Discuss Too Difficult!
Answer: (d).void add(char c)

5. If a function have all the default arguments but still some values are passed to the function then ______________
a. The function will use the values passed to it
b. The function will use the default values as those are local
c. The function can use any value whichever is higher
d. The function will choose the minimum values
View Answer Report Discuss Too Difficult!
Answer: (a).The function will use the values passed to it

6. What function will be called with the independent syntax “test(5,6,7);”?
a. void test(int x, int y)
b. void test(int x=0,int y,int z)
c. int test(int x=0,y=0,z=0)
d. void test(int x,int y, int z=0)
View Answer Report Discuss Too Difficult!
Answer: (d).void test(int x,int y, int z=0)

7. Which among the following is wrong call to the function void test(int x, int y=0, int z=0)?
a. test(5,6,7);
b. test(5);
c. test();
d. test(5,6);
View Answer Report Discuss Too Difficult!
Answer: (c).test();

8. Default arguments are _________________________
a. Only allowed in the parameter list of the function declaration
b. Only allowed in the return type of the function declaration
c. Only allowed with the class name definition
d. Only allowed with the integer type values
View Answer Report Discuss Too Difficult!
Answer: (a).Only allowed in the parameter list of the function declaration

9. Which among the following is false for default arguments?
a. Those are not allowed with declaration of pointer to functions
b. Those are not allowed with the reference to functions
c. Those are not allowed with the typedef declarations
d. Those are allowed with pointer and reference to function declaration
View Answer Report Discuss Too Difficult!
Answer: (d).Those are allowed with pointer and reference to function declaration

10. The non-template functions can be added with default arguments to already declared functions ____________________
a. If and only if the function is declared again in the same scope
b. If and only if the function is declared only once in the same scope
c. If and only if the function is declared in different scope
d. If and only if the function is declared twice in the program
View Answer Report Discuss Too Difficult!
Answer: (a).If and only if the function is declared again in the same scope

Page 1 of 6