Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Java Final Exam Multiple Choice Questions With Solutions

Beoordeling
-
Verkocht
-
Pagina's
38
Cijfer
A+
Geüpload op
14-07-2023
Geschreven in
2022/2023

Java Final Exam Multiple Choice Questions With Solutions 1) The increment operator is: A) ++ B) -- C) *= D) -= - ANS Answer: A 2) What will be the values of x and y as a result of the following code? int x = 25, y = 8; x += y++; A) x = 25, y = 8 B) x = 33, y = 8 C) x = 33, y = 9 D) x = 34, y = 9 - ANS Answer: C 3) What will be the value of x after the following code is executed? int x, y = 4, z = 6; x = (y++) * (++z); A) 24 B) 28 C) 30 D) 35 - ANS Answer: B 4) This is a control structure that causes a statement or group of statements to repeat. A) Block B) Loop C) Prefix mode D) Body - ANS Answer: B 5) If a loop does not contain within itself a way to terminate, it is called a(n): A) while loop B) do-while loop C) for loop D) infinite loop - ANS Answer: D 6) Each repetition of a loop is known as what? A) An iteration B) A cycle C) An execution D) A Lap - ANS Answer: A 7) This variable controls the number of times that the loop iterates. A) Counter variable B) Loop control variable C) Running total D) Decrement variable - ANS Answer: B 8) This type of loop will always be executed at least once. A) pre-test loop B) post-test loop C) sentinel loop D) for loop - ANS Answer: B 9) If you are using a block of statements, don't forget to enclose all of the statements in a set of: A) Braces B) Double quotes C) Semicolons D) Parentheses - ANS Answer: A 10) What will be the value of x after the following code is executed? int x = 10; while (x 100) { x += 10; } A) 90 B) 100 C) 110 D) This is an infinite loop. - ANS Answer: B 11) What will be the value of x after the following code is executed? int x = 10, y = 20; while (y 100) {

Meer zien Lees minder
Instelling
JAVA
Vak
JAVA

Voorbeeld van de inhoud

Java
Final
Exam
Multiple
Choice
1)
The
increment
operator
is:
A)
++
B)
--
C)
*=
D)
-=
-
ANS
Answer:
A
2)
What
will
be
the
values
of
x
and
y
as
a
result
of
the
following
code?
int
x
=
25,
y
=
8;
x
+=
y++;
A)
x
=
25,
y
=
8
B)
x
=
33,
y
=
8
C)
x
=
33,
y
=
9
D)
x
=
34,
y
=
9
-
ANS
Answer:
C
3)
What
will
be
the
value
of
x
after
the
following
code
is
executed?
int
x,
y
=
4,
z
=
6;
x
=
(y++)
*
(++z);
A)
24
B)
28
C)
30
D)
35
-
ANS
Answer:
B
4)
This
is
a
control
structure
that
causes
a
statement
or
group
of
statements
to
repeat.
A)
Block
B)
Loop
C)
Prefix
mode
D)
Body
-
ANS
Answer:
B
5)
If
a
loop
does
not
contain
within
itself
a
way
to
terminate,
it
is
called
a(n):
A)
while
loop
B)
do-while
loop
C)
for
loop
D)
infinite
loop
-
ANS
Answer:
D
6)
Each
repetition
of
a
loop
is
known
as
what?
A)
An
iteration B)
A
cycle
C)
An
execution
D)
A
Lap
-
ANS
Answer:
A
7)
This
variable
controls
the
number
of
times
that
the
loop
iterates.
A)
Counter
variable
B)
Loop
control
variable
C)
Running
total
D)
Decrement
variable
-
ANS
Answer:
B
8)
This
type
of
loop
will
always
be
executed
at
least
once.
A)
pre-test
loop
B)
post-test
loop
C)
sentinel
loop
D)
for
loop
-
ANS
Answer:
B
9)
If
you
are
using
a
block
of
statements,
don't
forget
to
enclose
all
of
the
statements
in
a
set
of:
A)
Braces
B)
Double
quotes
C)
Semicolons
D)
Parentheses
-
ANS
Answer:
A
10)
What
will
be
the
value
of
x
after
the
following
code
is
executed?
int
x
=
10;
while
(x
<
100)
{
x
+=
10;
}
A)
90
B)
100
C)
110
D)
This
is
an
infinite
loop.
-
ANS
Answer:
B
11)
What
will
be
the
value
of
x
after
the
following
code
is
executed?
int
x
=
10,
y
=
20;
while
(y
<
100)
{
x
+=
y;
} A)
90
B)
110
C)
210
D)
This
is
an
infinite
loop.
-
ANS
Answer:
D
12)
________
is
the
process
of
inspecting
data
given
to
the
program
by
the
user
and
determining
if
it
is
valid.
A)
Data
parsing
B)
Input
validation
C)
User
authentication
D)
Defensive
coding
-
ANS
Answer:
B
13)
This
type
of
loop
allows
the
user
to
decide
the
number
of
iterations.
A)
Counter-controlled
loop
B)
Dynamically
executed
loop
C)
User
controlled
loop
D)
Infinite
loop
-
ANS
Answer:
C
14)
In
the
following
code,
what
values
could
be
read
into
number
to
terminate
the
while
loop?
Scanner
keyboard
=
new
Scanner(System.in);
System.out.print("Enter
a
number
");
int
number
=
keyboard.nextInt();
while
(number
<
100
&&
number
>
500)
{
System.out.print("Enter
another
number
");
number
=
keyboard.nextInt();
}
A)
Numbers
less
than
100
or
greater
than
500
B)
Numbers
in
the
range
100
-
499
C)
Numbers
in
the
range
100
-
500
D)
The
boolean
condition
can
never
be
true.
-
ANS
Answer:
D
15)
What
will
be
the
value
of
x
after
the
following
code
is
executed?
int
x
=
10;
do
{
x
*=
20;
} while
(x
>
5);
A)
10
B)
200
C)
This
is
an
infinite
loop.
D)
The
loop
will
not
be
executed,
the
initial
value
of
x
>
5.
-
ANS
Answer:
C
16)
How
many
times
will
the
following
do-while
loop
be
executed?
int
x
=
11;
do
{
x
+=
20;
}
while
(x
>
100);
A)
0
B)
1
C)
4
D)
5
-
ANS
Answer:
B
17)
A
loop
that
repeats
a
specific
number
of
times
is
known
as
a(n):
A)
sentinel
loop
B)
conditional
loop
C)
counter-controlled
loop
D)
infinite
loop
-
ANS
Answer:
C
18)
How
many
times
will
the
following
for
loop
be
executed?
for
(int
count
=
10;
count
<=
21;
count++)
System.out.println("Java
is
great!!!");
A)
1
B)
10
C)
12
D)
0
-
ANS
Answer:
C
19)
What
will
be
the
value
of
x
after
the
following
code
is
executed?
int
x
=
10;
for
(int
y
=
5;
y
<
20;
y
+=5)
x
+=
y;
A)
40
B)
25
C)
30
D)
Invalid
for
statement
-
ANS
Answer:
A

Geschreven voor

Instelling
JAVA
Vak
JAVA

Documentinformatie

Geüpload op
14 juli 2023
Aantal pagina's
38
Geschreven in
2022/2023
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

€12,03
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Studyclock Ashford University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
873
Lid sinds
3 jaar
Aantal volgers
492
Documenten
8822
Laatst verkocht
1 dag geleden

4,2

229 beoordelingen

5
130
4
42
3
34
2
10
1
13

Populaire documenten

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen