0% found this document useful (0 votes)
9 views2 pages

Java Unit2 MCQ Part1

This document contains multiple-choice questions (MCQs) focused on Java's classes, objects, and methods. It covers topics such as class definitions, object creation, instance variables, and features of the object class. The questions test knowledge on Java syntax and concepts related to object-oriented programming.

Uploaded by

ummefathimx
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)
9 views2 pages

Java Unit2 MCQ Part1

This document contains multiple-choice questions (MCQs) focused on Java's classes, objects, and methods. It covers topics such as class definitions, object creation, instance variables, and features of the object class. The questions test knowledge on Java syntax and concepts related to object-oriented programming.

Uploaded by

ummefathimx
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/ 2

Java MCQs - Unit II: Classes, Objects, and Methods

Section 1: Classes, Objects, and Variables

1. Which of the following is a correct definition of a class in Java?

a) A data type

b) A template for objects

c) A memory block

d) A Java library

2. Which of these is used to create an object in Java?

a) malloc()

b) create()

c) new

d) alloc()

3. What is the correct syntax to create an object of Student class?

a) Student s = Student();

b) Student s = new Student();

c) new Student s = Student();

d) object Student = new Student();

4. Instance variables are:

a) Declared inside methods

b) Shared among all instances

c) Declared in a class but outside methods

d) Always static

5. Which of the following is NOT a valid variable type in Java?

a) local

b) global

c) instance

d) static
Java MCQs - Unit II: Classes, Objects, and Methods

6. What is true about an object in Java?

a) It is a class

b) It is always a String

c) It has state and behavior

d) It cannot be created at runtime

7. What keyword is used to refer to the current object in Java?

a) self

b) this

c) super

d) that

8. Which of the following is NOT a feature of the object class in Java?

a) clone()

b) finalize()

c) equals()

d) compile()

9. What is a container that holds a value during execution called?

a) Method

b) Object

c) Variable

d) Class

10. Which of these classes is NOT a predefined Java class?

a) Object

b) Math

c) System

d) Student

You might also like