Quiz
Quiz
4. What happens if you don’t use a break statement in a switch case in C++?
A) The program will exit the switch block
B) The program will continue executing subsequent cases
C) An error will occur
D) None of the cases will execute
7. Which function from the <cmath> library returns the square root of a number in C++?
A) sqrt(x)
B) log(x)
C) ceil(x)
D) floor(x)
8. In a C++ program, how can you handle division by zero in a calculator using a switch
statement?
A) Use an if condition to check if the denominator is zero
B) Add a case to handle division by zero
C) Exit the program
D) Use an arithmetic operator to ignore division by zero
A) 450
B) 250
C) 300
D) 200