What is the final value of x in the following code segment?
int x = 7;
x += 2*x;
Variables in C++
Quiz
•
Computers
•
9th - 12th Grade
•
Hard
ELIZABETH DIERKER
Used 90+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 5 pts
What is the final value of x in the following code segment?
int x = 7;
x += 2*x;
63
21
81
This code segment will not compile.
2.
MULTIPLE CHOICE QUESTION
45 sec • 5 pts
What is the final value of y in the following code segment?
int y = 3 * 7 % 8 + 1 * 4;
9
24
25
6
This code segment will not compile.
3.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
What is the final value of x in the following code segment?
double x = 7/2;
3 1/2
3.5
3.0
This code segment will not compile.
4.
MULTIPLE CHOICE QUESTION
45 sec • 5 pts
What are the final values of y and z in the following code segment?
int z =4;
int y = 3 + z--;y = 7, z = 3
y = 7, z = 4
y = 6, z = 3
y = 6, z = 4
This code segment will not compile.
5.
MULTIPLE CHOICE QUESTION
45 sec • 5 pts
What is the final value of y in the following code segment?
double y = 2;
int z = 3;
y /= z + 1;y = 1.0
y = 2.0
y = 0.5
y = 0.0
This code segment will not compile.
6.
MULTIPLE CHOICE QUESTION
45 sec • 5 pts
What is the final value of w in the following code segment?
int w = int(3 / 2) + 5 % 10 - 3.5;
-2
3
-3
2
This code segment will not compile.
7.
MULTIPLE CHOICE QUESTION
45 sec • 5 pts
What is the final value of x in the following code segment?
(Assume the header file <cmath> has been included.)
double x = pow(2, 3) + 1 / 2;
9.5
8.5
8.0
9.0
This code segment will not compile.
12 questions
Compound Operators in Java
Quiz
•
9th - 12th Grade
10 questions
Unit 6
Quiz
•
12th Grade
14 questions
AP CSA Review
Quiz
•
11th Grade
11 questions
Python Quiz
Quiz
•
12th Grade
12 questions
Java Quiz 1
Quiz
•
9th Grade
10 questions
Operators in Java
Quiz
•
9th Grade
15 questions
Array
Quiz
•
10th - 12th Grade
10 questions
Python Basics Quiz
Quiz
•
9th - 12th Grade
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
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
17 questions
Parts of Speech
Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University