Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Quiz 2 - Semana 7
Instrucciones
https://poli.instructure.com/courses/11281/quizzes/41093 1/10
14/10/2019 Quiz 2 - Semana 7: RA/PRIMER BLOQUE-PROGRAMACION DE COMPUTADORES-[GRUPO3]
Historial de intentos
Pregunta 1 9 / 9 ptos.
Para llenar un arreglo desde la primera posición del mismo, Cuál seria
la manera correcta de realizar nuestro ciclo for ?
¡Correcto!
for (int i=0;i<final;i++){
Pregunta 2 9 / 9 ptos.
¡Correcto!
Relación de recurrencia
Relación redundante
Relación directa
https://poli.instructure.com/courses/11281/quizzes/41093 2/10
14/10/2019 Quiz 2 - Semana 7: RA/PRIMER BLOQUE-PROGRAMACION DE COMPUTADORES-[GRUPO3]
Relación de concurrencia
Pregunta 3 9 / 9 ptos.
¡Correcto! System.out.println(Arrays.toString(arreglo));
System.out.println(Arreglo);
Pregunta 4 0 / 9 ptos.
int m = n * 2;
int i = 1;
while (i <= n) {
int j = 1;
while (j < m) {
if (j >= i && j <= m - i) {
if (j <= n)
System.out.print (" " + (j - i + 1) + " ");
else
System.out.print (" " + (m - j - i + 1) + " ");
} else {
System.out.print (" ");
}
j = j + 1;
}
System.out.println ();
i = i + 1;
}
https://poli.instructure.com/courses/11281/quizzes/41093 3/10
14/10/2019 Quiz 2 - Semana 7: RA/PRIMER BLOQUE-PROGRAMACION DE COMPUTADORES-[GRUPO3]
espuesta correcta
1 2 3 4 5 4 3 2 1
1 2 3 4 3 2 1
1 2 3 2 1
1 2 1
1
1 2 3 4 5 4 3 2 1
2 2
3 3
4 4
5 5
4 4
3 3
2 2
1 2 3 4 5 4 3 2 1
Respondido
1 1
2 2
3 3
4 4
5
4 4
3 3
2 2
1 1
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
Pregunta 5 9 / 9 ptos.
https://poli.instructure.com/courses/11281/quizzes/41093 4/10
14/10/2019 Quiz 2 - Semana 7: RA/PRIMER BLOQUE-PROGRAMACION DE COMPUTADORES-[GRUPO3]
Pregunta 6 9 / 9 ptos.
¡Correcto!
El programa genera una cadena compuesta de X y O donde X
representa los dígitos impares de un número de 3 cifras y O representa
los dígitos pares.
https://poli.instructure.com/courses/11281/quizzes/41093 5/10
14/10/2019 Quiz 2 - Semana 7: RA/PRIMER BLOQUE-PROGRAMACION DE COMPUTADORES-[GRUPO3]
Pregunta 7 0 / 9 ptos.
int m = n * 2;
int i = 1;
while (i < m) {
int j = 1;
while (j < m) {
if (i == 1 || i == m - 1) {
if (j <= n)
System.out.print (" " + j + " ");
else
System.out.print (" " + (m - j) + " ");
} else if (j == 1 || j == m - 1) {
if (i <= n)
System.out.print (" " + i + " ");
else
System.out.print (" " + (m - i) + " ");
} else {
System.out.print (" ");
} j = j + 1;
}
System.out.println ();
i = i + 1;
}
https://poli.instructure.com/courses/11281/quizzes/41093 6/10
14/10/2019 Quiz 2 - Semana 7: RA/PRIMER BLOQUE-PROGRAMACION DE COMPUTADORES-[GRUPO3]
espuesta correcta
1 2 3 4 5 4 3 2 1
2 2
3 3
4 4
5 5
4 4
3 3
2 2
1 2 3 4 5 4 3 2 1
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 3 2 1
1 2 3 2 1
1 2 1
1
Respondido
1 1
2 2
3 3
4 4
5
4 4
3 3
2 2
1 1
Pregunta 8 9 / 9 ptos.
int mes = 1;
while (mes <= 12) {
dinero = dinero * 1.02;
mes++;
}
System.out.println (dinero);
Pregunta 9 9 / 9 ptos.
Se dice que dos números naturales son primos relativos si no tienen ningún
factor primo en común o, dicho de otra manera, si y sólo si su máximo común
divisor es igual a 1. Dados dos números naturales a y b , cuál de los siguientes
fragmentos de código dice correctamente si son o no primos relativos?
https://poli.instructure.com/courses/11281/quizzes/41093 8/10
14/10/2019 Quiz 2 - Semana 7: RA/PRIMER BLOQUE-PROGRAMACION DE COMPUTADORES-[GRUPO3]
int c = a;
if (a > b)
c = b;
int i = 2;
boolean resultado = true;
while (resultado && i < c) {
if (a % i == 0 || b % i == 0)
resultado = false;
i = i + 1;
}
int c = a;
if (a > b)
c = b;
int i = 2;
boolean resultado;
while (i < c) {
if (a % i == 0 && b % i == 0)
resultado = false;
else
resultado = true;
i = i + 1;
}
¡Correcto!
int c = a;
if (a > b)
c = b;
int i = 2;
boolean resultado = true;
while (resultado && i < c) {
if (a % i == 0 && b % i == 0)
resultado = false;
i = i + 1;
}
int i = 2;
boolean resultado = true;
while (i < a) {
if (a % i != 0 && b % i != 0)
resultado = false;
i = i + 1;
}
https://poli.instructure.com/courses/11281/quizzes/41093 9/10
14/10/2019 Quiz 2 - Semana 7: RA/PRIMER BLOQUE-PROGRAMACION DE COMPUTADORES-[GRUPO3]
Pregunta 10 9 / 9 ptos.
boolean a = false;
boolean b = true;
while (true || a == b) {
System.out.println ("...");
a = !a;
b = !b;
}
¡Correcto!
El ciclo no terminará nunca. Los cambios que se hacen sobre a y b
son irrelevantes porque nunca afectarán al ciclo. Imprimirá ...
indefinidamente.
Calificación de la evaluación: 72 de 90
https://poli.instructure.com/courses/11281/quizzes/41093 10/10