By Mukul Sinha
JAVA BASICS
(I.C.S.E EXAM 2025) - Computer Applications
Multiple Choice Questions:- (Section Q1 20 Marks)
Topic : Object Oriented Programming
Topic: Revision of Class IX :
1. Introduction of Class and Object:(Revision of Class IX)
Points to remember:-
1. Classes are user-defined data types that act as the blueprint for individual objects, attributes and methods.
2. Objects are instances of a class created with specifically defined data.
3. Objects can correspond to real-world objects or an abstract entity.
4. When class is defined initially, the description is the only object that is defined.
5. Methods are functions that objects can perform.
6. They are defined inside a class that describe the behaviors of an object.
7. Each method contained in class definitions starts with a reference to an instance object.
8. Additionally, the subroutines contained in an object are called instance methods.
9. Programmers use methods for reusability or keeping functionality encapsulated inside one object at a time.
10. Attributes represent the state of an object.
11. In other words, they are the characteristics that distinguish classes.
12. Objects have data stored in the attributes field.
13. Class attributes belong to the class itself and are defined in the class template.
14. Encapsulation. The encapsulation principle states that all important information is contained inside an object and only select information is exposed.
15. The implementation and state of each object are privately held inside a defined class.
16. Other objects do not have access to this class or the authority to make changes.
17. They are only able to call a list of public functions or methods.
18. This characteristic of data hiding provides greater program security and avoids unintended data corruption.
19. Abstraction. Objects only reveal internal mechanisms that are relevant for the use of other objects, hiding any unnecessary implementation code.
20. The derived class can have its functionality extended.
21. This concept can help developers more easily make additional changes or additions over time.
22. Inheritance : Classes can reuse code and properties from other classes.
23. Relationships and subclasses between objects can be assigned, enabling developers to reuse common logic, while still maintaining a unique hierarchy.
24. Inheritance forces more thorough data analysis, reduces development time and ensures a higher level of accuracy.
25. Polymorphism. Objects are designed to share behaviors, and they can take on more than one form.
26. The program determines which meaning or usage is necessary for each execution of that object from a parent class, reducing the need to duplicate code.
27. A child class is then created, which extends the functionality of the parent class.
28. Polymorphism enables different types of objects to pass through the same interface.
Multiple Choice Questions:-
1. In procedural Oriented Programming paradigm where a complex
programming problem into its smaller problems using ________.
(a) Procedural Oriented Programming (b) Object Oriented Programming
(c) Structural Programming (d) None of these.
Ans:- (b) Object Oriented Programming
2. Principles of Object Oreinted Programming are Polymorphism, Abstraction, Encapsulation and_______ .
(a) Procedural Oriented Programming (b) Object Oriented Programming
(c) Inheritance (d) None of these.
Ans:- (c) Inheritance
3. ______ is an act of representing essential feature without including the background details.
(a) Abstraction (b) Inheritance
(c) Polymorphism (d) None of these.
Ans:- (a) Abstraction
4. ______ is a powerful mechanism by which a class acquires the properties of another class. It allows a class to use the attributes and behaviour of its parent class. .
(a) Abstraction (b) Inheritance
(c) Polymorphism (d) None of these.
Ans:- (b) Inheritance.
5. __________ is a n ability of a method or an object to take on multiple forms. In Oops _______ allows an operation to exhibits different behaviour in diffferent instances.
(a) Abstraction (b) Inheritance
(c) Polymorphism (d) None of these.
Ans:- (c) Polymorphism
6. __________ is a represents data(attributes) fof multiple object with similar features. A lion giraffe and cow all belong to the Animal class. Similarly mango, apple, and orange all belongs to Fruit class> .
(a) Abstraction (b) Inheritance
(c) Polymorphism (d) None of these.
Ans:- (c) Polymorphism
7. Classes that derives from previous class are________.
(a) super class (b) sub class
(c) both a and b (d) None of these.
Ans:- (b) sub class
8. The concept tht implements - a super class and a sub class. [ICSE 2024]
(a) Abstraction (b) Inheritance
(c) Polymorphism (d) None of these.
Ans:- (b) Inheritance.
9. The concept tht implements - the act of representing essential features without including backgroud details.[ICSE 2024]
(a) Abstraction (b) Inheritance
(c) Polymorphism (d) None of these.
Ans:- (b) Abstraction.
10. Assertion(A): Static methods can access static and instance variable. [ICSE 2024]
Reason(R): Static variable can be accessed only by static methods.
(a) Assertion and Reason both are true (b) Assertion is true and Reason is false
(c) Assertion is false and Reason is true (d) Assertion and Reason both are false.
Ans:- (d) Assertion and Reason both are false.
Reason:- Static methods ca access only the static variables. It does not access or change the instance variable. Static variable can be accessed by both instance and static methods.
Topic: Revision of Class IX :
2. Introduction to Java(Revision of Class IX)
Points to remember:-
Some other things to know about Java:
a. Java was invented in 1991 by James Gosling of Sun Microsystems
b. The original name for Java was Oak, but it was later changed to Green, then Java Coffee, and finally to Java in 1995
c. Java is free to download for personal use and development
d. Java is the world's third most popular programming language, after Python and C
e. Java emphasizes exception handling and type safety to prevent errors and make code more robust
f. Java has a garbage collector that automatically frees up memory that is no longer being used
Java is a programming language and computing platform that's used to create many applications, including:
Smartphone operating systems
* Enterprise software
* Mobile apps
* Big data applications
* Server-side technologies
* Web applications
* Games
Why Java?
1. Java is a popular choice for developers because it's:
2. Multiplatform: Runs on billions of devices worldwide
3.Object-oriented: Based on the C and C++ languages
4. Fast, secure, and reliable: A platform for coding a wide range of applications
5. "Write once, run anywhere": The primary goal of Java was to be able to run on any device
Multiple Choice Questions:-
1. Which language does CPU understand?
(a) Machine Language (b) High-Level Language
(c) Assembly Language (d) English Language.
Ans:- (a) Machine Langauge.
2. Stand alone java applications ____________ for execution.
(a) needs java compiler web browser (b) donot need needs java compiler web browser
(c) needs assembler (d) need a linker..
Ans:- (b) donot need needs java compiler web browser.
3. The full for of JRE is
(a) Java Run Time Editor (b) Java Run Time Expression
(c) Java Run Time Environment (d) Java Run Time Enabler.
Ans:- (c) Java Run Time Environment
4.Java uses _________________ for execution.
(a) Compilatin and Interpretation (b) compilation only
(c) interpreatation only (d) None of these
Ans:- (a) Compilatin and Interpretation.
5. A program that translates code written in-a high-level language into machine code is called _______________.
(a) Assembler (b) Colpiler
(c) Linker (d) None of these
Ans:- (c) Compiler.
6. Java can be used to write ______________.
(a) stand-alone application only (b) internet application only
(c) Both stand-alone application and internet application (d) All of these
Ans:- (b) Both stand-alone application and internet application.
7. Java applications runs on ______________.
(a) Windows platform (b) UNIX platform
(c) Machintosh (d) All of these.
Ans:- (d) All of these.
8. Java application ________________.
(a) are platform dependent (b) are platform independent
(c) does not need a platform to run (d) cannot run Windows.
Ans:- (c) does not need a platform to run
(a) a void method (b) a main method
(c) an overoaded method (d) no method.
Ans:- (c) an overoaded method
A. Applet can be executed in a web browser only
B. Applet can be executed in an applet viewer only
C. Applet can be executed in both web browser and applet viewer.
D.Applet canot be executed
Ans:- (C) Applet can be executed in both web browser and applet viewer.
Topic: Revision of Class IX :
3. Values and Types.(Revision of Class IX)
Points to remember:-
float x=10.5F;
dlouble x=10.5383F;
1. Java uses_______ charcter sets.
(a) ASCI only (c) Unicode
(b) Extended ASCII Only (d) None of these..
Ans:- (c) Unicode
(a) Token (c) Keywords
(b) Identifier (d) methods.
Ans:- (a) Token
3. Which of the following is not a token:-
(a) Operators (c) Keywords
(b) Identifier (d) Procedures
Ans:- (d) Procedures
4. Operator in Java. (Revision of Class IX)
Points to remember:-
Operators
1. Operators in Java are the symbols used for performing specific operations in Java.
2. Operators make tasks like addition, multiplication, etc which look easy although the implementation of these tasks is quite complex.
3. Operators are the building blocks of Java expressions, allowing you to perform calculations, comparisons, and more.
6. Unary operators need only one operand. They are used to increment, decrement, or negate a value.
(i) – : Unary minus, used for negating the values.
(ii) + : Unary plus indicates the positive value (numbers are positive without this, however). It performs an automatic conversion to int when the type of its operand is the byte, char, or short. This is called unary numeric promotion.
(iii) ++ : Increment operator, used for incrementing the value by 1. There are two varieties of increment operators.
(iv) Post-Increment: Value is first used for computing the result and then incremented.
(v) Pre-Increment: Value is incremented first, and then the result is computed.
(vi) – – : Decrement operator, used for decrementing the value by 1. There are two varieties of decrement operators.
(vii) Post-decrement: Value is first used for computing the result and then decremented.
(viii) Pre-Decrement: The value is decremented first, and then the result is computed.
(ix) ! : Logical not operator, used for inverting a boolean value.
7. Assignment Operator
‘=’ Assignment operator is used to assign a value to any variable. It has right-to-left associativity, i.e. value given on the right-hand side of the operator is assigned to the variable on the left, and therefore right-hand side value must be declared before using it or should be a constant.
int x=10;
+=, for adding the left operand with the right operand and then assigning it to the variable on the left.
Ex:-
int x=10;
int x+=5;
System.out.println(x);
Output
x=10+5=15
-=, for subtracting the right operand from the left operand and then assigning it to the variable on the left.
Ex:-
int x=10;
int x-=5;
System.out.println(x);
Output
x=10-5=5
*=, for multiplying the left operand with the right operand and then assigning it to the variable on the left.
Ex:-
int x=10;
int x*=5;
System.out.println(x);
Output
x=10*5=50
/=, for dividing the left operand by the right operand and then assigning it to the variable on the left.
Ex:-
int x=10;
int x/=5;
System.out.println(x);
Output
x=10/5=2
%=, for assigning the modulo of the left operand by the right operand and then assigning it to the variable on the left.
Ex:-
int x=10;
int x%=5;
System.out.println(x);
Output
x=10%5=0
8. Relational Operators: These operators are used to check for relations like equality, greater than, and less than. They return boolean results after the comparison and are extensively used in looping statements as well as conditional if-else statements. The general format is
.
5. Inputs in Java. (Revision of Class IX)
Points to remember:-
1. Buffered Reader Class BufferedReader class is used to read text from a character-input stream efficiently. It provides buffering, which significantly improves the performance of reading operations compared to reading directly from the underlying stream.
Syntax for creating object of Buffered Reader Class
Buffered Reader br=new Buffered Reader(new InputStreamReader(System.in));
Example of Buffered Reader class
import java.io;
class Main {
public static void main(String[] args) {
Buffered Reader br=new Buffered Reader(new InputStreamReader(System.in));
System.out.println("Enter name, age and salary:");
// String input
String name = String.valueOf(br.readLine());
// Numerical input
int age = Integer.parseInt(br.readLine());
double salary =Double.parseDouble(br.readLine());
// Output input by user
System.out.println("Name: " + name);
System.out.println("Age: " + age);
System.out.println("Salary: " + salary);
}
}
2. Scanner Class Scanner class helps to take the standard input stream in Java.
Syntax for creating object of Scanner class
Scanner sc=new Scanner(System.in);
Example of Scanner class
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner myObj = new Scanner(System.in);
System.out.println("Enter name, age and salary:");
// String input
String name = myObj.nextLine();
// Numerical input
int age = myObj.nextInt();
double salary = myObj.nextDouble();
// Output input by user
System.out.println("Name: " + name);
System.out.println("Age: " + age);
System.out.println("Salary: " + salary);
}
}
Method Description
nextBoolean() - Reads a boolean value from the user
nextByte() - Reads a byte value from the user
nextDouble() - Reads a double value from the user
nextFloat() - Reads a float value from the user
nextInt() - Reads a int value from the user
nextLine() - Reads a String value from the user
nextLong() - Reads a long value from the user
nextShort() - Reads a short value from the user
6. Mathematical Library Methods (Revision of Class IX)
Mathematical Library Mathods
1. abs() - To find the absolute value of an argument
Ex. int x=Math.abs(-1); // +1 is the output
2. floor() - To find the round of the argument with most value
Ex. int x=Math.floor(3.4); //3 is the output
3. ceil() - To find the round of the argument with least value
Ex. int x=Math.ceil(3.4); //4 is the output
4. pow() - To find the absolute value of an argument
Ex. int x=Math.pow(2,4); //2x2x2x2=16 is the output
5. singnum() - To find the sin number value of an argument
Ex. int x=Math.signum(2, -1); // -2 is the output
6. round() - To find the round value of an argument
Ex. int x=Math.round(3.4533); //3 is the output
7. max() - To find the max value of an argument
Ex. int x=Math.max(2,3); // 3 is maximum
8. min() - To find the min value of an argument
Ex. int x=Math.min(-1,3); // -1 is minimum
9. sqrt() - To find the square root value of an argument
Ex. int x=Math.sqrt(3); // square root of 3 is 1.732
10.cbrt() - To find the cube root value of an argument
Ex. int x=Math.cbrt(8); // cube root of 8 is 2
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
7. Conditional Constructs in Java (Revision of Class IX)
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
8. Iterative Constructs in Java.(Revision of Class IX)
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
9. Nested for Loop (Revision of Class IX)
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Chapter 2: Classes as the Basis of All Computations
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Chapter 3: User - defined Methods
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Chapter 4: Constructors
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Chapter 5: Library Classes
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Chapter 6: Encapsulations
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Chapter 7: Array
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Chapter 8: String Handling
Points to remember:-
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
No comments:
Post a Comment