C++ Questions With Answers by Clinton
C++ Questions With Answers by Clinton
A. Low
B. High
C. Middle
D. Machine
Answer: B
50. Which of these keywords defines a block that handles multiple cases?
A. select
B. switch
C. branch
D. if-else
Answer: B
Thank you! Here's a complete set of 100 objective questions (MCQs and True/False) with answers based
strictly on the three PDFs you shared (Chapters 1–3 of CSC 104: Introduction to C++). I've included a mix
of simple and complex questions for a strong understanding.
A. Declares variables
B. Assigns values to integers
C. Creates a custom data type
D. Defines an array
Answer: C
56. Which of these allows conditional logic based on multiple exact values?
A. if-else
B. for loop
C. switch statement
D. enum
Answer: C
z = (x > y) ? x : y;
A. 4
B. 8
C. Error
D. None
Answer: B
62. Which keyword is used for defining a function that can be reused in multiple locations?
A. const
B. def
C. inline
D. static
Answer: C
72. How many values does the ternary operator work on?
Answer: 3
77. Which keyword is used to create a user-defined type with specific values?
Answer: enum
80. How do you declare a function that accepts two integers and returns a float?
Answer: float fun(int, int);
85. How do you define a function that does not return anything?
Answer: Use void
86. What is the return type of a function that calculates area as length * width?
Answer: int (or float depending on declaration)
93. Which function returns the larger of two values using if?
Answer: Conditional operator or if-else logic