Академический Документы
Профессиональный Документы
Культура Документы
Pregunta 1 9 / 9 ptos.
int m = n * 2;
int i = n;
while (i >= 1) {
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;
}
1 1
2 2
3 3
4 4
5
4 4
3 3
2 2
1 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
¡Correcto!
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
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 1/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
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
Pregunta 2 9 / 9 ptos.
¡Correcto! System.out.println(Arrays.toString(arreglo));
System.out.println(Arreglo);
Pregunta 3 9 / 9 ptos.
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 2/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
¡Correcto!
El programa busca una letra c en una palabra s , cambia el valor de la
variable respuesta a true al encontrar la letra, de lo contrario la deja
en false .
Pregunta 4 9 / 9 ptos.
int m = n * 2;
int i = 1;
while (i < m) {
int j = 1;
while (j < m) {
if (i == j || m - i == j) {
if (i <= n)
System.out.print (" " + i + " ");
else
System.out.print (" " + (m - i) + " ");
} else {
System.out.print (" ");
}
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 3/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
j = j + 1;
}
System.out.println ();
i = i + 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
¡Correcto!
1 1
2 2
3 3
4 4
5
4 4
3 3
2 2
1 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
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
Pregunta 5 9 / 9 ptos.
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 4/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
int a=2,i,n;
System.out.println("Ingrese numero");
n=sc.nextInt();
for(i=1;i<(n+1);i++){
if(n%i==0){
a++;
}
}
if(a!=3){
System.out.println("No es Primo");
}else{
System.out.println("Si es Primo");
}
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 5/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
Pregunta 6 9 / 9 ptos.
boolean a = false;
boolean b = true;
while (true || a == b) {
System.out.println ("...");
a = !a;
b = !b;
}
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 6/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
¡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.
Pregunta 7 9 / 9 ptos.
False
¡Correcto! True
Pregunta 8 0 / 9 ptos.
int m = n * 2;
int i = 1;
while (i < m) {
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 7/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
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;
}
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 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
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 8/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
Respondido
1 1
2 2
3 3
4 4
5
4 4
3 3
2 2
1 1
Pregunta 9 9 / 9 ptos.
import java.util.String;
import java.util.Scanner;
import java.util.Math;
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 9/10
12/10/2019 Historial de evaluaciones para Palencia Perdomo Carlos Julian: Quiz 2 - Semana 7
https://poli.instructure.com/courses/11283/quizzes/41110/history?version=1 10/10