C Plus Plus(C++) Programming Language Questions with Answers | Solved MCQs

Questions
37. precision() is used to _____________.
  • [A] sets format flags that control the format of output display
  • [B} specifies the number of digits to be displayed after decimal point.
  • [C} clears the flags.
  • [A] specifies the required number of fields to be used while displaying the output value.

Answer: Option [B]

38. Which of the following is not a valid file mode?
  • [A] ios::in
  • [B} ios::out
  • [C} ios::truncate
  • [A] ios::noreplace

Answer: Option [C]

39. _________ allows access to the specific data without need for accessing its preceding its data items.
  • [A] sequential file
  • [B} random file
  • [C} get file
  • [A] put file

Answer: Option [B]

40. Which one of the following is invalid variable name?
  • [A] 1count
  • [B} count.
  • [C} count1.
  • [A] count_1.

Answer: Option [A]

41. The elements of an array can be accessed by providing integer expression called _______.
  • [A] superscripts.
  • [B} elements.
  • [C} values.
  • [A] subscripts.

Answer: Option [D]

42. ___________ is not a type of scope in c++.
  • [A] Global.
  • [B} Local.
  • [C} File.
  • [A] Function.

Answer: Option [D]

43. Which of the following is the proper keyword to deallocate memory?
  • [A] free
  • [B} delete
  • [C} clear
  • [A] remove

Answer: Option [A]

44. Most of the statement in C++ program should end with ______
  • [A] a full stop (.).
  • [B} a comma (,).
  • [C} a semicolon (;).
  • [A] a colon (:).

Answer: Option [C]

45. If and the switch statements are called as _____ statements.
  • [A] iteration.
  • [B} jump.
  • [C} selection
  • [A] conditional

Answer: Option [C]

46. Find out the error in following block of code. if (x=100) cout<< "x is 100"
  • [A] 100 should be enclosed in quotations
  • [B} There is no semicolon at the end of first line.
  • [C} Equals to operator mistake.
  • [A] Variable x should not be inside quotation.

Answer: Option [C]

VIEW ALL UGC NET EBooks
47. If the type specifier of parameters of a function is followed by an ampersand (&), that function call is _______.
  • [A] pass by value.
  • [B} pass by value.
  • [C} array of structures.
  • [A] array of structures. pointers.

Answer: Option [B]

48. The general form, of assignment operator is _____.
  • [A] variable_name=expression
  • [B} datatype=expression.
  • [C} variable=expression.
  • [A] datatype=expression.

Answer: Option [A]