C++ Fundamentals Quiz
1. What is the correct syntax to output "Hello World" in C++?
print("Hello World");
cout << "Hello World";
System.out.println("Hello World");
printf("Hello World");
2. Which of the following is NOT a valid C++ data type?
int
float
bool
real
3. What is the correct way to create a for loop in C++?
for (int i = 0; i < 5; i++) { }
for i in range(5):
for (i = 0; i < 5; i++) { }
for i from 0 to 5 { }
4. How do you declare a function in C++ that doesn't return any value?
function myFunction()
int myFunction()
void myFunction()
none myFunction()
5. Which keyword is used to create a class in C++?
classdef
class
struct
className
Submit Quiz
Quiz Results
0%
Home
Review