0% found this document useful (0 votes)
3 views

Class 10th Ch.1 Part v(a) Introduction to Java

This document serves as a revision guide for Class 10 students covering the basics of Java programming, including key concepts such as the Java Virtual Machine (JVM), byte code, packages, and output statements. It includes questions and answers, multiple-choice questions, fill-in-the-blanks, and short answer sections to reinforce understanding of Java syntax and features. Additionally, it highlights the significance of Java's platform independence and case sensitivity.

Uploaded by

adizz9191
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 views

Class 10th Ch.1 Part v(a) Introduction to Java

This document serves as a revision guide for Class 10 students covering the basics of Java programming, including key concepts such as the Java Virtual Machine (JVM), byte code, packages, and output statements. It includes questions and answers, multiple-choice questions, fill-in-the-blanks, and short answer sections to reinforce understanding of Java syntax and features. Additionally, it highlights the significance of Java's platform independence and case sensitivity.

Uploaded by

adizz9191
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/ 6

CLASS 10TH

CH.1 REVISION OF CLASS IX SYLLABUS


PART V(a): Introduction to java
REVIEW INSIGHT

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


Ans: BlueJ

Q.2 What is another name of Java Interpreter?


Ans: JVM (Java Virtual Machine)

Q.3 What does the term ‘Language processor’ mean?


Ans: Language processor is the term used for translators such as compiler, interpreter, etc.

Q.4 Name the person who developed Java language.


Ans: James Gosling

Q.5 Define the term of byte coding.


Ans: Java compiler converts source code to an intermediate binary code. This code helps
generate machine code and is known as byte code.

Q.6 What is meant by a package? Name any two Java applications programming interface
packages.
Ans: Packages contains logically related classes together. Each Package define a number of
classes which can be used in the program by importing a single package.
Two Java Applications Programming interface packages are:
i. Java.io
ii. Java.util

Q.7 Name the package that contains the following classes


i. BufferedReader ii. Scanner
Ans: i. java.io.* ii. Java.util.*

Q.8 Name any two library packages.


Ans: i. java.io.* ii. Java.util.*

Q.9 Write a statement in Java to display:


Best of luck
for
ICSE 2020 Examination
Ans: System.out.println(“Best of luck”)
System.out.println(“for”)
System.out.println(“ICSE 2020 Examination”)

Q.10 Given: System.out.println(“BEST”);


System.out.println(“OF LUCK”);
Choose the correct option for the output of the above statement
i. BEST OF LUCK
ii. BEST
OF LUCK
Ans: i. BEST OF LUCK

Q.11 How does the byte code get executed?


Ans: Java byte code is converted to machine code with the help of Java interpreter and gets
executed on computer.

Q.12 Write two feature of Java language


Ans: i. Java language is platform independent.
ii.Java language is case sensitive

Q.13 Assertion and Reasoning based Question:


Assertion(A): Java statement written in lowercase letter or uppercase letter are treated as the
same .
Reason(R): Java is a Case sensitive Language.
Based on the above discussion, choose the correct an appropriate statement from the option
given below :
a. Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation of
Assertion (A).
b. Both Assertion (A) and Reason (R) are true and Reason (R) is the not correct explanation of
Assertion (A).
c. Assertion (A) is true and Reason (R) is false.
d. Assertion (A) is false and Reason (R) is true.

Q.14 Case Study based question:


Read the following case study and answer the question given below by choosing the correct
option:
Java compilation is different from the compilation of the other high level languages . Other high
level languages use interpreter or compiler but in java , the source code is first compiled to
produced an intermediate code called byte code . Byte code is platform independent and is a
highly optimized set of instruction designed to be executed by the Java run-time system, called
JVM (Java Virtual Machine) . JVM is a Java interpreter loaded in the computer memory as soon as
Java is loaded . JVM is different for different platform .

a.Full form of JVM is ________________.


i. Java Visual Machine. ii. Joint Vision Mechanism
iii. Java Virtual Machine iv. Java virtual Mechanism

b. JAVA code is ………………… .


i. Compiled and Interpreted ii. Only Compiled
iii. Only Interpreted iv. Translated

c. JAVA source code is compiled to produce ……………………. .


i. Object code ii. Byte code
iii. Final code iv. Machine code

d.JVM is an / a ……………………… .
i. Interpreter ii. Compiler
iii. Intermediate code iv. High level Language

EXERSISE
Q.1 Multiple choice question
1.
Source Program Compiler Object Program
From the above illustration , which of the following roles best describe for a compiler in Java
programming?
a. Language Changer b. Language Modifier
c.Language Transformer d. Language Translator

2. A java program developed and executed by the user without using web browser is known as:
a. Application b. Applet c. Object d. none of these

3. Who developed Java?


Ans: a. James Gosling

4. Java Virtual Machine (JVM) is:


Ans: a. Interpreter

5. Java is a case sensitive language . Which is the most appropriate statement with the respect
to this content?
Ans: a. Uppercase and Lowercase letters are distinguished

6. Which of the following packages is needed to find the square root of a number?
Ans: b. java.math

7. Which of the following is not a Java reserved word?


Ans: d. total
8. The keyword used to call package in the program:
Ans: c. import

9. The code obtained after compilation is known as:


Ans: d. java byte code

10. Read the following text and choose the correct answer:
BlueJ version is a menu driven approach for the java programming. It allows the user to carry out
different tasks by clicking the options available on the menu bar.
Ans: a. It is a Window based platform.

Q.2 Fill in the blanks


