What will be the output of the following code?
```
int x = 5;
int y = 8;
if (x > y) {
x++;
} else if (x < y) {
y++;
}
System.out.println(x + "" + y);
```
Java quiz 3 summer internship
Quiz
•
Other
•
University
•
Hard
Gnaneshwar Reddy
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
```
int x = 5;
int y = 8;
if (x > y) {
x++;
} else if (x < y) {
y++;
}
System.out.println(x + "" + y);
```
A. 58
B. 59
C. 68
D. 69
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many times will the following loop execute?
```
int i = 0;
while (i < 3) {
i++;
}
```
A. 2
B. 3
C. 4
D. Infinite
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
```
for (int i = 0; i < 5; i++) {
System.out.print(i + " ");
}
```
A. 0 1 2 3 4
B. 0 1 2 3 4 5
C. 1 2 3 4 5
D. None of the above
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the value of 'a' after the following code is executed?
```int a = 10;
for (int i = 0; i < 3; i++) {
a -= i;
}
```
A. 10
B. 7
C. 4
D. 6
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
```
int i = 1;
while (i <= 5) {
System.out.print(i + " ");
i += 2;
}
```
A. 1 3 5
B. 1 2 3 4 5
C. 1 3 5 7
D. 1 3 5 7 9
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
```
int x = 10;
if (x % 2 == 0) {
System.out.println("Even");
} else {
System.out.println("Odd");
}
```
A. Even
B. Odd
C. Compilation Error
D. None of the above
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many times will "Hello" be printed by the following code?
```
for (int i = 0; i < 4; i++) {
System.out.println("Hello");
}
```
A. 3
B. 4
C. 5
D. Infinite
10 questions
Test Project 1B Mekatronika Genap 21/22
Quiz
•
University
15 questions
Multiple-Choice Quiz on Java Arrays
Quiz
•
University
15 questions
Engineers Day Celebration Quiz - Code IT, STME HYD
Quiz
•
University
10 questions
UNIT1_PYTHON
Quiz
•
University
13 questions
Java Programming Quiz
Quiz
•
University
10 questions
Praktisi Mengajar - Java Test
Quiz
•
University
15 questions
Web Dev
Quiz
•
University
15 questions
Technoquiz..3
Quiz
•
University
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