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

Object Oriented Programming Through Java -Mid1-Impoertant-questions

Uploaded by

mahimahender960
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Object Oriented Programming Through Java -Mid1-Impoertant-questions

Uploaded by

mahimahender960
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Which program is used to compile Java source code into bytecode?

a) javap b) javac c) java d) javad

What is the purpose of the break statement in Java?


a) To terminate the program b) To exit a loop or switch statement
c) To skip the next iteration of a loop d) To return a value from a method

Which of the following is a super class of every class in Java? a)ArrayList


b)Abstractclass c)Object class d)String

Which of the following is not a Java features?


a) Dynamic b)ArchitectureNeutral c)Use of pointers d)Object-oriented

Which component is used to compile,debug and execute the java programs?


a) JRE b) JIT c)JDK d)JVM

Which of these cannot be used for a variable name in Java? a)Identifier&


keyword b)keyword c)identifier d) none

Which of these is correct way of inheriting class A by class B? a)class B + class


A {} b)class B inherits class A {}
c)class B extends A {} d)class B extends class A {}

What is not the use of “this” keyword in Java?


a) Passing itself to the method of the sameclass
b) Referring to the instance variable when a local variable has the same name
c) Passing itself to another method
d) Calling another constructor in constructor chaining

Which of these keywords is used to define interfaces in Java?


a)intf b)interface c)Intf d)Interface

Which keyword is used in Java to refer to the current object?


a) that b) self c) current d) this

What is the purpose of a constructor in a class?


a) To destroy objects of the class b) To create static methods
c) To implement inheritance d) To initialize objects of the class
A class that is created inside a method in java is called?
a) Anonymous inner class b) local inner class
c) Member Inner class d) Static nested classes

Which of these is incorrect array declaration?


a) int arr=new int 5 ; b)int arr=new int 5 ;
c) int arr =int 5 new; d) int arr ={2,5,7,8,9,3};
Which class can have abstract and non-abstract methods.
a) final class b)super class c)sub class d) abstract class

Which one of the following is not an access modifier? a)Protected


b)Public c)Private d) void

In which of the following is toString() method defined?


a) java.lang.Object b)java.lang.String c)java.lang.util d)None

Which of these keywords must be used to monitor for exceptions? a)finally


b)try c)throw d)catch

In Java, what is the role of the public static void main(String args)
method?
a) Initialization method b) Constructor c) Execution entry point d) Destructor

Choose the correct syntax of a Java Package below.


a) package PACKAGE_NAME; b) package PACKAGE_NAME.*;
c) pkg PACKAGE_NAME; d) pkg PACKAGE_NAME.*;

Which of the following statements is true about exception handling in Java:


a) A try block can have many catch blocks but only one finally block
b) A try block can have many catch blocks and many finally blocks
c) A try block must have one finally block for each catch block
d) A try block must have at least one catch block to have a finally block

In java, JVM stands for Java Virtual Machine

Defining multiple constructors in a class with different parameter lists is called constructor overloading in
Java.

Java programming is an object oriented language.

When an array is passed to a method, what does the method receive the reference of the array

When is the object created with new keyword at runtime

Which return type of a method that does not return any value void

Output of Math.Floor(3.6) 3.0

Connecting a method call to the method body is known as Binding The private

access modifier is accessible only within the class.


If a variable of primitive data type in Java is declared as final, then Its value cannot be changed.

Garbage collection in Java is the process by which Java programs perform automatic memory
management.

Scanner s=new Scanner(System.in);is the syntax to create the instance of Scanner class.

Where does the system stores parameters and local variables whenever a method is invoked stack

Java code need to be compiled into byte code before it can be executed.

When is the finalize() called before garbage collection

Exceptions created by try block is caught in which block catch

We need to use the java import keyword which is used to access the package and its classes into the
java program.

Interface is similar to class which is collection of public static final variables (constants) and
abstract methods.

An Exception is a run time error, which occurs during the execution of a program, that distrupts the
normal flow of the program's instructions.

When exceptions in java does arises in code sequence run time

1. List out OOP concepts and Java Buzzwords and explain briefly?
2. Explain various control statements in java?
3. Explain overloading methods and constructors in java?
4. Explain Types of Inheritance in java with Example programs?
5. Name some object oriented programming concepts and explain?
6. Explain method overloading and constructor overloading concept with example?
7. Differentiate between abstract class and interface with suitable example?
8. Define inheritance. Explain different types of inheritances with example?
9. How to create and access a package? Explain with a suitable program and advantages of packages?
10. What is an exception? How are exceptions handled in Java programming? Explain with suitable
program?
11. Describe super and final keywords in java with suitable examples?
12. What are the difference between classes and interfaces and how can we achieve multiple inheritances
in java by using interfaces?
13. What is constructor? What are the types of constructor
14. What is class and define structure give example
15. What is object class and what are the methods of object?

You might also like