Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

JAVA QUESTIONS : PART 30

From where break statement causes an exit?

Only from innermost loop

Terminates a program

Only from innermost switch

From innermost loops or switches

SHOW ANSWER

Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?

 do-while

while

for

none of the mentioned

SHOW ANSWER

What is the output of this program?
class Sample{
        public static void main(String args[]) {
    int sum = 0;
                 for (int i = 0, j = 0; i < 5 & j < 5; ++i, j = i + 1)
                sum += i;
     System.out.println(sum);
        } 
}
 

 5

6

14

compilation error

SHOW ANSWER

What is the output of this program?
class Sample{
        public static void main(String args[]) {
    int x = 2;
             int y = 0;
             for ( ; y < 10; ++y) 
             {
                 if (y % x == 0) 
                     continue;  
                 else if (y == 8)
                      break;
                 else
                    System.out.print(y + " ");
             }
        } 
}
 

1 3 5 7

2 4 6 8

1 3 5 7 9

1 2 3 4 5 6 7 8 9

SHOW ANSWER

What is the output of this program?
class Output{
        public static void main(String args[]) {
     final int a=10,b=20;
          while(a<b)
          {
     
          System.out.println("Hello");
    a++;
          }
        
        } 
}
 

Hello

run time error

Hello world

compile time error

SHOW ANSWER

What is true about a break?

Break stops the execution of entire program

Break halts the execution and forces the control out of the loop

Break forces the control out of the loop and starts the execution of next iteration

Break halts the execution of the loop for certain time frame

SHOW ANSWER

Which of the following is not OOPS concept in Java?

Inheritance

Encapsulation

Polymorphism

Compilation

SHOW ANSWER

Which of the following is a type of polymorphism in Java?

Compile time polymorphism

Execution time polymorphism

Multiple polymorphism

Multilevel polymorphism

SHOW ANSWER

When method overloading does is determined?

At run time

At compile time

At coding time

At execution time

SHOW ANSWER

Which concept of Java is a way of converting real world objects in terms of class?

Polymorphism

Encapsulation

Abstraction

Inheritance

SHOW ANSWER

Which concept of Java is achieved by combining methods and attribute into a class?

Encapsulation

Inheritance

Polymorphism

Abstraction

SHOW ANSWER

Method overriding is combination of inheritance and polymorphism?

True

false

SHOW ANSWER

Which component is used to compile, debug and execute java program?

 JVM

JDK

JIT

JRE

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in