0% found this document useful (0 votes)
3 views3 pages

Questions

The document includes fill-in-the-blank questions, multiple-choice questions, definitions, and programming tasks related to Java programming concepts. It covers topics such as object-oriented programming, class and object differentiation, inheritance, interfaces, and Java program structure. Additionally, it contains programming exercises for practical application of Java skills.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Questions

The document includes fill-in-the-blank questions, multiple-choice questions, definitions, and programming tasks related to Java programming concepts. It covers topics such as object-oriented programming, class and object differentiation, inheritance, interfaces, and Java program structure. Additionally, it contains programming exercises for practical application of Java skills.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

📝 Fill in the Blanks

1. Java is a _______ programming language.


2. A class is a _______ of an object.
3. The keyword _______ is used to create an object in Java.
4. A constructor has the _______ as the class.
5. An interface contains only _______ methods by default.
6. The _______ keyword is used to use an interface in a class.
7. _______ means having many forms.
8. _______ binds data and methods together.
9. _______ is used for class inheritance.
10. Java supports _______ inheritance for classes.

❓ Multiple Choice Questions (MCQs)

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


a) int
b) float
c) boolean
d) String
2. What is the output of: System.out.println(3 + 4 + "A");?
a) 7A
b) 34A
c) A7
d) A34
3. Which keyword is used to inherit a class in Java?
a) implement
b) interface
c) inherit
d) extends
4. What is the size of an int in Java?
a) 2 bytes
b) 4 bytes
c) 8 bytes
d) Depends on the system
5. Which of these can an interface contain?
a) Constructors
b) Static blocks
c) Abstract methods
d) All of the above
6. Which of the following access modifiers makes a member accessible within the same
package only?
a) private
b) public
c) protected
d) default

7. What is the default value of a boolean variable in Java?


a) true
b) false
c) 0
d) null

8. How many interfaces can a Java class implement?


a) Only one
b) Two
c) Multiple
d) None

9. Which method is automatically called when an object is created?


a) finalize()
b) start()
c) constructor
d) init()

10. Which of the following is used to achieve abstraction in Java?


a) Class
b) Interface
c) Object
d) Package

✍️Define the Following

1. Class
2. Object
3. Constructor
4. Inheritance
5. Interface
📘 Answer the Following (5 or 10 Marks)

1. Explain the basic structure of a Java program with an example.


2. What is object-oriented programming? Explain its features with examples.
3. Differentiate between class and object in Java.
4. Explain constructor and its types with an example.
5. What is inheritance? Explain single and multilevel inheritance with examples.
6. What is an interface? How is it different from an abstract class?
7. Write a Java program to demonstrate the use of an interface.
8. Explain polymorphism in Java with examples.
9. Describe encapsulation with a suitable Java example.
10. Explain the concept of abstraction and how it is implemented in Java.

Programming Questions

1. Write a program to find the length (number of digits) of a given number.


2. Write a program to check whether a number is prime or not.
3. Write a program to find the average of elements in an array.
4. Write a program to find the number of trailing zeroes in the factorial of a number.
5. Write a program to find the maximum element in an array.
6. Write a program to find the first non-repeating character in a string.
7. Write a program to perform binary search on a sorted array.
8. Write a program to sort an array using bubble sort algorithm.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy