Menu
Topics Index
...
`

Print student result


If you need explanation Read this topic

If you need Answer Take test on this topic

Print student result
What will be the output of the following program?
class StudentPass
{
    public static void main(String s[])
    {
        int marks = 80;

        if( marks > 70 )
            System.out.println("Distinction");
            System.out.println("Congratulations");
        else if( marks > 35 )
            System.out.println("Pass");
        else
            System.out.println("Fail");
            System.out.println("Better luck next time");
        
    }
}

A. Pass
B. Distinction
Congratulations
Pass
C. Distinction
Congratulations
D. Distinction
E. Compilation Errors
Topic: if else if ladder In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

B

Posted by Vishnu Vardhan Reddy    2014-08-05 12:41:03


B

Posted by Vishnu Vardhan Reddy    2014-08-05 12:41:47


Answer is C after if block condition is checked it will print the both statements"Distinction Congratulations" and execution will be terminated

Posted by Sai Avinash    2014-08-05 12:43:16


E; Compilation error....because else is followed by if block only..... here before else there is another statement

Posted by Bahunadam Narendra    2014-08-05 12:54:34


E is ans... because statements in first if block are not mention with in brasses... so it gives compilation errors..

Posted by Sareesh Rayapati    2014-08-05 12:58:58


e

Posted by Sapna Patel    2014-08-05 13:26:10


E

Posted by Gopinath Manchikanti    2014-08-05 14:21:16


E

Posted by Akshay Bhatwadekar    2014-08-05 14:27:46


Congratulations Bahunadam Narendra. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-08-06 04:50:39


© meritcampus 2019

All Rights Reserved.

Open In App