Ssd1 icarnegie examen 5

Páginas: 9 (2093 palabras) Publicado: 5 de diciembre de 2010
| Your performance was as follows: |

| 1. | | Considera el siguiente segmento de programa. public String nameOfEmployee (int salary) { if (salary < 50000) { if (salary > 45000) return "Joe"; } else if (salary < 60000) return "John";else return "Jack"; return null; }Si el método nameOfEmployee es llamado con un valor de 55000 como su argumento, ¿qué valor String será regresado?   ‹‹‹   Consider the following program segment. public String nameOfEmployee (int salary) { if (salary < 50000) {if (salary > 45000) return "Joe"; } else if (salary < 60000) return "John"; else return "Jack"; return null; }Ifthe method nameOfEmployee is called with the value 55000 as its argument, what String value will be returned?   ›››   | |

| (a) "Joe"  ‹‹‹   "Joe"   ›››  
(b) "John"   ‹‹‹   "John"   ›››  
(c) "Jack"  ‹‹‹   "Jack"   ›››  
(d) null  ‹‹‹   null   ›››   |

| Correct answer is | (b) |

| Your score on this question is: | 0.00 |

| Feedback: |
    Ver sección 2.3.4 en lasnotas del curso.   ‹‹‹   See section 2.3.4 in the course notes.   ›››  
    | |

| 2. | | Suponiendo que las variables max, x, y y son variables de Java de tipo int y asume que x, y y tienen diferentes valores. Indica cuáles de los siguientes segmentos de programa de Java asignarán el valor mayor entre x y y a la variable max al momento de ejecutarse, . I. if (x > y) max = x; else max =y; II. if (y - x <= 0) max = x; else max = y; III. max = x; if (x < y) max = y;  ‹‹‹   Assume that max, x, and y are Java variables of type int and assume that x and y have different values. Execution of which of the following Java program segments will result in the larger of x and y being assigned to max? I. if (x > y) max = x; else max = y; II. if (y - x <= 0) max = x;else max = y; III. max = x; if (x < y) max = y;  ›››   | |

| (a) I solamente  ‹‹‹   I only   ›››  
(b) III solamente  ‹‹‹   III only   ›››  
(c) I y II solamente  ‹‹‹   I and II only   ›››  
(d) I, II, y III  ‹‹‹   I, II, and III   ›››   |

| Correct answer is | (d) |

| Your score on this question is: | 0.00 |

| Feedback: |
    Ver sección 2.3.4 las notas del curso.  ‹‹‹   See section 2.3.4 of the course notes.   ›››  
    | |

| 3. | | En Java, el número 2.0 podría ser de tipo   ‹‹‹   The type of the number 2.0 in Java can be   ›››   | |

| (a) int  ‹‹‹   int   ›››  
(b) boolean  ‹‹‹   boolean   ›››  
(c) double  ‹‹‹   double   ›››  
(d) Panel  ‹‹‹   Panel   ›››   |

| Correct answer is | (c) |

| Your score on this question is:| 0.00 |

| Feedback: |
   Ver sección 2.3.1 en las notas del curso.   ‹‹‹   See section 2.3.1 in the course notes.   ›››  
    | |

| 4. | | En el siguiente fragmento de código de Java, ¿cuál debe ser el tipo de la variable x de modo que se haga una asignación válida? int y = 2; x = (double) y;  ‹‹‹   In the following Java codefragment, what must be the type of the variable x in order to make the assignment valid? int y = 2; x = (double) y;  ›››   | |

| (a) Indefinido  ‹‹‹   Undefined   ›››  
(b) int  ‹‹‹   int   ›››  
(c) Integer  ‹‹‹   Integer   ›››  
(d) double   ‹‹‹   double   ›››   |

| Correct answer is | (d) |

| Your score on this question is: |...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Examen de 5°
  • Examen 5 bimestre
  • Examen Primer Bimestre 5
  • Examen Bimestral 5 años
  • Examen del capitulo 5 CCNA1
  • Examen estadistica 5
  • examen 5 fol
  • Examen De Diagnostico 5° Grado

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS