
Q 1.What are the formal parameters in C++?
A. Parameters with which functions are called
B. Variables that are never used in the function
C. Variables other than passed parameters in a function
D. Parameters which are used in the definition of the function
Show Answer
Answer:-D. Parameters which are used in the definition of the functionExplanation
Formal parameters are those which are used in the definition of a function. They are the parameters that represent the actual parameters passed and they are the one which is used inside the function.Q 2. Which function is used to read a single character from the console in C++?
A. scanf(ch)
B. getline(ch)
C. read(ch)
D. cin.get(ch)
Show Answer
Answer:-D. cin.get(ch)Explanation
C++ provides cin.get() function to read a single character from console whereas others are used to read either a single or multiple characters.Q 3. Which function is used to write a single character to console in C++?
A. cout.putline(ch)
B. cout.put(ch)
C. write(ch)
D. printf(ch)
Show Answer
Answer:-B. cout.put(ch)Explanation
C++ provides cout.put() function to write a single character to console whereas others are used to write either a single or multiple characters.Q 4. What are the escape sequences?
A. Set of characters that convey special meaning in a program
B. Set of characters that whose use are avoided in C++ programs
C. Set of characters that are used in the name of the main function of the program
D. Set of characters that are avoided in cout statements
Show Answer
Answer:-A. Set of characters that convey special meaning in a programExplanation
Escape sequence is a set of characters that convey a special meaning to the program. They are used to convey a meaning which cannot be conveyed directly.Q 5.Which of the following escape sequence represents carriage return?
A. \n
B. \r
C. \n\r
D. \c
Show Answer
Answer:-B. \rExplanation
\r is used to represent carriage return which means move the cursor to the beginning of the next line.Q 6. Which of the following escape sequence represents tab?
A. \t
B. \t\r
C. \b
D. \a
Show Answer
Answer:-A. \tExplanation
\t is used to represent tab which means a set of blank spaces in a line.Q 7.Who created C++?
A. Brian Kernighan
B. Dennis Ritchie
C. Ken Thompson
D. Bjarne Stroustrup
Show Answer
Answer:-D. Bjarne StroustrupExplanation
Bjarne Stroustrup is the original creator of C++ during 1979 at AT&T Bell Labs.Q 8. Which of the following is called insertion/put to operator?
A. <<
B. >>
C. >
D. <
Show Answer
Answer:-A. <<Explanation
<< operator is called insertion or put to operator i.e. insert/put things to console/files.Q 9. Which of the following is called extraction/get from operator?
A. <<
B. >>
C. >
D. <
Show Answer
Answer:- B. >>Explanation
>> operator is called extraction or get from operator i.e. extract/get things from console/files.Q 10. A language which has the capability to generate new data types are called ____
A. Overloaded
B. Extensible
C. Encapsulated
D. Reprehensible
Show Answer
Answer:-B. ExtensibleExplanation
Languages that can produce/generate new data types are called extensible languages as they have the ability to handle new data types.Q 11. Which of the following is used for comments in C++?
A. // comment
B. /* comment */
C. both // comment or /* comment */
D. // comment */
Show Answer
Answer:-C. both // comment or /* comment */Explanation
Both the ways are used for commenting in C++ programming. // is used for single line comments and /* … */ is used for multiple line comments.Q 12. What are the actual parameters in C++?
A. Variables other than passed parameters in a function
B. Parameters which are used in the definition of a function
C. Parameters with which functions are called
D. Variables that are never used in the function
Show Answer
Answer:-C. Parameters with which functions are calledExplanation
Actual parameters are those using which a function call is made i.e. which are actually passed in a function when that function is called.Q 13 . Which of the following is the correct syntax of including a user defined header files in C++?
A. > #include “userdefined”
B. #include <userdefined>
C. #include <userdefined.h
D. #include [userdefined]
Show Answer
Answer:-A. > #include “userdefined”Explanation
C++ uses double quotes to include a user-defined header file. The correct syntax of including user-defined is #include “userdefinedname”Q 14. Which of the following is a correct identifier in C++?
A. 7var_name
B. 7VARNAME
C. $var_name
D. VAR_1234
Show Answer
Answer:-D. VAR_1234Explanation
The rules for writing an identifier is as follows: i) may contain lowercase/uppercase letters, digits or underscore(_) only ii) should start with a non-digit character iii) should not contain any special characters like @, $, etc.Q 15. Which of the following is called address operator?
A. *
B. &
C. _
D. %
Leave a Reply