πŸ“Š CPP Programming
Q. Which of the following is true about templates?
1) Template is a feature of C++ that allows us to write one code for different data types.
2) We can write one function that can be used for all data types including user defined types. Like sort(), max(), min(), ..etc.
3) We can write one class or struct that can be used for all data types including user defined types. Like Linked List, Stack, Queue,..etc.
4) Template is an example of compile time polymorphism.
  • (A) 1 and 2
  • (B) 1, 2 and 3
  • (C) 1, 2 and 4
  • (D) 1, 2, 3 and 4
πŸ’¬ Discuss
βœ… Correct Answer: (D) 1, 2, 3 and 4
πŸ“Š CPP Programming
Q. Which of the following is incorrect in C++?
(1)When we write overloaded function we must code the function for each usage.
(2)When we write function template we code the function only once.
(3)It is difficult to debug macros
(4)Templates are more efficient than macros
  • (A) (1) and (2)
  • (B) (1), (2) and (3)
  • (C) (3) and (4)
  • (D) All are correct.
πŸ’¬ Discuss
βœ… Correct Answer: (D) All are correct.
πŸ“Š CPP Programming
Q. Pick the odd one out
  • (A) array type
  • (B) character type
  • (C) Boolean type
  • (D) integer type
πŸ’¬ Discuss
βœ… Correct Answer: (A) array type
πŸ“Š CPP Programming
Q. Which data type is used to represent the absence of parameters?
  • (A) int
  • (B) short
  • (C) void
  • (D) float
πŸ’¬ Discuss
βœ… Correct Answer: (C) void
πŸ“Š CPP Programming
Q. Which type is best suited to represent the logical values?
  • (A) integer
  • (B) Boolean
  • (C) character
  • (D) all of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) Boolean
πŸ“Š CPP Programming
Q. Identify the user-defined types from the following?
  • (A) enumeration
  • (B) classes
  • (C) both enumeration and classes
  • (D) int
πŸ’¬ Discuss
βœ… Correct Answer: (C) both enumeration and classes
πŸ“Š CPP Programming
Q. Which of the following statements are true? int f (float)
  • (A) f is a function taking an argument of type int and returning a floating point number
  • (B) f is a function taking an argument of type float and returning an integer
  • (C) f is a function of type float
  • (D) none of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (B) f is a function taking an argument of type float and returning an integer
πŸ“Š CPP Programming
Q. The value 132.54 can be represented using which data type?
  • (A) double
  • (B) void
  • (C) int
  • (D) bool
πŸ’¬ Discuss
βœ… Correct Answer: (A) double
πŸ“Š CPP Programming
Q. When a language has the capability to produce new data type mean, it can be called as …...
  • (A) overloaded
  • (B) extensible
  • (C) encapsulated
  • (D) reprehensible
πŸ’¬ Discuss
βœ… Correct Answer: (B) extensible

Jump to