Kamal Java Paper6
Kamal Java Paper6
compiles successfully
Choice b
produces wrong output
Choice c
abnormal termination
Choice d
All of the above
[28] In Java, which Exception type is caused by an attempt to access a nonexistent file
Choice a
FileNotFoundException
Choice b
IOException
Choice c
InvalidFileException
Choice d
IOException
[27] In Multithreaded programming, which method is used to transfer control to another
thread of equal priority before its turn comes
Choice a
yield()
Choice b
resume()
Choice c
wait()
Choice d
notify()
[26] To create a package what is the first statement included?
Choice a
import java.aw+.*;
Choice b
package
Choice c
public
Choice d
Class
}
Choice a
Single Inheritance
Choice b
Multilevel Inheritance
Choice c
Multiple Inheritance
Choice d
Hierarchical Inheritance
[23] What keyword is used to inherit an interface
Choice a
extends
Choice b
implements
Choice c
inherits
Choice d
Contains
[22] Which String method is used to compare 2 strings considering any case
Choice a
equals
Choice b
equalto
Choice c
equalsIgnoreCase
Choice d
equalscase()
[21] Which of the following is possible using Vector class
Choice a
It is used to store objects
Choice b
It can store objects that may vary in size
Choice c
It is possible to add & delete
Choice d
All of Three
[20] In method declaration statements, which of the following is optional
Choice a
Method name
Choice b
Return type, Parameter list and body of method
Choice c
Parameter list
Choice d
Body of the method
[19] Which of the following form of Inheritance one dervied class is derived from a
derived class.
Choice a
Single Inheritance
Choice b
Multilevel Inheritance
Choice c
Hierarchical Inheritance
Choice d
Multiple Inheritance
[18] An expression using operators && and || used to combine two or more relational
statement is called
Choice a
combined expression
Choice b
relational expression
Choice c
logical expression
Choice d
boolean expression
[17] Identify line numbers where logical errors occur in the following code so that
factorial of 5 is calculated.
1 class factorial
2{
3 public static void main(String args[])
4{
5 int n=0,fact=0;
6 for(int n=0;n>=1;n--)
7 fact=fact*1;
8 System.out.println(Factorial of 5 is +fact);
9}
10 }
Choice a
lines 5,6
Choice b
lines 6
Choice c
lines 7
Choice d
lines 5,6,7
[16] Which of the following portion specified in the for loop is compulsary
Choice a
initialization
Choice b
test condition
Choice c
increment
Choice d
All of the above
[15] Consider the following program code. state the output from it
class ifif
{
public static void main(String args[])
{
int x=3, y=1,z=5;
if(x>y)
{
if (z<=y)
{
System.out.println(y is greater than z);
}
else
{
System.out.println(z is greater than y);
}
System.out.println(x is greater than y);
}
else
{
if(y>z)
{
System.out.println(y is greater than z);
}
}
}
}
Choice a
z is greater than y
x is greater than y
Choice b
y is greater than z
x is greater than y
Choice c
x is greater than y
x is greater than z
Choice d
x is greater than y
z is greater than y
[14] What will be the output of the following code segment
n=5;
r=n%3;
if (r == 0)
System.out.println(zero);
else
if (r ==1)
System.out.println(one);
else
if (r == 2)
System.out.println(two);
else
System.out.println(three);
Choice a
zero
Choice b
one
Choice c
two
Choice d
Three
[13] Which of the following is True with respect to branching statements if & switch
Choice a
every if statement can be written using switch
Choice b
every switch statement must have a default case
Choice c
every case must end with a break statement
Choice d
every case label follows with a(:) colon
[12] 3. What is the result if the code of statements are executed
int result = (2*(5-8)*(5-5)+10)*2;
Choice a
8
Choice b
20
Choice c
14
Choice d
0
[11] What is the value of the expression a<b||b<a if a is 2 and b is 1
Choice a
1
Choice b
2
Choice c
0
Choice d
TRUE
[10] What is the value of the expression Math.floor(1.567)
Choice a
1.6
Choice b
1
Choice c
2
Choice d
1.5
[9] Which of the following is NOT one of the classification of Java variables
Choice a
Instance variables
Choice b
block variables
Choice c
class variables
Choice d
local variables
[8] Which of the following is a primitive Data type in Java
Choice a
Character
Choice b
Classes
Choice c
Arrays
Choice d
Interface
[7] What will be the output of the following code, if executed with command line
arguments as follows
java cmdline Java is wonderful
class cmdline
{
public static void main(String args[])
{
for(int i=1;i<args.length;i++)
{
System.out.print(args[i]);
if(i!=args.length)
System.out.print( );
}
System.out.println();
}
}
Choice a
Java
Choice b
Java is
Choice c
is wonderful
Choice d
cmdline Java is wonderful
[6] Which of the following is a Java keyword
Choice a
String
Choice b
super
Choice c
Mod
Choice d
Exception
[5] Which of the following is NOT a Java keyword
Choice a
throws
Choice b
try
Choice c
while
Choice d
Exception
[4] Which of the following feature of C++ is NOT supported by Java and is therefore
implemented using interfaces
Choice a
Nested Classes
Choice b
Inner Classes
Choice c
Polymorphism
Choice d
Multiple Inheritance
[3] Java is Platform-independent, What statement explain this feature
Choice a
Java programs can be easily moved from one computer system to another
Choice b
Java systems verify memory access and virus
Choice c
Java can be used to create applications on the networks
Choice d
It provides many safeguards to ensure reliable code
[2] In OOP approach programs are divided into
Choice a
Objects
Choice b
Methods
Choice c
Functions
Choice d
Procedures
[1] OOP treats what as a critical element in program development and does not allow it to
flow freely around the system.
Choice a
Procedures
Choice b
Action
Choice c
Data
Choice d
Method