NEW
Font size
WorksheetsJava
Total questions: 60
Worksheet time: 20mins
Java
programming is a ----------------
Structure
oriented programming
Object
oriented programming
a &
b
none of
the above0
In object-oriented programming, the process
by which one object acquires the properties of another obje
Encapsulation
Polymorphism
Inheritance
Dynamic
binding
What is
object?
Data & Methods
Data & object
Data & class
none of
the above
Object may be communicate --------------
Through object
Through class
Through methods
Through
data
Java program Implements ---------------
design approach
Top-up approach
bottom-up approach
a & b
none of
the above
Consider
the following Java program :
public class Compute {
public static void main (string args [ ])
{
int result, x ;
x = 1 ;
result = 0;
while (x < = 10) {
if (x%2 == 0) result + = x ;
+ + x ;
}
System.out.println(result) ;
}
}
Which of the following will be the output of the above program?
55
30
25
35
Data
Abstraction and Encapsulation is for --------------------
Data & objects
Data & Methods
Data Class
Data
& concepts
Dynamic
Binding binds------------.
Procedure methods
Procedure class
Procedure objects
Procedure
calls
Java
Message communication can support -----------------
Sending
Receiving
a & b
none of
the above
What is
application of OOP?
Real time system
Object oriented data base
CAD system
all of
the above
Which of
the following variable declaration would NOT compile in a java program?
int
var;
int VAR;
int var1;
int
1_var;.
The java
does not include ------------
variables
operators
methods
Global
variable
Which
one is java token?
Identifiers
Operators
Literals
all the
above
What is
Literal?
Characters
methods
class
object
Java
compiler javac translates Java source code into ………………………
Assembler
language
Byte
code
Machine
code
Bit
code
Which is
not operator?
Pointer
arithmetic
special
bitwise
What
will be printed as the output of the following program?
public class testincr
{
public static void main(String args[])
{
int i = 0;
i = i++ + i;
System.out.println(“I = ” +i);
}
}
I=0
I=1
I=2
Error
Which is
one of the relational operators?
<
>
==
all of the above
The
operator who also acts as a string concatenation _______
a)
/
b) *
c)
+
d) –
What is the type and value of the following expression? (Notice the integer
division)
-4 + 1/2 + 2*-3 + 5.0
int -5
double
-4.5
int
-4
double
-5.0
Literals
also called as____
Keywords
Constants
Identifiers
Operators
Java
supports two selection statements that are ____________ and __________
If and
Jump
If and
Switch
If and
while
If and
For
______ repeats a statement or block while
its controlling expression is true
jump
do-while
while
for
Use the
following declaration and initialization to evaluate the Java
expressions
int a = 2, b = 3, c = 4, d = 5;
float k = 4.3f;
System.out.println (c=c++);
2
4
5
8
Predict
the output of following Java Programs.
// filename Main.java
class Test {
protected int x, y;
}
class Main {
public static void main(String
args[]) {
Test t = new Test();
System.out.println(t.x +
" " + t.y);
}
}
1,1
1,2
0,0
Error
What is
arithmetic Expressions?
variables
constants
operator
all of the above
What is
casting a value?
expression
ratio
operator
all of the above
Consider the following Java program :
class IfStatement{
public static void main(String args[])
{
int a=2, b=3;
if (a==3)
if (b==3)
System.out.println(“===============”);
else
System.out.println(“#################”);
System.out.println(“&&&&&&&&&&&”);
}
}
Which of the following will the output be?
===============
#################
&&&&&&&&&
&&&&&&&&&&&
===============
#################
Syntax
of the class variables________
Class_name.class_variables
public
static void main (String arg [])
Class_name
object_name;
Class
name_anyRef;
Non-primitive
data type is ______
Array
interface
Class
all of the above
The
general form of constructing an array is _______
Datatype
arr-name [];
Datatype
[]arr-name;
arr-name=
new datatype[noOfElements];
arr-name.length
Which is
one of the symbol of array?
{ }
( )
[ ]
< >
Strings
represent a sequence of _____________
Variable
Character
Data type
All the above
Consider
the following class definition:
public class MyClass
{
private int value;
public void setValue(int i){ / code / }
// Other methods…
}
The method setValue assigns the value of i to the instance field value.
What could you write for the implementation of setValue?
value = i;
this.value = i;
value == i;
Both
(A) and (B) and above
JAVA
does not directly implement____________
Multiple
inheritance
Multilevel inheritance
Hybrid inheritance
Single inheritance
An
interface is basically a kind of
Method
Class
Object
Keyboard
What is
a keyword used in extending interfaces?
Extern
Extend
Extnd
extends
The
interface item would inherit both the
constants-----------------------and---------------------
Code, Variable
Code, Name
Code, Method
Extends
Predict
the output of following Java programs.
package main;
class Base {
public void Print() {
System.out.println("Base"); }
}
class Derived extends Base {
public void Print() {
System.out.println("Derived");
} }
class Main{
public static void DoPrint( Base
o ) {
o.Print();
}
public static void main(String[]
args)
{ Base x = new Base();
Base y = new Derived();
Derived z = new Derived();
DoPrint(x);
DoPrint(y);
DoPrint(z);
} }
Base,
Derived, Derived
Derived,
Derived ,Derived
Derived,
Derived, Base
None
In
Inheritance the old class is known as__________
Base class
Semi class
derived class
Semi super class
What is
a package?
Varity of classes
Varity of interfaces
a & b
None of these
Expand
API
Application
programming interface
Advanced programming interface
Architecture programming interface
Artificial programming interface
Multithreading
concept can be divided into _________
Class
Processes
Method
Object
How to
create a thread in initial stage
Over()
Start()
Run()
Stop()
How to
block the thread exceptions
Sleep()
Start()
Stop()
Run()
Applet
program are used to the ----------------
Internet computing
Cloud Computing
Grid Computing
Green Computing
An
applet developed by ---------------
Server applet
Client Applet
Local Applet
None of the above
Which is
the applet tag?
<APPLET<
<APPLET>
<APPLET?
(APPLET)
The
applet class which is contained in the ----------------package.
java.applet
java,applet
java/applet
java\applet
The
Graphics object g is an argument of -------------------------
point()
pint()
pant()
paint()
which is
one of the initialization state?
int()
init()
initial()
inti()
which is
one of the dead state?
start()
stop()
destroy()
dead()
which is
one of the display state?
start()
stop()
point()
paint()
what is
the executable applet?
.class
.object
.method
.function
What is
the concept of web page?
xml
xds
html
none of the above
How to
write the comment line in web page ?
<!...>
<?>
<*>
<&>
When the
applet is terminated _________and________ methods are called sequence
run()
and destroy()
stop()
and destroy()
run()
and stop()
none
The
graphics object requires-------------------------
paint()
pont()
math()
point()
what is
the purpose of for loops in applet?
circles
triangle
rectangle
square
which is
used for graphics object?
<g>
(g)
g.
,g
