NEW
Font size
WorksheetsLong Quiz
Total questions: 60
Worksheet time: 36mins
Who developed C++?
Dennis Ritchie
James Gosling
Guido van Rossum
Bjarne Stroustrup
What was the original name of C++?
C with Classes
Advanced C
Object-C
Super C
Which of the following is a performance-oriented programming language?
Python
JavaScript
C++
C
Which of the following is a commonly used IDE for C++?
Eclipse
NetBeans
Code::Blocks
Android Studio
In a C++ program, which line includes the standard input/output library?
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <inputoutput>
What is the entry point of every C++ program?
start()
program()
main()
begin()
Which keyword is used to declare a variable that stores whole numbers?
string
float
int
bool
Which of the following stores decimal values with higher precision?
char
int
float
double
Which symbol is used with cout to display output?
>>
::
<<
;
Which symbol is used with cin to accept input?
>>
<<
==
;
What will be the output of the following code?
2
2.5
5/2
Error
Which operator is used to get the remainder of a division?
/
*
%
#
Which of the following correctly declares a string variable?
string name = "John";
string name = 'John';
String name = ‘John’;
String name = "John";
Which data type can only hold true/false values?
string
bool
int
double
Which of the following statements will correctly display "Hello World"?
cout << "Hello World";
cin << "Hello World";
cout >> "Hello World";
cin >> "Hello World";
Which IDE is lightweight and often recommended for beginners in C++?
Visual Studio
Xcode
Dev-C++
NetBeans
What does return 0; represent in the main function?
The program repeats
The program ended successfully
An error occurred
The program is paused
Which of the following is NOT a basic data type in C++?
int
string
bool
array
Which arithmetic operator is used for multiplication?
+
-
/
*
What is the output of this code?
2
2.5
1
3
Which statement is used to make decisions in C++?
loop
if
switch
break
In an if statement, what happens if the condition is false?
The program crashes
The condition becomes true automatically
The block inside runs anyway
The block is skipped
Which symbol is used for equality comparison in C++?
=
&&
==
===
Which control structure is best for checking multiple constant values of one variable?
if-else
for loop
while loop
switch-case
What keyword is used to exit a loop immediately?
exit
skip
break
continue
What does the continue statement do?
Stops the program
Skips the current iteration and moves to the next
Exits the loop completely
Repeats the last iteration
Which loop guarantees execution of the block at least once?
while
for
do-while
repeat
Which part of a for loop runs first?
condition
update
initialization
statement block
Which loop is best when the number of iterations is known?
while
do-while
for
if-else
What will this code output?
A
B
Nothing
Error
In nested loops, the inner loop runs…
Only once
Completely for every outer loop iteration
Only if the outer loop is finished
Randomly
What is the default case in a switch used for?
When no other cases match
To reset the loop
To skip input
To initialize variables
What will happen in a while loop if the condition never becomes false?
The loop stops
It becomes infinite
Error occurs
Runs once only
Which logical operator means “AND”?
||
&&
!
%
What is printed?
1 2 3
0 1 2
2 3 4
1 2 3 4
Which is NOT a loop in C++?
while
do-while
repeat-until
if-else
Which is true about if-else if ladder?
Executes all blocks
Executes the first true block and skips the rest
Always executes the last block
Skips all blocks
Which keyword is used inside switch cases?
stop
end
break
return
Which type of values can switch-case handle in C++ (by default)?
int, char, enum
float, double
string
boolean only
What is the output?
Nothing
Infinite loop
Error
1
Which of the following best defines a function in C++?
A variable storing data
A block of code performing a task
A reusable unit of code with a name
A type of loop
What is the correct syntax to declare a function prototype that returns an integer?
int function();
int function;
int function(int a, int b);
int(function);
Which keyword is used to send a value back from a function?
send
return
break
exit
Passing a parameter by value means:
The function gets direct access to the original variable
The function stores the memory address
The function cannot use the variable
A copy of the value is passed
What happens if a function is declared but never defined?
It still works fine
It causes a linker error
It returns 0 by default
It is ignored by the compiler
Which function call is correct if the prototype is double avg(int x, int y);?
avg();
avg(4, 5);
avg(4.5, 5.2);
avg(4)
In C++, the main() function must always return which type?
void
int
float
char
Which of these is an example of a library function?
myFunction()
add()
average()
sqrt()
Which of the following errors is detected at compile time?
Syntax error
Logical error
Runtime error
Infinite loop
Which error type occurs when dividing by zero?
Syntax error
Logical error
Runtime error
Semantic error
Debugging is mainly the process of:
Writing new code
Finding and fixing bugs
Removing comments
Adding libraries
A missing semicolon will cause:
Syntax error
Logical error
Runtime error
Compiler warning only
A wrong formula implementation is an example of:
Syntax error
Logical error
Runtime error
Semantic error
Which tool in IDE is used to pause code at a specific line?
Breakpoint
Step over
Step into
Watch variable
Which debugging tool allows tracking how a variable changes during execution?
Breakpoint
Watch variable
Step into
Output console
Which debugging option executes function calls without entering inside them?
Breakpoint
Step over
Step into
Watch variable
Which debugging option follows the code line by line into functions?
Breakpoint
Step over
Step into
Watch variable
Where are error messages usually displayed in an IDE?
Code editor
Title bar
Output window / Console
Header files
Which is a best practice in debugging?
Ignore compiler errors
Use single-letter variable names
Test small parts of code first
Write entire program before testing
Why are print statements sometimes used during debugging?
To make output colorful
To trace execution flow and variable values
To speed up the program
To replace breakpoints
