Quiz Discussion

What will be the output of the following Java program?

    class jump_statments 
    {
        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 + " ");
             }
        } 
    }

 

Course Name: Java

  • 1]

    1 3 5 7

  • 2]

    2 4 6 8

  • 3]

    1 3 5 7 9

  • 4]

    1 2 3 4 5 6 7 8 9

Solution
No Solution Present Yet

Top 5 Similar Quiz - Based On AI&ML

Quiz Recommendation System API Link - https://fresherbell-quiz-api.herokuapp.com/fresherbell_quiz_api

# Quiz
1
Discuss

Which of these are selection statements in Java?

  • 1]

    if()

  • 2]

    for()

  • 3]

    continue

  • 4]

    break

Solution
2
Discuss

What will be the output of the following Java program?

    class selection_statements 
    {
        public static void main(String args[])
        {
            int var1 = 5; 
            int var2 = 6;
            if ((var2 = 1) == var1)
                System.out.print(var2);
            else 
                System.out.print(++var2);
        } 
    }

 

  • 1]

    1

  • 2]

    2

  • 3]

    3

  • 4]

    4

Solution
3
Discuss

What would be the output of the following code snippet if variable a=10?

if(a<=0)
{
   if(a==0)
   {
     System.out.println("1 ");
   }
   else 
   { 
      System.out.println("2 ");
   }
}
System.out.println("3 ");

 

  • 1]

    1 2

  • 2]

    2 3

  • 3]

    1 3

  • 4]

    3

Solution
# Quiz