Download Java question bank for students and more Study Guides, Projects, Research Java Programming in PDF only on Docsity!
Question Bank should be prepared based on the Outcome Based Education (OBE). The faculty has to mention the particulars of course outcome, level of Revised Blooms Taxonomy,
PART – A (1 Marks)
(Minimum of 20 Questions in each Unit of type MCQ, True or False or open question type, no maximum limit)
Unit – I
S.No Question with options Answer Course Outcome
Revised Blooms Taxonomy Level (High / Low)
Cognitive Level
- (^) ____________ initiated the Java language James Gosling, Mike Sheridan, and Patrick Naughton
CO1 High Evaluating
- (^) Java is a __________ and object-oriented programming
language.
high level, robust, secured
CO1 High Identifying
(^3) Any hardware or software environment in which a program
runs, is known as a ___________.
platform CO1 High Determining
(^4) __________ is also known as desktop application or window-based application.
Standalone application CO1 High Evaluating
(^5) AWT and Swing are used in java for creating ________ standalone applications (^) CO1 High Creating
(^6) Java has its own runtime environment (JRE) and API, it is
called _________
platform CO1 Low Identifying
(^7) An application that runs on the server side and creates
dynamic page, is called ______
web application CO1 Low Identifying
(^8) _________ technologies are used for creating web
applications in java.
Servlet CO1 High Understandi ng
(^9) An application that is created for _______ devices. mobile CO1 Low Identifying
10 JVM (Java Virtual Machine) is an _________ machine. abstract CO1 Low Analysing
(^11) Currently __________ are used for creating mobile
applications.
Android and Java ME CO1 High Evaluating
(^12) Java doesn't support ____________. Operator overloading. CO1 High Analysing
13 JVM is a specification that provides runtime
environment in which java ___________ can be executed
bytecode CO1 High Applying
14 What is the output of the program?
public class Simple{
public static void main(String args[]){
System.out.println("hello javatpoint");
Output:
hello javatpoint
CO1 Low Rememberin g
(^15) ________ contains the address of the Java virtual machine
instruction currently being executed.
PC (program counter) register
CO1 High Evaluating
16 Give an abbreviation of JIT Just-In-Time. CO1 High Creating
24 What is the general form of cast? (type_name) expression CO2 Low Understandi
ng
25 Write general form of simple if statement. if(test expression)
Statement block:
} statement – x;
CO2 Low Rememberin g
26 Which of the following can be operands of arithmetic
operators?
a)Numeric b)Boolean
c)Characters d) Both Numeric & Characters
d CO2 Low Understandi
ng
27 Decrement operator, −−, decreases value of variable
by what number?
a) 1
b) 2
c) 3
d) 4
a (^) CO2 Low Applying
28 Which data type value is returned by all transcendental
math functions?
a) int
b) float
c) double
d) long
C (^) CO2 High Creating
29 Which of these values can a boolean variable contain?
a) True & False
b) 0 & 1
c) Any integer value
d) true
A (^) CO2 High Analysing
30 Which of these can not be used for a variable name in
Java?
a) identifier
b) keyword
c) identifier & keyword
d) None of the mentioned
b (^) CO2 Low Understanding
31 If an expression contains double, int, float, long, then
whole expression will promoted into which of these
data types?
a) long
b) int
c) double
d) float
c (^) CO2 Low Applying
32 Which of these is an incorrect Statement?
a) It is necessary to use new operator to initialize an
array.
b) Array can be initialized using comma separated
expressions surrounded by curly braces.
c) Array can be initialized when they are declared.
d) None of the mentioned
a (^) CO2 Low Applying
33 Which of these is necessary to specify at time of array
initialization?
a) Row b) Column
c) Both Row and Column d) None
a (^) CO2 Low Applying
34 Which of these is not a bitwise operator?
a) & b) &= c) |= d) <=
d (^) CO2 Low Applying
35 Which right shift operator preserves the sign of the
value?
a) << b) >> c) <<= d) >>=
b (^) CO2 Low Applying
(^36) What is the output of relational operators? a)Integer b)Boolean
b (^) CO2 Low Applying
42. ___________loop is used to iterate a part of the program several
times.
while CO3^ High^ Creating
43 If you pass ________ in the while loop, it will be infinitive while
loop.
true CO3 Low Understanding
44 __________ loop is used to iterate a part of the program several times. do-while CO3 Low Applying
45 In Java ________- loop is executed at least once because condition is
checked after loop body.
do-while CO3 High Creating
46 What are the are three types of for loop in java? • Simple For
Loop
Enhanced For
Loop
Loop
CO3 Low Analysing
47 Normally, ___________keywords breaks/continues the inner most
for loop only.
break and continue CO3^ Low^ Remembering
48 If you use ________, it will break inner loop only which is the
default behavior of any loop.
break bb; CO3^ High^ Analysing
49 If you use two _________in the for loop, it will be infinitive for
loop.
semicolons (;;) CO3^ Low^ Understanding
50 A _________statement allows a variable to be tested for equality
against a list of values.
switch CO3^ Low^ Remembering
51 When a ________statement is reached, the switch terminates, and
the flow of control jumps to the next line following the switch
statement.
break CO3^ Low^ Applying
52 No break is needed in the______ case. default CO3 Low Remembering
53 53.What is an Object? An entity that has state CO3 Low Applying
and behavior is known
as an object. Object is
an instance of a class.
54 Variables defined inside methods, constructors or blocks are called
__________.
local variables. CO3^ Low^ Remembering
55 In Java, the __________keyword is used to create new objects. new CO3 High Analysing
56 A class which contains the __________ keyword in its declaration is
known as abstract class.
abstract CO3^ Low^ Remembering
57 Constructor in java is a special type of method that is used to initialize
the____________.
object CO3^ Low^ Remembering
58 58.What are the rules for Creating a Constructor? 1. Constructor
name must be
same as its
class name
2. Constructor
must have no
explicit return
type
CO3 Low Understanding
59 If a class has multiple methods having same name but different in
parameters, it is known as ________________.
Method Overloading CO3 Low Applying
60 If subclass (child class) has the same method as declared in the
parent class, it is known as __________ in java.
method overriding CO3 Low Understanding
Unit – IV
class. B.Implementing Runnable interface. C.Both of the above D.None of these (^71) When a class extends the Thread class ,it should override ............ method of Thread class to start that thread.A. start() B.run() C.init() D.go()
CO4 Low Remembering
(^72) Which of the following constructor of class Thread is valid one?A.
Thread(Runnable threadOb, int priority) B.Thread(int priority) C.Thread(Runnable threadOb, String threadName) D.Thread (String threadName, int priority)
CO4 Low Understanding
(^73) A new thread begins its life cycle in the _____state A. new born B. start c. run d. begin
CO4 High Evaluating
(^74) A ______thread can enter the timed waiting state for a specified interval of time.A. dead B. newborn C. runnable d. blocked
CO4 Low Applying
(^75) A sleeping thread remains in the timed waiting state for a designated
period of time called _______A. Sleep Interval B. suspend C. idle D. resume
CO4 Low Understanding
(^76) _________ is used for creating and implementing appletsA. java.awt B. java.applet C. java.net D. java.io
CO4 High Creating
(^77) The members of an interface are always declared asA. Constant B. private C. default D.protected
CO4 High Evaluating
(^78) The ability of a language to support multithreads is referred asA.
switching B. concurrency C. process D. bonding
CO4 High Analysing
(^79) Which of the following is correct way of importing an entire package ‘pkg’?A. import pkg. B. Import pkg C. import.* D. Import pkg.*
CO4 Low Understanding
80 What is the output of this program? package pkg;
class output {
public static void main(String args[])
{ StringBuffer s1 = new StringBuffer("Hello");
CO4 High Creating
s1.setCharAt(1, x);
System.out.println(s1);
A. xello B. Xxxxx C. Hxllo D. Hexlo
Unit – V
S.No Question with options Answer Course Outcome
Revised Blooms Taxonomy Level (High / Low)
Cognitive Level
- (^) An __________ is an event, which occurs during the
execution of a program, that disrupts the normal flow of the program's instructions.
Exception CO5^ High^ Evaluating
- (^) Java ____________ is used to enclose the code that might throw an exception.
Try Block CO5^ High^ Creating
(^83) The classes that extend Runtime Exception are known as
unchecked exceptions
CO5 Low Remembering
(^84) _______ catch block is used to handle the Exception. It
must be used after the try block only.
Catch CO5^ Low^ Applying
(^85) ____________ is a block that is used to execute important
code such as closing connection, stream etc.
finally block CO5^ Low^ Understanding
(^86) _____________ is a special type of program that is embedded in the webpage to generate the dynamic content. It runs inside the browser and works at client side.
APPLET CO5^ Low^ Applying
(^87) ________________function is used to initialized the Applet. It
is invoked only once.
public void init() CO5^ High^ Creating
(^88) _____________ function is is used to destroy the Applet. It is
invoked only once.
public void destroy() CO5^ High^ Evaluating
PART – B (6 Marks)
(Minimum 10 Question from Each unit, no maximum limit)
Unit – I
S.No Questions with Answers Course Outcome
Revised Blooms Taxonomy Level (High / Low)
Cognitive Level
1. Brief history of Java?
Ans:
Java history is interesting to know. The history of java starts from
Green Team. Java team members (also known as Green Team ), initiated
a revolutionary task to develop a language for digital devices such as
set-top boxes, televisions etc.
For the green team members, it was an advance concept at that time.
But, it was suited for internet programming. Later, Java technology as
incorporated by Netscape.
Currently, Java is used in internet programming, mobile devices, games,
e-business solutions etc. There are given the major points that describes
the history of java.
1) James Gosling , Mike Sheridan , and Patrick Naughton initiated
the Java language project in June 1991. The small team of sun engineers
called Green Team.
CO1 High Evaluating
2) Originally designed for small, embedded systems in electronic
appliances like set-top boxes.
3) Firstly, it was called "Greentalk" by James Gosling and file extension
was .gt.
4) After that, it was called Oak and was developed as a part of the
Green project.
5) Why Oak? Oak is a symbol of strength and choosen as a national
tree of many countries like U.S.A., France, Germany, Romania etc.
6) In 1995, Oak was renamed as "Java" because it was already a
trademark by Oak Technologies.
2. Explain about java programming Language with example
Program?
Java is a programming language and a platform. Java is a high level,
robust, secured and object-oriented programming language.
Platform : Any hardware or software environment in which a program
runs, is known as a platform. Since Java has its own runtime
environment (JRE) and API, it is called platform.
Example:
1. class Simple{
2. public static void main(String args[]){
3. System.out.println("Hello Java");
CO1 High Creating
10. High Performance
11. Multithreaded
12. Distributed
4 Explain about Fundamentals of Object-oriented Programming
Language?
Object-oriented means we organize our software as a combination of
different types of objects that incorporates both data and behaviour.
Object-oriented programming(OOPs) is a methodology that simplify
software development and maintenance by providing some rules.
Basic concepts of OOPs are:
1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation
CO1 High Creating
5 How Java is Platform Independent Explain?
A platform is the hardware or software environment in which a program
runs.
There are two types of platforms software-based and hardware-based.
Java provides software-based platform.
The Java platform differs from most other platforms in the sense that it
is a software-based platform that runs on the top of other hardware-
based platforms. It has two components:
1. Runtime Environment
2. API(Application Programming Interface)
Java code can be run on multiple platforms e.g. Windows, Linux, Sun
Solaris, Mac/OS etc. Java code is compiled by the compiler and
converted into bytecode. This bytecode is a platform-independent code
because it can be run on multiple platforms i.e. Write Once and Run
Anywhere(WORA).
CO1 Low Applying
6 Discuss about how java is Secured?
Java is secured because:
• No explicit pointer
• Java Programs run inside virtual machine sandbox
CO1 High Evaluating
Mainly used for
C++ is mainly used for system programming.
Java is mainly used for application programming. It is widely used
in window, web-based, enterprise and mobile applications.
Goto
C++ supports goto statement.
Java doesn't support goto statement.
Multiple inheritance
C++ supports multiple inheritance.
Java doesn't support multiple inheritance through class. It can be
achieved by interfaces in java.
Operator Overloading
C++ supports operator overloading.
Java doesn't support operator overloading.
Pointers
C++ supports pointers. You can write pointer program in C++.
Java supports pointer internally. But you can't write the pointer
program in java. It means java has restricted pointer support in
java.
Compiler and Interpreter
C++ uses compiler only.
Java uses compiler and interpreter both.
Call by Value and Call by reference
C++ supports both call by value and call by reference.
Java supports call by value only. There is no call by reference in
java.
Structure and Union
C++ supports structures and unions.
Java doesn't support structures and unions.
Thread Support
C++ doesn't have built-in support for threads. It relies on third-