Quizzes
Take Quizzes
Animal
Nutrition
Love
Relationship
Computer
Sports
Society
Business
Geography
Language
Personality
Harry Potter
Movie
Television
Music
Online Exam
Health
Country
Art
Entertainment
Celebrity
Math
Game
Book
Fun
Science
Food
History
Education
All Topics
Create a Quiz
Quiz Maker
Training Maker
Survey Maker
Flashcards
Brain Games
See All
ProProfs.com
Search
Create A Quiz
Take Quizzes
Animal
Nutrition
Love
Relationship
Computer
Sports
Society
Business
Geography
Language
Personality
Harry Potter
Movie
Television
Music
Online Exam
Health
Country
Art
Entertainment
Celebrity
Math
Game
Book
Fun
Science
Food
History
Education
All Topics
Products
Quiz Maker
Training Maker
Survey Maker
Flashcards
Brain Games
See All
ProProfs.com
Quizzes
Quizzes
Java Test 3 Part A
32 Questions
|
By Yupeilin | Updated: Mar 18, 2022
| Attempts: 55
Share
Start
Share on Facebook
Share on Twitter
Share on Whatsapp
Share on Pinterest
Share on Email
Copy to Clipboard
Embed on your website
Question
1
/ 33
🏆
Rank #--
▾
0 %
0/100
Score
0/100
1.
Int x = -7;
int y = 3;
!(3*x < 4*y) && (5*x >=y)
The result of this expression will be
True
False
Submit
Start Quiz
About This Quiz
This section consists of 20 questions.
2.
What first name or nickname would you like us to use?
You may optionally provide this to label your report, leaderboard, or certificate.
2.
An expression containing the
||
operator is true if either or both of its operands are true.
True
False
Submit
3.
An
else
must always have a corresponding
if
.
True
False
Submit
4.
0.025 >= 0.333
The result of relational operations will be
True
False
Submit
5.
The loop counter in a
for
loop is altered after the loop body is executed in a given iteration.
True
False
Submit
6.
The expression ((x > y) && (a < b)) is true if either x > y is true or a < b is true.
True
False
Submit
7.
Consider the following
switch
statement:
int x = 3;
switch (power)
{
case 0 : io.writeInfo("1");
break;
case 1 : io.writeInfo(x);
break;
case 2 : io.writeInfo(x * x);
break;
case 3 : io.writeInfo(x * x * x);
break;
case 4 : io.writeInfo(x * x * x * x);
break;
default : io.writeInfo("No match exists for this power");
}//END switch
What will be displayed by the code if power = 1?
1
3
9
27
81
Submit
8.
The loop body of the
do/while
loop will be executed at least ___ time(s).
0
1
2
None of above
Submit
9.
The
continue
statement is used to immediately terminate a loop.
True
False
Submit
10.
Consider the following
switch
statement:
int x = 3;
switch (power)
{
case 0 : io.writeInfo("1");
break;
case 1 : io.writeInfo(x);
break;
case 2 : io.writeInfo(x * x);
break;
case 3 : io.writeInfo(x * x * x);
break;
case 4 : io.writeInfo(x * x * x * x);
break;
default : io.writeInfo("No match exists for this power");
}//END switch
What will be displayed by the code if power = 2?
1
3
9
27
81
Submit
11.
The
continue
statement is used to skip over a single loop iteration.
True
False
Submit
12.
(-6<0) && (12 >= 10)
The result of this operation will be
True
False
Submit
13.
A
do/while
loop is a post-test loop.
True
False
Submit
14.
Consider the following segment of code:
if (x>=0)
if (x<10)
{
y = x * x;
if (x<=5)
x = x - 2;
} //END if x < 10
else
y = 10 + x;
else
y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);
What will be displayed by the program if x = 4?
X = 4y = 64
X = 2y = 16
X = 4y = 16
X = 4 y = 14
Submit
15.
When using a
switch
statement in Java, a no-match condition results in an error.
True
False
Submit
16.
(5!=5)&&(3<6)
The result of this operation will be
True
False
Submit
17.
Consider following program segment.
int a = 1;
while (17 % a != 5)
{
System.out.println(a + " " + 17 % a);
++a;
}// END while
How many times will the loop be executed?
0 time
1 time
3 times
5 times
Submit
18.
Consider the following
switch
statement:
int x = 3;
switch (power)
{
case 0 : io.writeInfo("1");
break;
case 1 : io.writeInfo(x);
break;
case 2 : io.writeInfo(x * x);
break;
case 3 : io.writeInfo(x * x * x);
break;
case 4 : io.writeInfo(x * x * x * x);
break;
default : io.writeInfo("No match exists for this power");
}//END switch
What will be displayed by the code if power = 0?
1
3
9
27
81
Submit
19.
How many times is the following loop executed?
for (int x=0; x <= 10; ++x)
System.out.println("This is a for loop.");
0
1
11
Infinite
Submit
20.
Consider the following segment of code:
if (x>=0)
if (x<10)
{
y = x * x;
if (x<=5)
x = x - 2;
} //END if x < 10
else
y = 10 + x;
else
y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);
What will be displayed by the program if x = -5?
X = -5y = 25
X = -7y = 25
X = -5y = 5
X = -5y = -125
Submit
21.
The
default
case is required in the
switch
selection statement.
True
False
Submit
22.
Which of the following is NOT an iteration control structure in Java?
For
Switch
While
Do/while
Submit
23.
How many times will the following loop execute?
int x = 1;
do
{
System.out.println("This is a do/while loop");
++x;
}while(x >= 0);
0
1
2
Infinite
Submit
24.
Consider the following segment of code:
if (x>=0)
if (x<10)
{
y = x * x;
if (x<=5)
x = x - 2;
} //END if x < 10
else
y = 10 + x;
else
y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);
What will be displayed by the program if x = 6?
X = 6 y =36
X = 4y = 36
X = 6y = 16
X =4y = 64
Submit
25.
Consider the following program segment
int b = 2;
do {
System.out.println(b + " " + b/5);
b = b + 2;
}while ( b != 20);
How many times will the loop be executed?
1
5
9
10
Submit
26.
A statement that can be inserted at the end of a
switch
statement to protect against invalid entries is the ___________ statement
Break
Default
Case
Initial
Submit
27.
The loop body of the
while
loop will be executed at least ____ time(s)
0
1
2
None of above
Submit
28.
Suppose that you have two nested loops. The inner loop executes five times and the outer loop executes ten times. How many total iterations are there within the nested loop structure?
15 total iterations
20 total iterations
50 total iterations
100 total iterations
Submit
29.
Consider the following segment of code:
if (x>=0)
if (x<10)
{
y = x * x;
if (x<=5)
x = x - 2;
} //END if x < 10
else
y = 10 + x;
else
y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);
What will be displayed by the program if x = 0?
X = 0y = 0
X = 0 y = 10
X = -2y = 0
X = -2y = 10
Submit
30.
How many times is the following loop executed?
for ( int x = 0; x > 0; ++x)
System.out.println("This is a for loop.");
0
1
2
Infinite
Submit
31.
Determine the output generated by the following program segment.
int number = 1;
int product = 1;
do {
++ number;
product = product * number;
} while ( number < 5);
io.writeInfo("The product is: " + product);
The product is 1
The product is 24
The product is 120
The product is 2
Submit
32.
Consider the following segment of code:
if (x>=0)
if (x<10)
{
y = x * x;
if (x<=5)
x = x - 2;
} //END if x < 10
else
y = 10 + x;
else
y = x * x * x;
io.writeInfo("x = " + x + "\ny = " +y);
What will be displayed by the program if x = 10?
X = 10y = 100
X = 8y = 100
X = 10 y = 20
X = 10y = 1000
Submit
×
Thank you for your feedback!
View My Results
Related Quizzes
Aptitude Test (C & Java)
Aptitude Test (C & Java)
Java Assessment Test For Senior Java Developers
Java Assessment Test For Senior Java Developers
Hardest Java Test: Trivia Quiz!
Hardest Java Test: Trivia Quiz!
Thank you for your feedback!
Would you like to edit this question to improve it?
No thanks
Name:
Email:
Oops! Give us more information:
Incorrect Question
Incorrect Answer
Typos
I have a feedback
Submit
Please provide name and email to proceed.
Please provide correct email to proceed.
Please provide feedback.
Please select the option.
All (32)
Unanswered (
)
Answered (
)
Int x = -7;int y = 3;!(3*x < 4*y) && (5*x >=y)The result...
An expression containing the || operator is true if either or both of...
An else must always have a corresponding if.
0.025 >= 0.333The result of relational operations will be
The loop counter in a for loop is altered after the loop body is...
The expression ((x > y) && (a < b)) is true if either x...
Consider the following switch statement:int x = 3;switch (power)...
The loop body of the do/while loop will be executed at least ___...
The continue statement is used to immediately terminate a loop.
Consider the following switch statement:int x = 3;switch (power)...
The continue statement is used to skip over a single loop iteration.
(-6<0) && (12 >= 10)The result of this operation...
A do/while loop is a post-test loop.
Consider the following segment of code:if (x>=0) if...
When using a switch statement in Java, a no-match condition results in...
(5!=5)&&(3<6)The result of this operation will be
Consider following program segment.int a = 1;while (17 % a !=...
Consider the following switch statement:int x = 3;switch (power)...
How many times is the following loop executed?for (int x=0; x <=...
Consider the following segment of code:if (x>=0) if...
The default case is required in the switch selection statement.
Which of the following is NOT an iteration control structure in Java?
How many times will the following loop execute?int x = 1;do...
Consider the following segment of code:if (x>=0) if...
Consider the following program segmentint b = 2;do { ...
A statement that can be inserted at the end of a switch statement to...
The loop body of the while loop will be executed at least ____ time(s)
Suppose that you have two nested loops. The inner loop executes five...
Consider the following segment of code:if (x>=0) if...
How many times is the following loop executed?for ( int x = 0; x >...
Determine the output generated by the following program segment.int...
Consider the following segment of code:if (x>=0) if...
X
OK
X
OK
Cancel
X
OK
Cancel
Your Rank: #-- / --
Leaderboard
✕