1. The initial name of Java was Oak.
2. Compiler converts source code to byte code.
3. JVM is used to convert Byte code into machine code.
4. Java is platform independent language.
5. Windows based Java platform is known as BlueJ.
6. Reserved words are also called Keywords.
7. java.lang package is used for mathematical functions in Java.
8. The program code written in any high-level language to solve a problem is source code.

Q.3 Predict the output of the following snippets:


1. System.out.println("My name is ");
System.out.print("Kunal Kishore");
System.out.println("I am a student of Class X");
Answer
My name is
Kunal KishoreI am a student of Class X

2. System.out.println("This is my first Java program");


System.out.print("Display the message:");
System.out.print("Have fun!!!");
Answer
This is my first Java program
Display the message:Have fun!!!

3. System.out.println("India got independence");


System.out.println("on");
System.out.println("15th August,1947");
Answer
India got independence
on
15th August,1947

4. System.out.print("The factorial of 5 is");


System.out.println("120");
Answer
The factorial of 5 is120

5. System.out.println(“A picture is worth \t \ “A thousand words.\” ”);


Answer
A picture is worth "A thousand words."
Working
\t is the escape sequence for tab. \" is used to print quotes as part of the string.
Q.4 Write short answer:
1. What is meant by a package? Give an example.
Answer
In Java, a package is used to group related classes. Packages are of 2 types:
1. Built-In packages — These are provided by Java API
2. User-Defined packages — These are created by the programmers to efficiently structure
their code.
java.util, java.lang are a couple of examples of built-in packages.

2. Name a Java package, which is imported by default.


Answer
java.lang

3.Write a package that is used for input / output operations in Java.


Answer
java.io is used for input/output operation in Java.

4.Explain the significance of the following Java library packages.


a. java.util
b. java.io
c. java.lang
Answer
(a) java.util — The java.util package in Java is crucial for providing a wide array of utility classes
and interfaces
(b) java.io — It contains the classes that handle fundamental input and output operations in Java.
(c) java.lang — The java.lang package is the cornerstone of the Java language, providing
fundamental classes that are essential for writing and running Java applications.

5.a. Java interpreter is called Java Virtual machine. Explain.


Answer
Java Virtual Machine takes Bytecode as input and converts it into Machine Code one line at a
time. This Bytecode can be generated by compiling source code written in any JVM language like
Scala, Kotlin, etc not just Java. Hence, Java interpreter is called Java Virtual Machine.

5.b. Name two ways of writing Java programs.


Answer
Two ways of writing Java programs are:
1. Java Application
2. Java Applet

6.a. Define the term Source code


Answer
A set of statements written in a High-Level programming language like Java, C++, Python, etc. is
called as Source Code.

6.b. Define the term Machine code


Answer
Machine code is a low-level programming language. Instructions in machine code are written as
a sequence of 0s and 1s. It is directly understood and executed by the processor.

6.c. Define the term Byte code


Answer
Java compiler converts Java source code into an intermediate binary code called Bytecode.
Bytecode can't be executed directly on the processor. It needs to be converted into Machine
Code first.

7. What is BlueJ? What are the features of BlueJ?


Answer
BlueJ is an integrated development environment for Java. It was created for teaching Object
Oriented programming to computer science students. Features of BlueJ are:
1. Simple beginner friendly graphical user interface.
2. It allows creating objects of the class dynamically, invoking their methods and also
supplying data to the method arguments if present.
3. It supports syntax highlighting. (Syntax highlighting means showing the different tokens of
the program like keywords, variables, separators, etc. in different colours so that they
show up more clearly.)
4. It facilitates easier debugging as lines causing compilation errors are marked clearly and
the error is displayed at the bottom of the window.
5. It provides a code editor, compiler and debugger integrated into a single tool.

8. Write down the syntax of output statement in Java programming with an example
Answer
We commonly use two output statements in Java. There syntax are:
1. System.out.println(<output value>); — This statement prints data on the console. The
data to be printed is passed to the println method as a String. After printing the string, it
places the cursor at the start of the next line. So the next printing happens at the start of
the next line.
2. System.out.print(<output value>); — This statement also prints data on the console. The
data to be printed is passed to the print method as a String. After printing the string, the
cursor remains on the same line at the end of the printed string. So the next printing
starts in the same line just after the end of the previous printed string.
As an example, the below statements will generate the following output:
System.out.println("JVM stands for");
System.out.print("Java ");
System.out.print("Virtual ");
System.out.print("Machine");
Output
JVM stands for
Java Virtual Machine

9. What do you meant by Java reserved words? Name at least five Java reserved words
which are commonly used in Java programming.
Answer
In Java, a reserved word is a word that has a predefined meaning in the language. Due to this,
reserved words can’t be used as names for variables, methods, classes or any other identifier.
Reserved words are also known as keywords. Five commonly used Java reserved words are:
1. public
2. class
3. int
4. double
5. char

10. Differentiate between the output statements System.out.println() and


System.out.print().
Answer

System.out.println() System.out.print()

It prints data to the console and places It prints data to the console but the cursor
the cursor in the next line. remains at the end of the data in the same line.

Next printing takes place from next


Next printing takes place from the same line.
line.

11. A Java program uses Compiler as well as Interpreter. Explain.


Answer
Java compiler compiles Java source code to Bytecode. Bytecode cannot run on the processor
directly as processor only understands Machine Code. Java Virtual Machine (JVM) takes this
Bytecode as input and converts it into Machine Code line by line. So, JVM acts as an interpreter
for converting Bytecode to Machine Code. In this way, a Java program uses both a Compiler as
well as an Interpreter to get executed on the processor.
s

You might also like