Java Basic

Quiz Guidelines

 

Multiple Choice Question

QID: 
82

What will be the output of the following program when it is compiled and run with the command line 

java TestClass 1 2 3 

public class TestClass {
       public static void main(String[] args) {
             System.out.println("Values : "+args[0]+args[1]);
      }
}

Select 1 option

A. Values: java TestClass
B. Values: TestClass 1
C. Values: 12
D. Values: 23
E. Values: 3  

Multiple Choice Question

QID: 
81

Which of the following are valid declarations of the standard main() method?

Select 2 options 

A. static void main(String args[ ]) { } 
B. public static int main(String args[ ]) {} 
C. public static void main (String args) { } 
D. final static public void main (String[ ] arguments ) { } 
E. public static void main (String[ ] args) { } 

Multiple Choice Question

QID: 
80

Which method declarations will enable a class to be run as a standalone program?

Select 2 options

A. static void main(String args[ ])
B. public void static main(String args[ ])
C. public static main(String[ ] argv)
D. final public static void main(String [ ] array)
E. public static void main(String args[ ])

Multiple Choice Question

QID: 
79

Given the following class, which of these are valid ways of referring to the class from outside of the package com.enthu?

package com.enthu;
public class Base{
// ....
// lot of code...
}

Select 2 options

A. Base
B. By importing the package com.* and referring to the class as enthu.Base
C. importing com.* is illegal.
D. By importing com.enthu.* and referring to the class as Base.
E. By referring to the class as com.enthu.Base.

Multiple Choice Question

QID: 
78

Which of the following are valid identifiers?

Select 2 options

A. class
B. $value$
C. angstrom
D. 2much
E. zer@

Pages