0% found this document useful (0 votes)
2 views

ECS-II_Core_Java_Question_Bank

The document is a question bank for a Core Java course, containing multiple-choice questions, short answer questions, and programming tasks. It covers various topics including data types, exception handling, object-oriented concepts, and Java syntax. The document is structured into sections with questions assigned different marks.

Uploaded by

pabhijit339
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

ECS-II_Core_Java_Question_Bank

The document is a question bank for a Core Java course, containing multiple-choice questions, short answer questions, and programming tasks. It covers various topics including data types, exception handling, object-oriented concepts, and Java syntax. The document is structured into sections with questions assigned different marks.

Uploaded by

pabhijit339
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Course:: E. C. S.

Sem: IV
Subject:: Core Java

Question bank
Q.1 Choose the correct atlernative (8 Marks)
Sr.No. Que Correct
Option

1 Which of the following is not a primitive data type in Option 3


Java?
1. int
2. char
3. String
4. float
2 What does the this keyword refer to in Java? Option 2
1. The current class
2. The current instance of the class
3. The superclass of the current class
4. The current method
3 What is the return type of the main method in Java? Option 1
1. void
2. int
3. String
4. null
4 Which method is used to print output to the console in Java? Option 2
1. print()
2. println()
3. write()
4. output()
5 Which keyword is used to define a constant in Java? Option 2

1.static
2.final
3.const
4.constant

6 Which of the following is used to declare an array in Java? Option 4


1. int arr[];
2. array int[];
3. int[] arr;
4. Both 1 and 3
7 Which of the following types of variables can have the keyword Option 3
static in Java?
1. Instance variables
2. Local variables
3. Class variables
4. Both instance and local variables
8 What is the default value of an instance variable of type int in Java? Option 1
1. 0
2. null
3. 1
4. Undefined
9 Which of the following is NOT an object-oriented concept in Java? Option 4
1. Encapsulation
2. Polymorphism
3. Inheritance
4. Compilation
10 What does the super keyword do in Java? Option 2
1. Refers to the current class
2. Calls a constructor from the parent class
3. Refers to the superclass constructor
4. Is used to declare a static method
11 Which method is used to compare two strings in Java? Option 3
1. ==
2. compareTo()
3. equals()
4. compare()
12 Which of the following is the correct syntax for defining a Option 1
constructor in Java?
1. public ClassName() {}
2. public ClassName {}
3. public ClassName()
4. void ClassName() {}
13 Which keyword is used to define an abstract class in Java? Option 1
1. abstract
2. interface
3. final
4. static
14 Which of the following is used to define a package in Java? Option 1
1. package
2. import
3. public class
4. package define
15 What is the effect of autoboxing in Java? Option 2
1. Converting objects to primitive types.
2. Automatically converting primitive types to their corresponding
wrapper classes.
3. Reversing the effects of wrapper classes.
4. Automatically handling memory management.
16 Which of the following is a checked exception in Java? Option 3
1. ArithmeticException
2. NullPointerException
3. IOException
4. ArrayIndexOutOfBoundsException
17 Which of the following is a feature of the 'finally' block in Option 3
exception handling?
1. It is executed only if an exception occurs.
2. It is executed only if no exception occurs.
3. It is always executed, regardless of whether an exception occurs
or not.
4. It is executed before the exception is thrown.
18 Which interface is used to create a thread in Java? Option 1
1. Runnable
2. Threadable
3. Startable
4. Executable
19 Which of the following is NOT an event listener interface in Java? Option 4
1. ActionListener
2. MouseListener
3. KeyListener
4. TimerListener
20 Which of the following is NOT a characteristic of interfaces in Option 2
Java?
1. Interfaces can have both abstract and default methods.
2. An interface cannot extend another interface.
3. Interfaces cannot contain instance variables.
4. A class can implement multiple interfaces.
21 Which of the following packages contains classes for networking Option 2
operations in Java?
1. java.util
2. java.net
3. java.io
4. java.lang
22 What does the 'throw' keyword do in Java? Option 3
1. It creates an exception.
2. It handles an exception.
3. It explicitly throws an exception.
4. It throws an exception automatically when an error occurs.
23 What method is used to start a thread in Java? Option 3
1. run()
2. execute()
3. start()
4. begin()
24 Which method is used to display an applet in Java? Option 1
1. paint()
2. display()
3. run()
4. show()
25 What is the purpose of the 'super' keyword in Java? Option 2
1. To call a constructor of the subclass.
2. To refer to the immediate parent class.
3. To access private members of the subclass.
4. To define an abstract class.
26 Which keyword in Java makes a class or method accessible only Option 4
within the same package?
1. public
2. protected
3. private
4. default
27 Which class is used to create a simple button in Java Swing? Option 1
1. JButton
2. Button
3. JButtonControl
4. SwingButton

Q2. Answer any four of the following questions. Each question carries two marks.
(4 x2: 8)
Sr.No. Que

1 What is bytecode in Java?

2 Define a variable and a constant.


3 Define an array with its syntax.
4 What is local variable and global variable?
5 What is the use of JVM in Java?
6 What is method overloading?
7 What is data types? List out various data types in java.
8 What is type conversion? Give an example.
9 What is a class in Java?
10 What is the purpose of the final keyword in Java?
11 What is method overriding in Java?
12 What is inheritance in Java?
13 What is package in Java?
14 What is AWT? List out the various AWT controls in Java?
15 What is an abstract class in Java?
16 What are wrapper classes in Java? Give an example.
17 What is multithreading in Java?
18 What is Enumerations in Java?
19 Explain the concept of "autoboxing" in Java.
20 What are event listener interfaces in Java?

Q3. Answer any two of the following questions. Each question carries four marks .
2 x 4: 8

Sr.No. Que

1 Write a java program to demonstrate arithmetic and logical operators.

2 Write a Java program to check the number is even or odd.


3 What are the different types of loops in Java? Give an example of each.
4 Write the differences between C++ and Java.
5 What is class and object in Java? Explain with suitable program.
6 What is the difference between a checked and an unchecked exception in Java?
7 How do you handle exceptions in Java? Explain with an example of a try-catch
block.
8 What is multilevel inheritance? Illustrate it with an example.
9 What are the advantages of using interfaces in Java?
Q4. Write short note on any two. Each question carries four marks. (2 x 4 : 8)
Sr.No. Que

1 What is constructors in Java? Explain with an example.

2 Describe the purpose and use of final classes in Java with an example.
3 Explain method overloading with suitable program.
4 Describe how a Java program is compiled and executed.
5 Explain the concept of garbage collection in Java.
6 Explain the concept of method overriding with an example in Java.
7 Explain abstract class in Java with an example.
8 What are standard Java packages? Name some common Java
packages and their use.
9 Explain the concept of thread synchronization in Java and why it is
important.

Q5. Answer any one of the following questions. Each question carries eight marks.
(l x 8=8)
(for 25 Marks QP Consider this as Question 4 )
Sr.No. Que

1 What is Java? Explain various features of Java.


2 What is Operator in Java? Explain types of operator with suitable
program.
3 What is Array? Explain types of array with syntax and suitable
program.
4 What is conditional statement? Explain types of conditional
statements with suitable program.
5 What is Inheritance? Explain Single and multilevel inheritance with
suitable program.
6 What is Exception? Explain the concept of Exception handling. Write
the java program to handle an exception.
7 What is thread? Explain Multithreading concept in Java? Write a Java
program to create thread using runnable interface.

You might also like