Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

Java Final Exam Multiple Choice Questions With Solutions

Puntuación
-
Vendido
-
Páginas
38
Grado
A+
Subido en
14-07-2023
Escrito en
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) {

Mostrar más Leer menos
Institución
JAVA
Grado
JAVA

Vista previa del contenido

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

Escuela, estudio y materia

Institución
JAVA
Grado
JAVA

Información del documento

Subido en
14 de julio de 2023
Número de páginas
38
Escrito en
2022/2023
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$13.49
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Studyclock Ashford University
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
873
Miembro desde
3 año
Número de seguidores
492
Documentos
8822
Última venta
1 día hace

4.2

229 reseñas

5
130
4
42
3
34
2
10
1
13

Documentos populares

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes