Q.1 State the Java concept that is implemented through:

(i) A super class and a subclass: Inheritance

(ii) The act of representing essential features without including background details: Data Abstraction

Q.2 Write a Java statement to create an object mp4 of class digital.

Ans. digital mp4 = new digital();

Q.3 What does a class encapsulate?

Ans. A class encapsulates characteristics and behaviours, i.e., data members and member methods.

Q.4 What is the difference between an object and a class?

Ans. Class is a blueprint, plan, or template that creates objects, while an object is an entity containing the characteristics and behaviors defined within the class.

Q.5 What do you mean by the term 'data abstraction'? Explain with an example.

Ans. Data abstraction is representing essential features without background details. For example, driving a car only requires knowledge of controls, not the internal mechanisms.

Q.6 Why is an object called an instance of a class?

Ans. An object is called an instance of a class because it represents a specific example of the blueprint (class) when used in a program.

Q.7 Why is a class called an object factory?

Ans. A class is called an object factory because it is used to produce objects containing common attributes and behaviors.

Q.8 Why is a class known as a composite data type?

Ans. A class is a composite data type because it contains multiple predefined data types within it, and is user-defined.

Q.9 How is the concept of data hiding implemented in OOP?

Ans. Data hiding is implemented by encapsulating data members within the class, accessible only by the class methods, preventing external access.

Q.10 How are encapsulation and abstraction interrelated?

Ans. Encapsulation wraps data and methods, and abstraction uses the essential methods, both handling the encapsulated data, making them interrelated.

Q.11 Write a statement to create an object book of class library.

Ans. The syntax to create an object book of class library: library book = new library();

Q.12 What is the significance of the keyword 'new' while creating an object?

Ans. 'New' is used for dynamic memory allocation, allotting space in memory for storing an object.

Q.13 What do you mean by 'reusability feature'?

Ans. Reusability allows components of a base class to be used in derived classes through inheritance.

Q.14 How is a real-world object related to a software object?

Ans. A real-world object contains characteristics and behavior, replaced by data members and methods in a software object, making them interrelated.

Q.15 What do you mean by the statement: computer keyboard = new computer();

Ans. Keyboard is an object belonging to the class computer.

Q.16 Name the OOP principle that uses a function for multiple operations.

Ans. Polymorphism is the principle that uses a function for multiple operations.

Q.17 Differentiate between static and dynamic binding.

Ans. Static binding links a function at compile time, while dynamic binding links it at runtime.

Q.18 What is meant by a package? Name any two Java application programming interface packages.

Ans. Java application programming interface package is a set of various classes where each class internally contains different functions for specific operations. Two application programming interface packages are:

1. java.io

2. java.util

Q.19 Define the term 'byte code'.

Ans. Byte code is an intermediate binary form of the Java source code that is obtained after being converted with the help of the Java compiler. This code is independent of the machine on which it is to be executed. It makes Java programs highly portable to be used on any platform.

Q.20 Name the inventor of Java. What was its hypothetical name?

Ans. Java language was developed by a team headed by James Gosling at Sun Microsystems, USA. The hypothetical name of Java was OAK.

Q.21 Write a statement in Java to produce "HAPPY RETURNS OF THE DAY".

Ans. System.out.println("HAPPY RETURNS OF THE DAY");

Q.22 Name a menu-based Java programming platform.

Ans. The menu-based Java platform is BlueJ.

Q.23 What is another name of Java Interpreter?

Ans. Another name of Java Interpreter is JVM (Java Virtual Machine).

Q.24 "Java keywords are not to be used as variable names". Why?

Ans. Java keywords are reserved words for the system and carry special meaning for the system compiler. Hence, they cannot be used as variable names as they possess a specific meaning.

Q.25 In what way is the conversion from source code to machine code in Java different from other languages?

Ans. Java uses both a compiler and an interpreter to obtain object code from source code, whereas other languages use either a compiler or an interpreter.

Q.26 Define the following:

a. Compiler - A compiler is a program that translates code written in a high-level language into machine code.

b. Assembler - An assembler is a program that translates an assembly language program into machine code.

c. Interpreter - An interpreter translates the source code instructions into machine code line-by-line.

Q.27 Name two types of Java programs.

Ans. Stand-alone Applications and Applets

Q.28 What is the machine language of the Java Virtual Machine?

Ans. The machine language of the Java Virtual Machine is Bytecode.

Q.29 What are Java applets?

Ans. Java applets are Java applications that run within a web browser. They are mainly used for internet programming. The applet is capable of performing many tasks on a web page, such as displaying graphics, playing sounds, and accepting user input.

Q.30 Define the following:

a. Source code - A set of instructions written in a high-level programming language is called source code.

b. Object code - The compiler-generated machine language version of the source code is called object code.

Q.31 Define the term Bytecode.

Ans. The programs written in Java are compiled into a machine language for a virtual computer called Java Virtual Machine (JVM). The machine language for this special Java Virtual Machine is called Java Bytecode. The Bytecode files are generated with the ".class" extension.

Q.32 What are Stand-alone Java Applications?

Ans. A stand-alone Java application refers to a Java program that can run independently on a computer. Acrobat Reader is an excellent example of this type of application. In Java, every stand-alone application begins its execution with the main() method. Java stand-alone applications can be classified into two types:

a. Console-based applications

b. Graphical User Interface-based applications

Q.33 What is a JVM?

Ans. JVM stands for the Java Virtual Machine. A JVM is a virtual machine that runs Java programs. It can be installed on several different operating systems, such as Windows, UNIX, and Macintosh. JVMs allow Java programs to run on almost any computer. The JVM processes instructions in the same way as a physical processor. However, the Java code (with ".java" extension) must first be converted into Bytecode that the JVM understands.

Q.34 What is the role of Just-In-Time (JIT) compiler?

Ans. The JIT compiler compiles selected portions of the Bytecode into executable code to improve the execution performance.

Q.35 Suppose you create a class named CoolClass in a file. What name should the file have?

Ans. CoolClass.java

Q.36 Suppose you compile the class CoolClass. What will be the name of the Bytecode file?

Ans. CoolClass.class

Q.37 When you compile a program written in Java, the compiler converts it into platform-independent code that a Java Virtual Machine can understand. What is this platform-independent code called?

Ans. The platform-independent code is called the Java class file.

Q.38 While declaring the main method, which keyword comes first, public or class?

Ans. While declaring the main method, the keyword public comes first.

Find it difficult?

Don’t lose heart, don’t be under confident, just be consistent in your preparation and be sure of everything you’ve studied. You can request a class so that we can help you understant this topic.

Feel Confident?

Your first step in learning any new topic is to be aware of your strengths and weaknesses. Once you know this, your self-preparation can be meaningful and result-oriented. Attempt an quiz to get tested.