Java Programming
Java Programming
S. No. Questions
Explain the concept of interface. What is scope and nature of variables and
methods defined in an interface?
What is a static method? Why cant a static method use this and super? Explain
with example
Explain the concept of method overriding. Can we over-ride method within the
same class? Explain.
What are the most important features of Java? How does Java achieve platform
Marks - 10
independence?
Assignment B
Case Detail : Read the following and create appropriate java applets.
a. Create a try block that is likely to generate two types of exception and then
incorporate necessary catch block to handle them appropriately
b) Create a java applet with a button Display. On click of button it should display
Rectangle, Oval and Circle within the Applet.
1.
2.
Foreign language should display choice of foreign languages French, German and Japanese.
3.
Assignment C
Question No: 1
Which of the following expressions will produce errors upon compilation?
(A) boolean a = (boolean) 1;
(B) boolean b = (false && true);
(C) float y = 22.3;
Question No: 2
Which of the following expressions will produce errors upon compilation?
Question No: 3
The control expression in an "if" statement must be--
Question No: 4
Which of the following represent legal flow control statements?
(A) break;
(B) break();
(C) continue outer;
(D) continue(inner);
(E) return;
(F) exit();
Question No: 5
Which of the following represent legal flow control statements?
Are there any errors in the following class definition?
abstract class Class1
Question No: 6
With javadoc, which of the following denotes a javadoc comment?
/**
//#
/*
//**
Question No: 7
Which javadoc tag is used to denote a comment for a method parameter?
@param
@method
@parameter
@argument
Question No: 8
What will be the result of the expression?
a%b
when a and b are of type int and their values are a = 10 and b = 6?
1.66
1
None of these
4
Question No: 9
Determine the output when the value of x is zero--
if(x >= 0)
if(x > 0)
System.out.println("x is positive");
else
System.out.println("x is negative");
"x is negative"
"x is positive"
"x is positive" and "x is negative"
None of these
Question No: 10
Which of the following is correct syntax for an Abstract class?
Question No: 11
What is the output of following piece of code?
int x = 2;
switch (x) {
case 1:System.out.println(1);
case 2:
case 3:System.out.println(3);
case 4:
case 5:System.out.println(5);
}
No output
3&5
1, 3 & 5
3
Question No: 12
__________ converts the java program to byte code.
Java Editor
Question No: 13
What would happen if you dont include String args[] in the main method of any class?
No error
Compile error
Runtime Error
No error but goes to infinite loop
Question No: 14
JVM stands for--
Question No: 15
Java consists of a ready-made package called--
Java Program
Java Applet
Java API
Java Widgets
Question No: 16
Java Platforms consists of --
Question No: 17
Which of the following are not logical operators?
>>
&&
!
^
Question No: 18
Java was developed by--
Microsoft
Sun Microsystems
Borland
Siemens
Question No: 19
Which of the following variable is valid in Java?
variable1
variable2_n
variable=
variable 4
Question No: 20
What is the result of the following operation?
System.out.println (4 / 3)
6
0
1
7
Question No: 21
To compile a java file, path should be set to-{ c:\is the drive where jdk1.4 is installed}
c:\ jdk1.4\lib;
c:\jdk1.4\bin;
c:\jdk1.4\include;
None of the above
Question No: 22
In java ________ is the top hierarchy of the classes.
Class Name
Object
Main Method
Super Class
Question No: 23
Using the keyword_____________, we can access value of the instance variables and class variables of
that class inside the method of that class itself.
Super
this
final
Either final or this
Question No: 24
The number of arguments or the types of arguments is to be different for creating two or more methods
with the same name are in--
Inheritance
Method overloading
Method overriding
Polymorphism
Question No: 25
The keyword new will--
Question No: 26
What are the five layouts of AWT?
a) BagGridLayout
b) FlowLayout
c) GridLayout
d) BagLayout
e) GridBagLayout
f) CardLayout
g) BorderLayout
bcefg
abcde
fgeda
acbge
Question No: 27
Events do not respond to--
Physical Action
Logical Action
Astrological Action
Question No: 28
Checkbox, Menu item, and choice Lists event can be handled by --
Adjustment Listener
Item Listener
Action Listener
Text Listener
Question No: 29
Signature of the method includes--
Question No: 30
Break statement is used for--
Question No: 31
While compiling
While executing
When object is created
When class is created
Question No: 32
Expansion of DNS is--
Question No: 33
What do you mean by abstract class?
Question No: 34
This is the java syntax to declare a subclass--
Question No: 35
What tags are mandatory in HTML to display an applet?
Question No: 36
What do you mean by literal in Java?
It is a keyword in Java
All Java variables are called as literals
It is a value assigned to primitive or abstract data type variables
Literal is an object that exists and executed on the local machine
Question No: 37
What do you mean by literal in Java?
It is a keyword in Java
All Java variables are called as literals
Question No: 38
Differentiation between component and container classes in Java is--
Question No: 39
What do you mean by final method in Java?
Question No: 40
The type of Java programs are--
Applications
Applets
Servlets
Packages