0% found this document useful (0 votes)
21 views32 pages

Introduction To Java Questions Answers - My CS Tutorial

Uploaded by

harpreetpannu712
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)
21 views32 pages

Introduction To Java Questions Answers - My CS Tutorial

Uploaded by

harpreetpannu712
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/ 32

Introduction to Java Questions Answers


/ Class 12 Information Technology 802, Java Question Answer / By mycstutorial / March 17,
2023

Class 12 Information Technology Code 802

Introduction to Java – Important Question Answer

Que 1. What is Computer Program?

Answer: A computer program is a sequence of instructions given


to the computer in order to accomplish a specific task. The
:
instructions tell the computer what to do and how to do it.

Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Que 2. Give the example of five high-level programming


languages.

Answer: Java, C++, Python, Ruby or Scala.

Que 3. Which language does a computer understand?

Answer: Machine Language

Que 4. What is a Compiler?

Answer: Compiler is a language processor which translates high-


level language to machine language code that a computer can
understand.

Que 5. What is Java?

Answer: Java is a High-Level Object Oriented programming


language and has been used widely to create various types of
:
computer applications such as database applications, desktop
applications, Web-based applications, mobile applications, and
games among others.

Boston Institute
of Analytics

Learn From Experienced Industry


Professionals

BIA

Learn More

Que 6. What is Java Compiler?

Answer: A Java compiler that translates Java Source Code into


Java Bytecode (a highly optimized set of instructions). Like other
language compilers (c, c++), it does not translate Java code to
machine language code.

Que 7. What is Java Interpreter / JVM?

Answer: Java Interpreter is known as JVM (Java Virtual Machine).


Java Interpreter translates the Java bytecode into to the
respective machine code as per the operating system and then
executes it.
:
Que 8. What is the need of JVM? [SQP]

Answer: When the bytecode (also called a Java class file) is to be


run on a computer, a Java interpreter, called the Java Virtual
Machine (JVM), translates the bytecode into machine code and
then executes it.

Que 9. Why java is platform independent and portable? [CBSE


2018]

Answer: The advantage of JVM is that once a programmer has


compiled a Java program into bytecode, it can be run on any
platform (say Windows, Linux, or Mac) as long as it has a JVM
running on it. This makes Java programs platform independent
and highly portable.

Que 10. Write the full from of IDE? What is IDE?

Answer: IDE stands for Integrated Development Environment.


IDE is an integrated development environment, which combines
the text editor and java compiler. It simplifying writing, compiling
and executing java programs.
:
Boston Institute
of Analytics

Learn From Experienced Industry


Professionals

BIA

Learn More

Que 11. Give one example of IDE.

Answer: Java NetBeans IDE.

Que 12. Write the extension of Java source code and java
bytecode file.

Answer: Java Source Code: – .java ; Java bytecode (class file) :-


.class

Que 13. What is comment? How many ways you write


comment in java?

Answer: Comments are non-executable statement, are used in


code to document the program. Especially useful for writing the
purpose of the program, so that anyone can understand it.

Comments are used for enhancing the readability of code and


are ignored by the compiler when compiling a file.
:
You can write comments in a Java program in the following two
ways:

(a) Beginning a comment line with two consecutive forward


