Eval1 Teor 1

Páginas: 7 (1646 palabras) Publicado: 16 de octubre de 2012
1. Which declaration of the main method below would allow a class to be started as a standalone program. Select two correct answers.
1. public static int main(char args[])
2. public static void main(String args[])
3. public static void main (String cadenas[])
4. public static void main(String args)
5. public static void MAIN(char args[])
2. What all gets printed when the following code iscompiled and run? Select the three correct answers.
| public class xyz { |
| public static void main (String[] args){ |

| for(int i = 0; i < 2; i++) { |
| for(int j = 2; j>= 0; j--) { |

| if(i == j) break; |
| System.out.println("i=" + i + " j="+j); |

| } |
| } |

| } |
| } |1. i=0 j=0
2. i=0 j=1
3. i=0 j=2
4. i=1 j=0
5. i=1 j=1
6. i=1 j=2
7. i=2 j=0
8. i=2 j=1
9. i=2 j=2
3. In Java technology what expression can be used to represent number of elements in an array named arr ?
1. arr.size
2. arr.length
3. arr.longer
4. arr.large
5. arr.long.value

4. Which of the following is a Java keyword. Select the four correct answers.
1. extern
2. synchronized3. volatile
4. friend
5. friendly
6. transient
7. this
8. then
5. Is the following statement true or false? The constructor of a class must not have a return type.
1. true
2. false
6. What is the number of bytes used by Java primitive long. Select the one correct answer.
1. The number of bytes is compiler dependent.
2. 2
3. 4
4. 8
5. 64
7. What is the number of bits used by Javaprimitive double. Select the one correct answer.
1. 8
2. 32
3. 48
4. 96
5. 64
8. What is returned when the method substring(4,7) is invoked on the string “compiler”? Include the answer in quotes as the result is of type String.
1. piler.
2. cmpil
3. iler
4. ile
5. Ler

9. Which of the following is correct? Select the two correct answers.
1. The native keyword indicates that the methodis implemented in another language like C/C++
2. The only statements that can appear before an import statement in a Java file are comments.
3. The method definitions inside interfaces are public and abstract. They cannot be private or protected.
4. A class constructor may have public or protected keyword before them, nothing else.
10. Name the access modifier which when used with a method,makes it available to all the classes in the same package and to all the subclasses of the class.
1. private.
2. protected
3. default
4. public
5. static
11. Which of the following is true. Select the one correct answer.

1. A class that is abstract may not be instantiated.
2. The final keyword indicates that the body of a method is to be found elsewhere. The code is written in non-Javalanguage, typically in C/C++.
3. A class public may be instanced to all other classes in the same package only.
4. A class static it is accessible to all other classes in the same package.
12. Which of the following is true. Select the one correct answer.
1. A private variable indicates that it is accessible to all other classes.
2. A public variable indicates that it is optimized.
3. Astatic variable indicates there is only one copy of that variable.
4. A method defined as private indicates that it is accessible to all other classes in the same package.
13. What all gets printed when the following program is compiled and run. Select the two correct answers.
| public class test { |
| public static void main(String args[]) { |

| inti,j=1;|
| i = (j>1)?2:1; |

| switch(i) { |
| case 0: System.out.println(0); break; |

| case 1: System.out.println(1); |
| case 2: System.out.println(2); break; |

| case 3: System.out.println(3); break; |
| } |

| } |
| } |
a. 0
b. 1
c. 2
d. 3
14. What all gets printed when the following program is compiled and...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Teor a y proyecto 1 1
  • TEOR A FUNDAMENTADA 1 1
  • TEOR A DEL ESTADO Foro 1
  • Historia Y Teor A Celular 1
  • TEOR A Unidad 1
  • Apuntes Teor as 1
  • Teor a financiera del Estado 1
  • Teorà a_cuà ntica 1

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS