0% found this document useful (0 votes)
23 views5 pages

UNIT Java Programming - Quizizz

The document contains a 20 question quiz on Java programming concepts. The questions cover topics like data types, loops, exceptions, threads, and operators. Students are asked to select the correct answer from multiple choice options to questions about Java code snippets and concepts. The quiz is timed for 12 minutes and includes the student's name, class, and date at the top.

Uploaded by

Anand Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
23 views5 pages

UNIT Java Programming - Quizizz

The document contains a 20 question quiz on Java programming concepts. The questions cover topics like data types, loops, exceptions, threads, and operators. Students are asked to select the correct answer from multiple choice options to questions about Java code snippets and concepts. The quiz is timed for 12 minutes and includes the student's name, class, and date at the top.

Uploaded by

Anand Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 5

2/23/24, 12:56 PM Java Programming | Quizizz

Worksheets Name

Java Programming
Class
Total questions: 20
Worksheet time: 12mins
Date
Instructor name: Imran Khan

1. 1. Which of this method is given parameter via command line arguments?

a) c) Any method b) d) System defined methods

c) a) main() d) b) recursive() method

2. What are the Type Conversions available in Java language?

a) A) Narrowing Type Conversion b) A and B

c) B) Widening Type Conversion d) D) None of the above

3. 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) C) B b) B) A

c) D) 65 d) A) 66

4. Which type of loop is best known for its boolean condition that controls entry to the loop?

a) A. do-while loop b) B. for (traditional)

c) C. for-each d) D. while

https://quizizz.com/print/quiz/62fe0490cc9698001e350e54 1/5
2/23/24, 12:56 PM Java Programming | Quizizz

5. 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) b) Error b) d) Hii

c) a) Nothing d) C) Finite

6. char is 2 byte in storage?

a) False b) True

7. Name the data type: '3'

a) char b) int

c) String d) None of the above

8. What data type would you use for storing the number of students in a class?

a) double b) String

c) int d) boolean

9. What data type would be best used to record an email address?

a) Real b) Integer

c) Character d) String

10. 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) A) 66 b) D) 65

c) C) B d) B) A

https://quizizz.com/print/quiz/62fe0490cc9698001e350e54 2/5
2/23/24, 12:56 PM Java Programming | Quizizz

11. What is the output of the following code snippet?


int i = 0; for(i = 0 ; i < 5; i++)
{}
System.out.println(i);

a) B. 0 b) A. 5

c) C. 4 d) D. Compilation Error

12. Function of the Scanner class to accept a float literal from the user is

a) next( ) b) hasNext( )

c) nextInt( ) d) nextFloat( )

13. Predict the value of k,


int k =10;
k=k+k++;

a) 20 b) 21

c) 11 d) 22

14. Which of these is not a Thread state?

a) Runnable b) sleep

c) terminated d) New

15. Which of the following key word is optional in Exception handling program

a) finally b) throw

c) catch d) try

16. What is an exception

a) Bug occurred during the compile time of a b) Error occurred during the execution of a
program program

c) It is related to input values d) Simply an Error

17. Exception classes belongs to following package

a) import java.util.* b) import java.io.*

c) import java.lang.Exception.* d) import java.lang.*

https://quizizz.com/print/quiz/62fe0490cc9698001e350e54 3/5
2/23/24, 12:56 PM Java Programming | Quizizz

18. Choose an exception if attempt to divide number by zero

int number = 89 / 0;
System.out.println("The answer is " + number);

a) NumberFormatException b) ArithmeticException

c) NullPointerException d) ArrayIndexOutOfBoundException

19. class exception_handling


{ public static void main(String args[])
{ try
{ int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
} catch(ArithmeticException e)
{ System.out.print("B");
}
finally
{ System.out.print("C");
}
}
}

a) BC b) A

c) B d) AC

https://quizizz.com/print/quiz/62fe0490cc9698001e350e54 4/5
2/23/24, 12:56 PM Java Programming | Quizizz

20. Find the output for the following.


public class IncDec
{
public static void main(String s[])
{
int a = 1;
int b = 2;
int c;
int d;

c = ++b;
d = a++;

c++;

System.out.println("a = " + a);


System.out.print("b = " + b);
System.out.println("c = " + c);
System.out.print("d = " + d);
}
}

a) Program does not compile. b) a = 2 b = 3 c = 4 d = 1

c) a = 2 b = 3 c = 4 d = 1 d) a = 1 b = 2 c = 4 d = 2

https://quizizz.com/print/quiz/62fe0490cc9698001e350e54 5/5

You might also like