slashes (//)

(b) Writing the comment between the symbols /* and */

Que 14. How can you write single-line comments in java?

Answer: In Java single-line comment can be written by using // at


the beginning of line. For example

// is used to write a single-line comment.

// this is a single-line comment

Que 15. How can you write multiline comments in java


program?

Answer: In Java, the multi-line comment can be written by /* …..


*/. You need to start the comment by /* and end by */.

For example:

/* This is an

example of

a multiline comment. */
:
Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Que 16. What is package?

Answer: A package in java is a group of related classes. All


classes in a package can share their data and code. Package
declaration statement is the first statement in the java program.

package MyJavaProgram ;

Que 17. Why main() is special method of java?

Answer: main() function is very important component of java


application program, because the execution of program is always
started from the main() function.

Que 18. Which function is used to print the statement?

Answer: println() and print() function of java is use to print the


message and value of variable.
:
Que 19. Di"erentiate between System.out.print( ) and
System.out.println().

Answer: System.out.print() is print the message and leave the


cursor in the same line, while System.out.println() is print the
message and move the cursor to the next line.

Que 20. Which symbol is used in jave at the end of the


statement?

Answer: The semicolon ; at the end of the statement. All Java


statements must end with a semicolon.

Que 21. ________ translates the byte code into machine code
and then executes it. [SQP]

Answer: Java Virtual Machine (JVM)

Que 22. _______________ is a special method that every Java


application must have. [SQP]

a. Getter b. Setter c. Main d. Default

Answer: Main
:
Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Que 23. Define JVM. [SQP]

Answer: Java Virtual Machine (JVM), translates the bytecode into


machine code and then executes it.

Que 24. What are comment entries in Java? Mention two


ways to give comments. [SQP]

Answer: Comments are used in code by programmers to


document their programs – to provide explanatory notes to other
people who read the code. This is especially useful in the real
world, where large programs are written by one programmer and
maintained by other programmers.

Beginning a comment line with two consecutive forward slashes


(//)

Writing the comment between the symbols /* and */


:
Que 25. Why Java program is platform independent? [SQP}

Answer: A Java compiler instead of translating Java code to


machine language code, translates it into Java Bytecode. A Java
interpreter, called the Java Virtual Machine (JVM), translates the
bytecode into machine code and then executes it. The bytecode
can be run on any platform as long as it has a JVM running on it.
This makes Java programs platform independent and highly
portable. (keywords bytecodes and JVM to be included)

Que 26. How can you write multiline comments in java


program? [SQP]

Answer: Writing the comment between the symbols /* and */

Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Que 27. Why main is a special method in the java program?


:
[SQP]

Answer: Main is a special method that every Java application


must have. When you run a program, the statements in the main
method are the first to be executed

Que 28. Why a Compiler is needed?

Answer: As you are already aware, a computer only understands


its own language called “machine language”. Therefore, a
compiler is needed to translate high level program code into
machine language code that will be understood by the computer.

Que 29. Why we need to compile a program on every


platform like Windows or Mac before execution of Program?

Answer: All platform/OS (windows, Mac) has di"erent instruction


sets, compiler is always generating the executable code as per
platform. So it is required to compile every program before
execution on each platform separately.

Que 30. What is the extension of Java Program File?

Answer: .java

Que 31. What is the extension of Java Bytecode File or Class


File?

Answer: .class
:
Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Que 32. What is method?

Answer: A method is a group of statements written to perform a


specific task. The method body is enclosed within a pair of curly
braces and contains the statements that the method will execute.

Que 33. What is the error in the given statement?

SystemOUT.println(“Hello world”);

Answer: OUT must be ‘out’, and a dot (.) will come between
System and out. The correct code is –

System.out.pirntln(“Hello World”);

Que 34. What is the error in the given statement?

System.out.println(“Hello world”)

Answer: Missing of semicolon at the end of the statement.


:
In java every statement must be terminated with semicolon. The
correct code is –

System.out.pirntln(“Hello World”);

Que 35. What is the error in the given statement?

System.out.printl(‘Hello world’)

Answer: (i) printl() is not a valid function name, it should be


println(), to print the line and move the cursor to the new line.

(ii) Single quote ‘’ is used for character constant, So Hello World


must be enclosed with double quotes. “”.

System.out.pirntln(“Hello World”);

Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Que 36. Is Java a case sensitive language? Justify your


answer. [CBSE 2019]
:
Answer: Yes, Java is a case sensitive language.

In java, ‘A’ and ‘a’ both values are treated as di"erent because
both have di"erent ASCII / UNICODE value.

Que 37. Write any three applications where java is used.


[CBSE 2017 COMPT]

Answer: Three applications are – Database applications, Desktop


applications,

Web based applications, Mobile applications, and Games, etc.

Que 38. Java programs are [CBSE 2017]

(a) Faster than others

(b) Platform independent

(c) Not reusable

(d) Not scalable

Answer: (b) Platform independent

Que 39. Java has its origin in [CBSE 2017]

(a) C programming language

(b) PEARL

(c) COBOL

(d) Oak programming language

Answer: (a) C Programming language


:
Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Que 40. Which one of the following statements is true for


Java ? [CBSE 2017]

(a) Java is object oriented and interpreted.

(b) Java is e#cient and faster than C.

(c) Java is the choice of everyone.

(d) Java is not robust.

Answer: (a) Java is object oriented and interpreted.

Que 41. OOP features are [CBSE 2017]

1. Increasing productivity

2. Reusability

3. Decreasing maintenance cost


:
4. High vulnerability

(a) 1, 2 and 4 only

(b) 1, 2 and 3 only

(c) 2, 3 and 4 only

(d) None of the above

Answer: (b) 1, 2 and 3 only

Que 42. A byte code in Java is _________.

(i) Another name for Java source file that contains the information
about the hardware.

(ii) A binary code that is generated by JVM for operating system.

(iii) An intermediate code generated by Java compiler for JVM.

(iv) None of these

Answer: (iii) An intermediate code generated by Java compiler for


JVM.

Que 43. Expand IDE. Name any one open source IDE for
writing Java programs.

Answer: IDE stands for Integrated Development Environment.

Open Source IDE for writing Java Program – NetBeans, Eclipse,


IntelliJ IDEA, Code::Blocks, etc.
:
Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Que 44. Write any four best features of Java. [CBSE 2019
COMPT]

Answer: Four best features of Java are: –

(a) Simple

(b) High Level Object Oriented Programming Language

(c) Highly Portable

(d) Platform Independent

(e) Secured Language

(f) Architectural Neutral

(g) Robust
:
Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Previous Post

Next Post

Related Posts
:
Class 12 Information Technology 802 Term 1 2021-22
Examination Question Paper with Answer Key
Class 12 Information Technology 802 / By mycstutorial

Class 12 IT 802 Unit 3 Fundamentals of Java – Important


Questions Answers
Class 12 Information Technology 802, Java Question Answer / By mycstutorial

Class 12 Information Technology Code 802 Important


Questions Answers
Class 12 Information Technology 802 / By mycstutorial
:
Class 12 Information Technology 802 Term 2 2021-22 Board
Examination Question Paper with Answer Key
Class 12 Information Technology 802 / By mycstutorial

Class 12 IT 802 Unit 1 : Database Concepts – Basics of RDBMS


Question Answer
Class 12 Information Technology 802 / By mycstutorial
:
Class 12 IT 802 Unit 1: Database Concepts – SQL Table Creation
and Manipulation Commands Question Answer
Class 12 Information Technology 802 / By mycstutorial

Class 12 IT 802 Unit 1 Database concepts NCERT Book solution


Class 12 Information Technology 802, Class 12 Information Technology 802 NCERT Book
Solution / By mycstutorial
:
Class 12 IT 802 Unit 3 Fundamentals of Java Programming
NCERT Book solution
Class 12 Information Technology 802, Class 12 Information Technology 802 NCERT Book
Solution / By mycstutorial

Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Recent Posts

Class 9 Employability Skills Unit 2 Self-Management Skills NCERT Book Solution

Class 10 Employability Skills Unit 5 – Green Skills II NCERT Book Solution

Class 10 Employability Skills Unit 4 – Entrepreneurial Skills II NCERT Book Solution

Class 10 Employability Skills Unit 3 Information and Communication Technology (ICT) Skills II
NCERT Book Solution
:
Class 10 Employability Skills Unit 2 Self-management Skills II NCERT Book Solution

Limited Seats
Choose the right digital
marketing course for yourself.… Apply Now
pages.iide.co

Categories

About Us (3)

Artificial Intelligence (11)

Cascading Style Sheets CSS (1)

CBSE (10)

CBSE 2021-22 Sample Paper and Marking Scheme (8)

CBSE Class 10 Artificial Intelligence Question Bank (5)

Class 10 Digital Documentation (6)

Class 10 Digital Documentation Que Ans (6)

Class 10 Electronic Spreadsheet Advanced (4)

Class 10 Electronic Spreadsheets Que Ans (3)

Class 10 Employability Skills (17)


:
Class 10 Employability Skills NCERT Solution (5)

Class 10 Employability Skills Question Bank (2)

Class 10 Info Tech 402 MCQ's (12)

Class 10 Info Tech NCERT Solution (4)

Class 10 Info Tech Term 1 Sample Paper (1)

Class 10 Info. Tech. [402] (32)

Class 10 Information Technology Code 402 Notes (4)

Class 10 RDBMS (10)

Class 10 Unit 1 Introduction to Artificial Intelligence (1)

Class 10 Unit 7 Evaluation (1)

Class 10 Web Application and Security (13)

Class 11 Communication Skills III (1)

Class 11 Computer Science NCERT Solution (12)

Class 11 Computer Science Notes (16)

Class 11 Employability Skills (2)

Class 11 Informatics Practices – Notes (7)

Class 11 Informatics Practices NCERT Solution (9)

Class 12 Artificial Intelligence (1)

Class 12 CBSE Practical File (2)

Class 12 Computer Science NCERT Solution (10)

Class 12 Computer Science Notes (18)

Class 12 Computer Science Quiz (2)

Class 12 Employability Skills (5)

Class 12 Informatics Practices (2)

Class 12 Informatics Practices – Notes (14)

Class 12 Informatics Practices CBSE Sample Paper (1)

Class 12 Informatics Practices NCERT Solution (6)

Class 12 Informatics Practices Term 1 MCQS (4)

Class 12 Information Technology 802 (17)


:
Class 12 Information Technology 802 NCERT Book Solution (3)

Class 12 Unit 1 Communication Skills IV (1)

Class 12 Unit 2 Self Management Skills IV (1)

Class 12 Unit 3 ICT Skills IV (1)

Class 12 Unit 4 Entrepreneurial Skills IV (1)

Class 12 Unit 5 Green Skills IV (1)

Class 9 Communication Skills (3)

Class 9 Employability Skills (11)

Class 9 Employability Skills NCERT Solution (2)

Class 9 Entrepreneurship Skills (2)

Class 9 Green Skills (2)

Class 9 ICT Skills (2)

Class 9 Info Tech 402 (6)

Class 9 Information Technology 402 NCERT Solution (5)

Class 9 Self Management Skills (2)

Class 9 Unit 1 Introduction to Artificial Intelligence (1)

Class 9 Unit 3 Digital Documentation (1)

Communication Skills II (2)

Computer Application [165] (25)

Computer Network (7)

Computer Science (29)

CTET (4)

Cyber Ethics MCQ's (5)

Cyber ethics Que n Ans (1)

Daily Current A!airs (27)

Daily News Headlines (19)

Data Visualization Matplotlib MCQs (4)

Employability Skills (2)

Entrepreneurial Skills II (2)


:
General Knowledge (4)

General Knowledge in Hindi (5)

Green Skills – II (2)

HTML – I Que n Ans (2)

HTML – II Que n Ans (4)

HTML MCQ's (17)

ICT Quiz (6)

ICT Skills – II (1)

Info Tech CBSE Sample Paper (3)

Info Tech Term 2 Sample Paper (2)

Informatics Practices (24)

Information Technology (4)

IT 802 CBSE Sample Question Paper (1)

Java Question Answer (7)

Natural Language Processing (3)

Networking Que n Ans (4)

Practical File (2)

Project (2)

Python Basics Programs (1)

Python File Handling MCQs (9)

Python Functions MCQs (6)

Python Pandas – I (1)

Python Pandas MCQs (3)

Python Pandas Project (1)

Python Programs (3)

Python Project (2)

Python Revision Tour MCQs (2)

Quiz (2)

Sample Paper (11)


:
Self Management Skills II (2)

Societal Impacts MCQ's (10)

Syllabus of Computer Science (5)

Syllabus of Info. Tech. (2)

Syllabus of Informatics Practices (6)

Teacher's Eligibility Test (4)

Uncategorized (10)

Unit 1 Introduction to IT-ITeS Industry (1)

Unit 4 Work Integrated Learning IT DMA QnA (1)

SEARCH
Search … 
:
Recent Comments

Archives

May 2023

April 2023

March 2023

February 2023

January 2023

December 2022

November 2022

October 2022

September 2022

August 2022

July 2022

June 2022

May 2022

April 2022

March 2022

February 2022

January 2022

December 2021

November 2021

October 2021

September 2021

August 2021
:
June 2021

May 2021

March 2021

February 2021

January 2021

Meta

Log in

Entries feed

Comments feed

WordPress.org
:
Join Our Community
Enter your email address to register to our newsletter subscription delivered on regular
basis!

MyCSTutorial is working for free education for all. We are try to provide educational aids
free of cost, study material, sample papers and so many other things also.

Our only moto to help the students without any trouble or cost.

Follow Us    
:
CBSE Popular Links

 CBSE Curriculum 2022-23

 Class 12 SQP & MS 2022-23

 Class 10 SQP & MS 2022-23

 9 to 12 CBSE Study Material Links 22-23

 CBSE Class 10 Question Bank 21-22

 CBSE Class 12 Question Bank 21-22

 CBSE Term-2 Question Bank 21-22 (KVS Raipur)

 CBSE Term-1 Question Bank 21-22 (KVS Raipur)

 CBSE Term-1 Question Bank 21-22 (KVS Hyd)

Quick Links

 Computer Science

 Informatics Practices

 Information Technology

 Artificial Intelligence

 Computer Application 165

Contact Info

Phone
+91 8221909045

Email
[email protected]
:
COPYRIGHT © 2023 MY CS TUTORIAL
POWERED BY ANJEEV SINGH
:

You might also like