NEW
Font size
WorksheetsJava Programming-1
Total questions: 10
Worksheet time: 5mins
1. Which of this method is given parameter via command line arguments?
a) main()
b) recursive() method
c) Any method
d) System defined methods
Which of these data types is used to store command line arguments?
a) Array
b) Stack
c) String
d) Integer
3. How many arguments can be passed to main()?
a) Infinite
b) Only 1
c) System Dependent
d) None of the mentioned
What are the Type Conversions available in Java language?
A) Narrowing Type Conversion
B) Widening Type Conversion
A and B
D) None of the above
Which are the compatible Data Types for Type Promotion or Type Casting?
A) byte, char, short
B) char, int, float
C) float, long, double
D) All the above
What is the output of the below Java code snippet?
char ch = 'A';//ASCII 65
int a = ch + 1;
ch = (char)a;
System.out.println(ch);
A) 66
B) A
C) B
D) 65
Which type of loop is best known for its boolean condition that controls entry to the loop?
A. do-while loop
B. for (traditional)
C. for-each
D. while
What is the output of the following code snippet?
int i = 0; for(i = 0 ; i < 5; i++)
{ }
System.out.println(i);
A. 5
B. 0
C. 4
D. Compilation Error
What will be the Output of the below code:
public class Demo{
public static void main(String[] arr){
}
public static void main(String arr){
}
}
a) Nothing
b) Error
C) Finite
d) Hii
What is the output of the following Java Code?
int a=9;
float b = a/2;
System.out.println(b);
A) 4.0
B) 4.5
C) 5.0
D) None of the above
