What does the following code do?
Quiz 1 c++

Quiz
•
Computers
•
6th - 8th Grade
•
Medium
Salma Ghoneim
Used 2+ times
FREE Resource
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Reads two numbers from the console
Adds two numbers and prints the result
Multiplies two numbers and prints the result
None of the above
See Answer
View Solution
Answer explanation
Adds two numbers and prints the result The code outputs the result of the addition operation 21 + 40, which is 61.
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Identify Correct Syntax
What is the correct syntax for printing the number 5?
print(5);
display(5);
console.log(5);
cout << 5;
Answer explanation
The correct syntax for printing in C++ is "cout << value;".
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Print difference of 10 and 3
How do you print the result of difference between 10 and 3?
cout << 10 - 3;
cout << diff(10 - 3);
diff(10 - 3)
cout << 10 - 3
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Correct Syntax for Header
Identify the correct syntax from the options below.
#include <iostream>;
?include <iostream>;
#include <iostream>
#include <iosteam>;
Answer explanation
The correct syntax is #include <iostream>, we do not use ;
5.
MULTIPLE CHOICE QUESTION
1 min • 2 pts
Print String num
How would you print the string stored in variable named num?
cout << num;
cout << "num";
cout << value(num);
cout << get(num);
Answer explanation
To print the string variable named num, you directly use cout << "variable_name";
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Print 6 divided by 2
How can you print the result of 66 divided by 2?
cout << 6 / 2;
div(6, 2);
cout << div(6, 2) ;
None of the above
7.
MULTIPLE CHOICE QUESTION
1 min • 2 pts
Identify Incorrect Syntax
Identify the incorrect syntax from the given options.
cout << "Hello, World";
cout << 5 + 3 / 2;
cout << "Hello, World';
cout << "5 + 3";
Answer explanation
Text to be printed using "cout" should be enclosed in double quotes.
Similar Resources on Quizizz
11 questions
Строки в с++

Quiz
•
8th Grade
10 questions
Python

Quiz
•
7th Grade
11 questions
Python Ifs, Lists, and Loops

Quiz
•
7th - 8th Grade
12 questions
Python Print Statement

Quiz
•
6th - 10th Grade
10 questions
Python Variables

Quiz
•
6th Grade
10 questions
C++

Quiz
•
7th - 8th Grade
10 questions
test C++

Quiz
•
7th Grade
9 questions
C++ Kelas 89

Quiz
•
8th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
20 questions
Final Exam Vocabulary

Quiz
•
6th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
11 questions
Decimal/fraction conversions quick check

Quiz
•
5th - 7th Grade
10 questions
Identifying equations

Quiz
•
KG - University
44 questions
El fin del año- 7th

Quiz
•
7th - 12th Grade
40 questions
Word Study Assessment: Roots, Prefixes, Suffixes, and Vocabulary

Quiz
•
8th Grade
49 questions
How Well Do You Know Your 6th Grade Teachers?

Quiz
•
6th Grade