Test Series - cpp

Test Number 29/102

Q: How many types of linkages are there in C++?
A. 1
B. 2
C. 3
D. 4
Solution: There are three types of linkage in c++. They are an internal linkage, external linkage, and no linkage.
Q: To use internal linkage we have to use which keyword?
A. static
B. extern
C. static or extern
D. public
Solution: static keyword is used for internal linkage.
Q: Which one is used to refer to program elements in any translation units?
A. internal linkage
B. external linkage
C. no linkage
D. internal & external linkage
Solution: In the external linkage, it is used to refer to identifiers in various programs.
Q: What is the default type of linkage that is available for identifiers?
A. internal
B. external
C. no linkage
D. single linkage
Solution: external is the default type of linkage that is available for identifiers.
Q: To use external linkage we have to use which keyword?
A. static
B. extern
C. const
D. argc
Solution: Extern keyword is used to represent identifiers from other programs.
Q: Which is used to use a function from one source file to another?
A. code
B. declaration
C. prototype
D. variable
Solution: By defining a function’s prototype in another file means, we can inherit all the features from the source function.
Q: What is the use of no linkage?
A. make the entity visible to other programs
B. make the entity visible to other blocks in the same program
C. make the entity visible only to that block
D. make the entity invisible
Solution: None.
Q: What is the user-defined header file extension in c++?
A. cpp
B. h
C. hf
D. hg
Solution: .h extensions are used for user defined header files. To include a user defined header file one should use #include”name.h” i.e. enclosed within double quotes.
Q: Which of the following keyword is used to declare the header file?
A. include
B. exclude
C. string
D. namespace
Solution: The include keyword is used to include all the required things to execute the given code in the program.
Q: Identify the incorrect statement.
A. iostream is a standard header and iostream.h is a non-standard header
B. iostream is a non-standard header and iostream.h is a non-standard header
C. iostream is a standard header and iostream.h is a standard header
D. iostream is a non-standard header
Solution: The iostream.h is used in the older versions of c++ and iostream is evolved from it in the std namespace.

You Have Score    /10