Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Evaluación - Quiz 2 - Cutura Ambiental-2 Semana 7
Evaluación - Quiz 2 - Cutura Ambiental-2 Semana 7
Instrucciones de la evaluación
Llamamos expresión booleana a una expresión que solo tiene dos valores
posibles: verdadero (true) o falso (false).
https://poli.instructure.com/courses/4504/quizzes/19008/take 1/23
15/4/2018 Evaluación: Examen parcial - Semana 4
True
False
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
int x=26750,r=0;
r+=x/10000;
x=x%10000;
r+=x/1000;
x=x%1000;
/*
r+=x/100;
x=x%100;
*/
r+=x/10;
r+=x%10;
System.out.println(r);
33
23
83 (83..83)
https://poli.instructure.com/courses/4504/quizzes/19008/take 2/23
15/4/2018 Evaluación: Examen parcial - Semana 4
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
boolean a = false;
boolean b = true;
boolean c = !a;
boolean d = a || b;
System.out.println (a);
System.out.println (b);
System.out.println (c);
System.out.println (d);
System.out.println (e);
System.out.println (f);
false
true
true
true
true
true
https://poli.instructure.com/courses/4504/quizzes/19008/take 3/23
15/4/2018 Evaluación: Examen parcial - Semana 4
false
true
true
true
true
false
true
true
true
true
true
false
true
true
true
true
true
true
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
int i = 1, j = 2, k = 0;
https://poli.instructure.com/courses/4504/quizzes/19008/take 4/23
15/4/2018 Evaluación: Examen parcial - Semana 4
y *= 2;
z = y / 3.0;
i++;
j += k + 5;
j += k + 2;
k--;
System.out.println (x);
System.out.println (y );
System.out.println (z);
System.out.println (i);
System.out.println (j);
System.out.println (k);
1.0
9.0
1.0
2
3
-1
0.0
9.0
3.0
2
9
-1
3.0
11.0
1.0
2
3
-2
1.0
29.8
9.933333333333334
4
11
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
a = a + b;
b = a - b;
a = a - b;
a = 15 , b = 15
a = 32 , b = 17
a = 32 , b = 15
a = 49 , b = 32
a = 17 , b = 32
String a = "hola";
String b = 'h' + "o" + 'l' + "a" + "";
boolean c = a.equals (b);
boolean e = !c;
char f = 'f';
char g = 'f';
boolean h = g != f;
System.out.println (a);
System.out.println (b);
System.out.println (c);
System.out.println (e);
System.out.println (f);
https://poli.instructure.com/courses/4504/quizzes/19008/take 6/23
15/4/2018 Evaluación: Examen parcial - Semana 4
System.out.println (g);
System.out.println (h );
hola
hola
false
false
f
g
false
hola_
hola
false
false
g
g
false
hola
hola_
false
true
g
f
false
hola
hola
true
false
f
f
false
Ejercicio de Compilación:
https://poli.instructure.com/courses/4504/quizzes/19008/take 7/23
15/4/2018 Evaluación: Examen parcial - Semana 4
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
int a = 1;
int b = 2;
int c = 5;
int d = (a + b) * c;
int e = a + b * c;
int f = 2 * a * a * + b * 3 + c;
System.out.println (a);
System.out.println (b);
System.out.println (c);
System.out.println (d);
System.out.println (e);
System.out.println (f);
1
2
5
15
11
17
2
3
6
15
11
17
1
3
5
15
10
17
https://poli.instructure.com/courses/4504/quizzes/19008/take 8/23
15/4/2018 Evaluación: Examen parcial - Semana 4
1
2
5
15
12
17
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
https://poli.instructure.com/courses/4504/quizzes/19008/take 9/23
15/4/2018 Evaluación: Examen parcial - Semana 4
https://poli.instructure.com/courses/4504/quizzes/19008/take 10/23
15/4/2018 Evaluación: Examen parcial - Semana 4
¿Que librería debo llamar de primeras para tomar un dato por teclado?
import java.util.Math;
import java.util.Screen;
import java.util.Scanner;
import java.Scanner;
char i = 'd';
char j = 'e';
int n = 2;
String s = "d+e";
String t = "de";
String u = i + "" + n + j + "!";
System.out.println (i);
System.out.println (j);
System.out.println (s);
System.out.println (t);
System.out.println (u);
d
e
d+e
de
d2e!
d
e
de
de
de!
https://poli.instructure.com/courses/4504/quizzes/19008/take 11/23
15/4/2018 Evaluación: Examen parcial - Semana 4
e
e
d+e
de!
de
d
e
de
de
d2!
boolean a = false;
boolean b = true;
boolean c = !a;
boolean d = a || b;
boolean e = d || c && !a;
boolean f = true && !e;
System.out.println (a);
System.out.println (b);
System.out.println (c);
System.out.println (d);
System.out.println (e);
System.out.println (f);
false
true
true
true
true
false
https://poli.instructure.com/courses/4504/quizzes/19008/take 12/23
15/4/2018 Evaluación: Examen parcial - Semana 4
false
true
true
true
true
true
false
true
true
true
false
false
false
true
false
true
true
false
char i = 'd';
char j = 'e';
int n = 2;
String s = "d+e";
String t = "de";
String u = i + "" + n + j + "!";
System.out.println (i);
System.out.println (j);
System.out.println (s);
System.out.println (t);
System.out.println (u);
https://poli.instructure.com/courses/4504/quizzes/19008/take 13/23
15/4/2018 Evaluación: Examen parcial - Semana 4
d
e
d+e
de
d2e!
e
e
d+e
de!
de
d
e
de
de
d2!
d
e
de
de
de!
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
https://poli.instructure.com/courses/4504/quizzes/19008/take 14/23
15/4/2018 Evaluación: Examen parcial - Semana 4
boolean a = false;
boolean b = true;
boolean c = !a;
boolean d = a || b;
boolean e = d || c && !a;
boolean f = true && !e;
System.out.println (a);
System.out.println (b);
System.out.println (c);
System.out.println (d);
System.out.println (e);
System.out.println (f);
false
true
true
true
true
false
false
true
true
true
false
false
false
true
false
true
true
false
false
true
true
true
true
true
https://poli.instructure.com/courses/4504/quizzes/19008/take 15/23
15/4/2018 Evaluación: Examen parcial - Semana 4
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
System.out.println (i);
10
9
8
7
6
5
4
3
2
1
0
Error de compilación
1.0
9.0
1.0
2
3
-1
https://poli.instructure.com/courses/4504/quizzes/19008/take 16/23
15/4/2018 Evaluación: Examen parcial - Semana 4
20
19
18
17
16
15
14
13
12
11
10
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
Suponga la siguiente porción de código donde existe una variable numero definida previamente. Evalúe la
ejecución con valores 3, 12, 18, 20, 22.
int resultado = 0;
if (numero % 2 == 0) {
if (numero % 4 == 0) {
if (numero % 6 == 0)
resultado = 3;
else
resultado = 2;
}
else {
resultado = 1;
}
}
else {
resultado = 0;
}
https://poli.instructure.com/courses/4504/quizzes/19008/take 17/23
15/4/2018 Evaluación: Examen parcial - Semana 4
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
3. Cree una clase.
4. Realize el encabezado public static void main (String[] args){
5. Declare variables ( DE SER NECESARIO)
int n=5;
int m = n * 2;
int i = 1;
https://poli.instructure.com/courses/4504/quizzes/19008/take 18/23
15/4/2018 Evaluación: Examen parcial - Semana 4
while (i <= n) {
int j = 1;
while (j < m) {
if (j <= n)
else
} else {
j = j + 1;
System.out.println ();
i = i + 1;
1
01
-1 0 1
-2 -1 0 1
-3 -2 -1 0 1
123451
1234
12
1
10
1 0 -1
1 0 -1 -2
1 0 -1 -2 -3
https://poli.instructure.com/courses/4504/quizzes/19008/take 19/23
15/4/2018 Evaluación: Examen parcial - Semana 4
123454321
1234321
12321
121
1
boolean a = false;
boolean b = true;
boolean c = !a;
boolean d = a || b;
boolean e = d || c && !a;
boolean f = true && !e;
System.out.println (a);
System.out.println (b);
System.out.println (c);
System.out.println (d);
System.out.println (e);
System.out.println (f);
false
true
true
true
true
true
false
true
true
true
false
false
https://poli.instructure.com/courses/4504/quizzes/19008/take 20/23
15/4/2018 Evaluación: Examen parcial - Semana 4
false
true
true
true
true
false
false
true
false
true
true
false
Multiplicación
División
Módulo
Resta
int a = 1;
int b = 2;
int c = 5;
int d = (a + b) * c;
int e = a + b * c;
int f = 2 * a * a * + b * 3 + c;
System.out.println (a);
System.out.println (b);
https://poli.instructure.com/courses/4504/quizzes/19008/take 21/23
15/4/2018 Evaluación: Examen parcial - Semana 4
System.out.println (c);
System.out.println (d);
System.out.println (e);
System.out.println (f);
1
2
5
15
12
17
1
3
5
15
10
17
2
3
6
15
11
17
1
2
5
15
11
17
Ejercicio de Compilación:
1. Ingrese a eclipse.
2. Cree un proyecto.
https://poli.instructure.com/courses/4504/quizzes/19008/take 22/23
15/4/2018 Evaluación: Examen parcial - Semana 4
int x=26750,r=0;
r+=x/10000;
x=x%10000;
r+=x/1000;
x=x%1000;
r+=x/100;
x=x%100;
r+=x/10;
r+=x%10;
System.out.println(x);
180
90
50
130
https://poli.instructure.com/courses/4504/quizzes/19008/take 23/23