Java
1. Why do we write programs in High Level Language?
a. Writing programs in High Level Language provides an easy and
efficient way to write a program.
2. What is a Source Code?
a. Source code is a program written in high level language.
3. How are source code executed by the computer?
a. Source code is compiled and/or interpreted by the translator to
machine language executable by the computer.
4. On the bases of approach high level languages can be classified as______
and __________.
Procedure Oriented programming and Object Oriented Programming
5. Give some examples of high level languages.
COBOL, FORTRAN, Pascal, C,C++, JAVA, ADA, LISP, Prolog
6. What is procedure oriented programming language?
Procedure Oriented programming follows a top down approach in
execution. A group of instructions is organised into functions that can be
reused. Data is accessed by the functions.
7. What is object oriented programming language?
Object Oriented programming follows a bottom up approach and is based
on the concept of objects. Objects are small segments of code that contain
functions to perform a task on a given data.
8. How is the compiler different from the interpreter?
A compiler executes the entire program at once while an interpreter
executes line by line.
9. What are the basic elements of OOP language?
Objects, classes, data abstraction, encapsulation, inheritance,
polymorphism, and data hiding
10. Draw a mind map on OOPs.
11. What is an object?
An object is the basic element of OOP that represents a real world entity.
12. What is an attribute?
Attributes are the characteristics of the class that help to distinguish it from
other classes.
13. What is the behaviour?
Behaviour is the task that an object performs.
14. What is a function?
Functions contain code to perform a given task using the data of the
object.
15. How is data and information exchanged between objects?
A set of related objects may exchange data and information through
functions.
16. What is a class?
A class is a set of similar objects.
17. What is abstraction?
Data abstraction is the process of hiding certain details and showing only
essential information to the user.
18. What is encapsulation?
Encapsulation refers to the binding of data and related functions into one
unit so as to protect them from external interference.
19. What is data hiding?
The concept of encapsulation leads to data hiding. It is the process of
creating a logical insulation between the data and the outside world.
20. What is inheritance?
Inheritance refers to the process of linking some common properties of a
class with another class.
21. What is Polymorphism?
Polymorphism refers to the ability of an object to take different forms.
22. What are the features of OOP?
23. What is the full form of JAVA?
J from James, A and V from Arthur Van and A from Andy
24. Formerly JAVA was known as_______.
Oak
25. What was the purpose behind developing JAVA?
JAVA was developed for consumer electronics.
26. Who developed Java?
JAVA was developed by James Gosling and his colleagues Arthur van Hoff
and Andy Bechtolsheim.
27. Draw a mind map depicting the features of JAVA.
28. What are the features of Java?
29. What do you understand about platform independent programming
languages?
Platform Independent programming language means a language that can
run on any processor or operating system.
30. What is bytecode?
Java source code is converted into an intermediate binary form that is
called the Bytecode.
31. What is JVM?
Java Virtual Machine also known as the Java Interpreter converts the
bytecode into the machine code to run on a particular platform or operating
system.
32. How is a Java program converted into machine code?Explain with a
diagram.
33. What do you understand about Standalone applications?
These are programs which run on the computer.
34. What do you understand from a Web application?
Web applications contain interactive web pages and require a web browser
to view the web pages.
35. What are methods?
Functions in Java are known as methods.
36. What is the unique method of a Java program called?
Main method
37. What is the syntax of the main method?
public static void main(String args[])
38. What is the use of the keyword “static”?
It indicates that the main method is invoked directly without creating an
object of the class containing the main method.
39. What is the use of the keyword “void”?
This keyword is used when the method doesn’t return any value.
40. What is the use of the keyword “public”?
It is an access specifier that specifies the method to be accessible to all
objects.
41. What is the use of the keyword “(String args[])”?
The main method accepts an array of arguments as input. The argument
contains a sequence of characters referred to as “string”.
42. What are comments?
Comments are statements that are not executed by the compiler. They
provide information about the program.
43. What are the three types of comments?
Comments are of three types:
Single Line comment
Multiline comment
Documentation comment
44. What is the output statement?
It is the statement that is used for printing.
45. What is the syntax of the output statement?
System.out.println();
46. What is “System”?
Class in java.lang package
47. What is “out”?
Instantiated object of java.io.PrintStream class
48. What is “println()”?
Method in java.io.PrintStream that can accept argument of various data
types
49. Which extension is used for saving a Java Program ?
.java
50. What is debugging?
Debugging is the process of identifying and resolving errors in a program.
51. What do you understand by the term Syntax errors?
Syntax errors occur if the rules of the programming language are not
followed in the source code.
52. What do you understand by the term runtime errors?
Runtime errors occur during the execution of the program due to certain
unexpected conditions in the program code.
53. What are logical errors?
Logical errors occur due to incorrect code or a bug in the program that
results in an unexpected result or abrupt termination of the program.
54. What is JCL?
Java Class Library provides a large library containing a set of packages
that can be loaded dynamically at runtime to be used by Java applications.
55. What is JRE?
Java Runtime Environment is a software package which includes the JVM
to run any Java program along with JCL.
56. What is JDK?
Java Development Kit is a superset of JRE and contains development
tools such as javac, a Java compiler used to convert the source code into
bytecode.
57. What is a token?
A token is the smallest meaningful element identified by a compiler in a
Java program.
58. What are literals?
Literals are syntactic representations of constant values used in Java
programs.
59. What are Identifiers?
An Identifier is a sequence of characters used to name variables, methods,
classes, packages etc.
60. What is a keyword?
Keywords in Java are predefined reserved identifiers that have a special
meaning for the compiler.
61. What are separators?
A few characters in Java are used as separators within statements.
62. What are operators?
Java provides a set of operators that are symbols to perform different
operations in programs.
63. What are constants?
Constants are values that remain fixed and do not change in the program.
64. What are variables?
Variables represent reserved memory locations containing data values.
65. What are the rules for naming a variable?
66. What do you understand by term variable declaration and variable
initialization?
Declaration of a variable in a computer programming language is a
statement used to specify the variable name and its data type.
Initialization is the process of assigning a value to the Variable.
67. What are the rules for naming an Identifier?
68. What are data types?
Allocation of memory to variables is based on the type of data they hold.
69. What is the hierarchy of data types as per the size?
70. What are primitive data types?
Primitive data types are simple, predefined data types supported in Java.
71. What are non primitive data types?Explain with examples.
Non-primitive data types are the derived data types. Eg class, array,
interface
72. How many types of primitive data types are there? Name them.
There are eight primitive data types. They are byte, short, long, int, double,
float, char, boolean.
73. Primitive data types can further be classified as _______ and
_______.
Numeric and Non numeric data types.
74. What are numeric data types?
Numeric data types deal with integers and fractional numbers and can
include both positive and negative values.
75. Numeric data types can further be classified as _______ and
_______.
Integers and Floating point
76. What are non numeric data types? Explain with examples.
Non numeric data types represent character and boolean types.
Eg: char, boolean
77. Int=______bits
32 bits
78. Long=______bits
64 bits
79. Byte=______bits
8 bits
80. Short=______bits
16 bits
81. Float=______bits
32 bits
82. Double=______bits
64 bits
83. What are Null literals?
A null value can be assigned to variables that usually refer to objects and
are not primitive data types. Integers cannot be initialised as null but an
object can be.
84. Java programs can be compiled and run in how many ways?Name
them.
A Java program can be compiled and run in two ways.
Using a command line interpreter
Using an IDE - BlueJ
85. When do we perform recompiling of the Java Code?
The program should be recompiled with every modification made to the
source code.
86. What is IDE?
IDE stands for Integrated Development environment. It is a software suite
that provides an easy to use environment with an interface for coding,
compiling and running a program.
87. Who developed BlueJ?
BlueJ was developed by Monash University.
88. Mention the purpose for developing BlueJ.
BlueJ was developed primarily for educational purposes.
89. How many types of values Boolean data type can take?
Boolean data types can take only two possible values: true or false.
90. When can we use Boolean data type?
Boolean data type can be used for decision making to store the result of a
test condition.
91. What is the output window of BlueJ IDE known as?
Terminal Window
92. Name the file created after debugging.
Object file
93. Name the dialog box that appears on clicking void main(String []
args).
Method call
94. Name a few IDE’s available for Java.
JBuilder, Netbeans, Eclipse and BlueJ
95. Java uses the ________ system to represent all the characters.
International unicode
96. Each character of International Unicode is stored using _____ bits of
memory.
16
97. Constants can be created using the following keywords.
static and final
98. The object file is interpreted by JVM and executed using the
command _______..
java
99. A class is a set of _____ and _______.
Methods and data