Test Series - cpp

Test Number 21/102

Q: How many types of comments are there in c++?
A. 1
B. 2
C. 3
D. 4
Solution: There are two types of comments in C++. Single line comments uses double slash //. Multiple line comments uses /* comment inside */.
Q: What is a comment in c++?
A. comments are parts of the source code disregarded by the compiler
B. comments are executed by the compiler to find the meaning of the comment
C. comments are executable
D. comments are executed by the compiler
Solution: Comments are used to add meaning to the program.
Q: What type of comments does c++ support?
A. single line
B. multiline
C. single line and multi-line
D. reusable line
Solution: C++ provides two types of comments in programs. They are single line(using //) or multiple line (using /*…… */) comments.
Q: What is used to write multi line comment in c++?
A. /* …. */
B. /$ …. $/
C. //
D. /$ …. */
Solution: The /* is used to write the multi line comment.
Q: What is the use of the indentation in c++?
A. distinguishes between comments and code
B. r distinguishes between comments and outer data
C. distinguishes between comments and outer data
D. r distinguishes between comments and inner data
Solution: To distinguish between different parts of the program like comments, codes, etc.
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. May or may not depend on the declared return type of the function, the passed arguments are different than the function return type
D. It will return value
Solution: As void is not having any return value, it will not return the value to the caller.
Q: Where does the execution of the program starts?
A. user-defined function
B. main function
C. void function
D. else function
Solution: Normally the execution of the program in c++ starts from main only.
Q: What are mandatory parts in the function declaration?
A. return type, function name
B. return type, function name, parameters
C. parameters, function name
D. parameters, variables
Solution: In a function, return type and function name are mandatory all else are just used as a choice.
Q: which of the following is used to terminate the function declaration?
A. :
B. )
C. ;
D. ]
Solution: ; semicolon is used to terminate a function declaration statement in C++.
Q: How many can max number of arguments present in function in the c99 compiler?
A. 99
B. 90
C. 102
D. 127
Solution: C99 allows to pass a maximum of 127 arguments in a function.

You Have Score    /10