
Java Basic
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
Nhi Nguyễn
Used 3+ times
FREE Resource
Enhance your content in a minute
42 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Enter the result
What does this code print?
int n = 0;
System.out.print(++n);
System.out.print(n++);
System.out.print(n++);
Keep in mind that all numbers are printed on the same line.
2.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Enter the result:
What does the following code print?
int n = 10;
n--;
System.out.println(n++);
3.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Enter the value of result:
int a = 4;
int b = a++;
int c = --a + b++;
int result = ++a - (c++ - b) + c;
Answer explanation
1. a = 4
2. b = a++ that means first we assign a's value to b then increment a, so b = 4 and a = 5
3. c= --a + b++ = 4 + 4 = 8, so final value of a = 4 and b = 5 (As we assign first then increment)
4. res = ++a - (c++ - b) + c = 5 - (8-5) + 9 = 11 (here also first you assign c's value in bracket then increment in the end)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result ?
Given the following code:
int a = -1;
System.out.println(1 - a++);
1
0
-1
2
3
Answer explanation
There are 3 actions here:
- The first one will be (1 - a). //This will result in 1 - (-1) = 2.
- The second will be (a++). //This will increase the value of a by 1, which is (-1)++ will equal to 0.
- The third will be the sum of the first and the second (2 + 0) = 2.
5.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Such different for loops
Choose all syntatically correct ways to write the for-loop. Remember the difference between syntax rules and coding conventions.
You are unlikely to use some of these methods, but it is important to understand exactly how the for-loop works.
for (int i = 0; i < 10; i++) { /* body */ }
int i = 0; for (; i < 10; ++i) { /* body */ }
for (int k = 10; k > 1; ) { k--; /* some statements */ }
for (;;) { /* body */ }
6.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
The control structure is also known as a
repetitive conditional statement
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The number of loop body executions:
How many times will the loop body be executed?
0
1
2
3
4
Answer explanation
when counter == 3, if conditional is true and there is no break in it just reassigning the boolean shouldBeStopped to true, then counter++ (it makes counter 4) and when while loop condition is evaluated again
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
40 questions
Nerds quiz
Quiz
•
University
37 questions
Conceptos Básicos TIC I
Quiz
•
University
45 questions
Computer memory
Quiz
•
University
39 questions
HTML quiz
Quiz
•
University - Professi...
42 questions
TIN HỌC KHỐI 5 HK1
Quiz
•
1st Grade - University
44 questions
ACO.C1.HTTT
Quiz
•
University
46 questions
CompTIA ITFundamentals CRAM
Quiz
•
6th Grade - University
45 questions
Luyện tập trắc nghiệm MS Word 2016 (Bài 02)
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
