Premium

Oracle Java Programming Certification Questions and Answers (Dumps and Practice Questions)



Question : You have been given code as shown.

Which option represents the state of the num array
after successful completion of the outer loop?
  : You have been given code as shown.
1. num[0][0]=10
num[0][1]=10
num[0][2]=10

2. num[0][0]=10
num[1][0]=10
num[2][0]=10
3. Access Mostly Uused Products by 50000+ Subscribers
num[0][1]=0
num[0][2]=0
4. num[0][0]=10
num[1][0]=0
num[2][0]=0



Correct Answer : Get Lastest Questions and Answer :









Question : You have been given a class as shown.
What would be the result if it is compiled/run

  : You have been given a class as shown.
1. Jaya25
Venkat52
2. Compilation fails only at line n1
C. Compilation fails only at line n2
3. Access Mostly Uused Products by 50000+ Subscribers

4. Compilation fails only at line n2





Correct Answer : Get Lastest Questions and Answer :







Question : Given the following code for a, what is the output?
 : Given the following code for a, what is the output?
1. [LQ59.HadoopExamApp;@2a139a55
Q59.HadoopExamApp.Moon@15db9742

2. [LQ59.HadoopExamApp;@2a139a55
Q59.HadoopExamApp@15db9742

3. Access Mostly Uused Products by 50000+ Subscribers
Q59.Moon@15db9742

4. Runtime Error




Correct Answer : Get Lastest Questions and Answer : Exp:






Related Questions


Question : You have been given following code fragment

String[] cartoons = { "tom", "jerry", "micky", "tom" };
int counter = 0;
if ("tom".equals(cartoons[0])) {
counter++;
} else if ("tom".equals(cartoons[1])) {
counter++;
} else if ("tom".equals(cartoons[2])) {
counter++;
} else if ("tom".equals(cartoons[3])) {
counter++;
}
System.out.print(counter);

What would be printed , when executed ?
 : You have been given following code fragment
1. 1
2. 2
3. Access Mostly Uused Products by 50000+ Subscribers
4. 0





Question : Which statement is true about the default constructor of a top-level class?

 :  Which statement is true about the default constructor of a top-level class?
1. It can take arguments.
2. It has private access modifier in its declaration.
3. Access Mostly Uused Products by 50000+ Subscribers
4. The default constructor of a subclass always invokes the no-argument constructor of its superclass.




Question : You have been given below code

List colors = new ArrayList();
colors.add("green");
colors.add("red");
colors.add("blue");
colors.add("yellow");
colors.remove(2);
colors.add(3, "cyan");
System.out.print(colors);


 : You have been given below code
1. [green, red, yellow, cyan]
2. [green, blue, yellow, cyan]
3. Access Mostly Uused Products by 50000+ Subscribers
4. An IndexOutOfBoundsException is thrown at runtime






Question : The catch clause argument is always of type .

A. Exception
B. Exception but NOT including RuntimeException
C. Throwable
D. RuntimeException
E. CheckedException


 : The catch clause argument is always of type .
1. A
2. B
3. Access Mostly Uused Products by 50000+ Subscribers
4. D
5. E





Question : You have been given following code

public class MainMethod {
void main() {
System.out.println("one");
}

static void main(String args) {
System.out.println("two");
}

public static void main(String[] args) {
System.out.println("three");
}

void mina(Object[] args) {
System.out.println("four");
}
}

What is printed out when the program is excuted?

 : You have been given following code
1. one
2. two
3. Access Mostly Uused Products by 50000+ Subscribers
4. four




Question : You have been given following code

int var1 = -5;
int var2 = var1--;
int var3 = 0;
if (var2 <lt; 0) {
var3 = var2++;
} else {
var3 = --var2;
}
System.out.println(var3);

What is the result?


 : You have been given following code
1. -6
2. -4
3. Access Mostly Uused Products by 50000+ Subscribers
4. 5

5. 4