Test Series - cpp

Test Number 23/102

Q: If an argument from the parameter list of a function is defined constant then _______________
A. It can be modified inside the function
B. It cannot be modified inside the function
C. Error occurs
D. Segmentation fault
Solution: A function is not allowed a constant member of the parameter list.
Q: Which of the following feature is used in function overloading and function with default argument?
A. Encapsulation
B. Polymorphism
C. Abstraction
D. Modularity
Solution: Both of the above types allows a function overloading which is the basic concept of Polymorphism.
Q: From which function the execution of a C++ program starts?
A. start() function
B. main() function
C. new() function
D. end() function
Solution: The execution of a C++ program starts from the main() function.
Q: Which of the following is important in a function?
A. Return type
B. Function name
C. Both return type and function name
D. The return type, function name and parameter list
Solution: The important things required in a function is its return type and its name other than that parameter list are optional which a function may or may not have.
Q: How many ways of passing a parameter are there in c++?
A. 1
B. 2
C. 3
D. 4
Solution: There are three ways of passing a parameter. They are pass by value,pass by reference and pass by pointer.
Q: Which is used to keep the call by reference value as intact?
A. static
B. const
C. absolute
D. virtual
Solution: Because const will not change the value of the variables during the execution.
Q: By default how the value are passed in c++?
A. call by value
B. call by reference
C. call by pointer
D. call by object
Solution: None.
Q: What will happen when we use void in argument passing?
A. It will not return value to its caller
B. It will return value to its caller
C. Maybe or may not be return any value to its caller
D. It will return value with help of object
Solution: As void is not having any return value, it will not return the value to the caller.
Q: How many types of returning values are present in c++?
A. 1
B. 2
C. 3
D. 4
Solution: The three types of returning values are return by value, return by reference and return by address.
Q: What will you use if you are not intended to get a return value?
A. static
B. const
C. volatile
D. void
Solution: Void is used to not to return anything.

You Have Score    /10