Menu
Topics Index
...
`

Session 6 has these questions


Hello World Program

What will be the output of the following program.
class HelloWorld
{
    public static void main(String t[])
    {
        System.out.println("Hello World");
    }
}
A. Program does not compile since the keyword class should start with capital C
B. Hello World
C. Program does not compile since the variable name of the arguments is t.
 The name should be either s or args
D. HelloWorld



Simple Java Program354

Arrange the following program such that it compiles and first prints Hello World and then Hello Universe. Unselect any unwanted statements using the check box.
  • move class printhello
    {
  • move         System.out.println("Hello Universe");
  • move     public static void main(String arguments[])
        {
  • move         System.out.println("Hello World");
  • move     }
    }
  • move Class PrintHello
    {



Hello Universe Program

What will be the output of the following program.
class hellouniverse
{
    public static void main(String args[])
    {
        System.out.println("Hello World");
    }
}
A. The program causes a compilation error since the class name is in small 
letters. It will work if the class name was HelloUniverse
B. The program causes a compilation error since the class name is 
hellouniverse, but we are printing Hello World
C. Hello Universe
D. Hello World



Identify invalid keyword

Identify the invalid java keyword in the below list
A. integer
B. float
C. char
D. double



Print I Love java

Arrange the following program such that it compiles and prints I Love Java. Unselect any unwanted statements using the check box.
  • move { public static void main(String s[]) { System.out.println("I Love Java"); } }
  • move class PrintJava
  • move { Public Static Void Main() { System.out.println("I Love Java"); } }
  • move { Public static void Main(String args[]) { System.out.println("i love java"); } }



© meritcampus 2019

All Rights Reserved.

Open In App