0% found this document useful (0 votes)
28 views6 pages

Question Bank No 1 With MCQ For Improvement-I

Uploaded by

Nilesh Koli
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)
28 views6 pages

Question Bank No 1 With MCQ For Improvement-I

Uploaded by

Nilesh Koli
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/ 6

Since 2001

Bhartiya Gramin Punarrachna Sanstha’s


Hi-Tech Institute of Technology, Aurangabad
A Pioneer to Shape Global Technocrats
Approved By AICTE, DTE Govt. of Maharashtra & Affiliated to Dr. Babasaheb Ambedkar Technological University, Lonere, Raigad
P-119, Bajajnagar, MIDC Waluj, Aurangabad, Maharashtra, India - 431136P: (0240) 2552240, 2553495, 2553496 Web:http://hitechengg.edu.in/

QUESTION BANK NO: 01 CLASS: SECOND YEAR


BRANCH: CSE SUBJECT NAME: OOPJ

1. Explain Java Programming with all the features of Object-Oriented Programming Language?
2. Differentiate between Primitive types and Reference Types.
3. Write a Java Program to demonstrate the use of Constructor Overloading.
4. What is Constructor in Java? Explain with suitable example.
5. Explain in detail typical java development environment.
6. Explain the terms: i) Class ii) Object iii) Method iv) Instance Variables
7. What is method overloading? Explain in detail.
8. Write a Java program to calculate the area of circle using method overloading concept?
9. Write a Java program to calculate the area of rectangle using constructor overloading concept?
10. Write a java program using following guidelines:
Take two different classes: Marks, StudentDemo
Marks is having Members:
Name of student, Sub1, Sub2, Sub3, Sub4, Sub5, RollNo
getData()
ShowData()
StudentDemo having:
Main method.
MULTIPLE CHOICE QUESTIONS (MCQS)

Section 1: Java Basics and Development Environment

1. Which of the following is NOT part of the typical Java Development Environment?
A. Java Compiler
B. Java Virtual Machine (JVM)
C. Java Debugger
D. Web Server

Answer: D

2. Java Class Libraries are also known as:


A. Java APIs
B. Java IDEs
C. Java Packages
D. Java Threads

Answer: A

3. What does the Java Virtual Machine (JVM) do?


A. Compiles Java code to bytecode
B. Interprets bytecode to machine code
C. Provides a graphical user interface for Java development
D. Debugs Java programs

Answer: B

4. In Java, memory for objects is allocated in:


A. Stack memory
B. Heap memory
C. Registers
D. Program counter

Answer: B

5. Which of the following operators is used for arithmetic addition in Java?


A. ++
B. +
C. +=
D. &

Answer: B

Section 2: Classes and Objects

6. A class in Java is a:
A. Blueprint for objects
B. Data type
C. Method
D. Variable
Answer: A

7. What is used to create an instance of a class?


A. Constructor
B. Destructor
C. Method
D. Interface

Answer: A

8. Which keyword is used to declare a class in Java?


A. `method`
B. `class`
C. `object`
D. `new`

Answer: B

9. Instance variables are:


A. Declared inside methods
B. Declared within the class but outside methods
C. Shared among all objects of the class
D. Declared using the `static` keyword

Answer: B

10. A method is:


A. A blueprint for creating objects
B. A collection of instructions that perform a task
C. A memory location in the JVM
D. An object constructor

Answer: B

Section 3: Declaring and Using Methods

11. Methods that do not return a value have the return type:
A. `null`
B. `void`
C. `int`
D. `none`

Answer: B

12. The `set` methods in Java are commonly used to:


A. Retrieve the value of instance variables
B. Set or modify the value of instance variables
C. Perform mathematical operations
D. Define classlevel variables
Answer: B

13. What is the correct syntax for calling a method named `display` on an object `obj`?
A. `obj.display;`
B. `display(obj);`
C. `obj.display();`
D. `display.obj();`

Answer: C

14. The `get` methods are used for:


A. Modifying instance variables
B. Retrieving the value of instance variables
C. Declaring a class
D. Initializing objects

Answer: B

15. A method that takes no arguments and returns no value is declared as:
A. `void methodName()`
B. `void methodName(void)`
C. `null methodName()`
D. `none methodName()`

Answer: A

Section 4: Primitive vs. Reference Types

16. Which of the following is a primitive data type in Java?


A. `String`
B. `int`
C. `Integer`
D. `Object`

Answer: B

17. What distinguishes reference types from primitive types in Java?


A. Reference types store the actual value
B. Primitive types store references to the memory location
C. Reference types point to memory locations where the actual data is stored
D. Reference types are faster to access

Answer: C

18. The default value for a reference type variable is:


A. 0
B. `null`
C. `false`
D. Undefined

Answer: B
19. Floatingpoint numbers in Java are represented by:
A. `int` and `long`
B. `float` and `double`
C. `byte` and `short`
D. `char` and `boolean`

Answer: B

20. The `double` data type in Java is typically used for:


A. Characters
B. True or false values
C. Large decimal numbers
D. Whole numbers

Answer: C

Section 5: Constructors and Initialization

21. A constructor in Java:


A. Must have the same name as the class
B. Can have a different name than the class
C. Is used to destroy objects
D. Must return an integer value

Answer: A

22. Constructors are primarily used for:


A. Declaring variables
B. Initializing objects
C. Writing logic
D. Debugging programs

Answer: B

23. Which keyword is used to create an object in Java?


A. `class`
B. `this`
C. `new`
D. `public`

Answer: C

24. What happens if a class does not define a constructor?


A. The program will not compile
B. The JVM provides a default constructor
C. The class cannot create objects
D. All instance variables are set to `null`

Answer: B
25. In Java, floatingpoint numbers are accurate up to:
A. 7 decimal places for `float`
B. 15 decimal places for `double`
C. Both A and B
D. None of the above

Answer: C

You might also like