Sie sind auf Seite 1von 8

[1] Dynamic binding is associated with

Choice a

Polymorphism

Choice b

Inheritance

Choice c

Both Option1 and Option2

Choice d

Neither Option1 and Option2

[2] Which of the following is NOT True with respect to OOP


Choice a

Upgrading systems is difficult

Choice b

Multiple objects co-exists without any interference

Choice c

Secure Programs can be built

Choice d

Software development is made easy

[3] API stands for


Choice a

Applet
Program
Internet

Choice b

Application
Package
Information

Choice c

Abstract
Programmin
g Interface

Choice d

Application
Programmin
g Interface

[4] Which of the following feature in C is NOT included in


Java
Choice a

Break
statement

Choice b

Continue
statement

Choice c

Pointer type

Choice d

Primitive
data types

[5] Which of the following is essential part of a Java Program


Choice a

Packet statement

Choice b

Import statement

Choice c

Class definitions

Choice d

Main method class

[6] What is the right method of specifying the main method in Java
Choic
ea

private main (String args[])

Choic
eb

public static int main(String args[])

Choic
ec

public static void main (String args[])

Choic
ed

public void static main (String args[])

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();
}
}

[7]

Choic
ea

Java

Choic
eb

Java is

Choic
ec

is wonderful

Choic
ed

cmdline Java is wonderful

[8] Which of the following it NOT a valid character constant


Choice a

Choice b

Choice c

Choice d

[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

[10] What is the value of the expression abs(1)


Choice a

Choice b

-1

Choice c

Choice d

11

[11] What will be the value of b if a=2 and given the expression b=a++;
Choice a

Choice b

Choice c

Choice d

[12] What is the value of result if the code of statements are executed
int result = 42+45-48-5-15+20*2;
Choice a

59

Choice b

68

Choice c

146

Choice d

134

[13] Which of the following statements do not fall in selection statement category
Choice a
Choice b
Choice c
Choice d

if statement
switch statement
conditional operator statement
for construct statement

[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

[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);
}
}
}

}
Choi
ce a

z is greater than y
x is greater than y

Choi
ce b

y is greater than z
x is greater than y

Choi
ce c

x is greater than y
x is greater than z

Choi
ce d

x is greater than y
z is greater than y

Which of the following looping constructs body, will execute at least once even if
the condition is false.

[16]

Choice a

for

Choice b

do

Choice c

while

Choice d

none of the above.

What will be the output of the following code segment


int r=20;
while(r>0)
{
r=r-10;
if(r>0)
continue;
System.out.print("r is "+r);
}

[17]

Choice a

r is 10

Choice b

r is 0

Choice c

r is 20

Choice d

r is 20 r is 10

[18] How is it possible to make it compulsory that a method is redefined in a subclass


Choice a

By making a class private

Choice b

By making a class abstract

Choice c

By making the class final

Choice d

By making the class virtual

[19] What is valid for abstract classes and abstract methods


Choice a

We cannot use abstract classes to


instantiate objects.

Choice b

abstract methods of an abstract class

must be defined in its subclass.


Choice c

Constructers cannot be declared


abstract

Choice d

All of the above

[20] The concept of inheritance is implemented in Java by


Choice a

creating more than one class

Choice b

extending two or more classes

Choice c

extending one class and implementing


one or more interfaces

Choice d

importing classes from packages

[21] Which of the following String methods is used to give the nth character of the
string
Choice a

substring

Choice b

replace

Choice c

charAt(n)

Choice d

indexOf (n)

[22] Which of the following are similar to the Static final constants
Choice a

Annotations

Choice b

Vectors

Choice c

Enumerated types

Choice d

Object types

[23] What can interfaces contain?


Choice a

Methods

Choice b

Variables

Choice c

classes

Choice d

Both 1 & 2

[24] In the Interface definition what is TRUE for method declaration


Choice a

List of methods declaration is only done

Choice b

Method declaration as well as body

Choice c

Only one Method declaration can be done

Choice d

Only one Methods body is allowed


[25] To create a package what is the first statement included?

Choice a

import java.aw+.*;

Choice b

package

Choice c

public

Choice d

class

[26] What does the following import statement actually mean import java.awt.*;

[27]

Choice
a

import awt class from the java package

Choice
b

Import all variables from awt class

Choice
c

Import all the classes from the awt package contained in the java
package

Choice
d

Import all the classes from the java package

In Multithreaded programming, what is to be done to return the threads to runnable state


from sleep() mode
Choice
a

calling method notify()

Choice
b

calling method resume()

Choice
c

calling method start()

Choice
d

nothing but, let the specified time be elapsed

[28]

The class Exception is a subclass of which class


Choice a

Object

Choice b

Throwable

Choice c

Thread

Choice d

Throw

In Java, which Exception type is caused by general I/O failures such as unable to read
from a file

[29]

Choice a

InvalidAccessException

Choice b

InputOutputException

Choice c

InvalidFileException

Choice d

IOException

[30] Which exception may be thrown if the given code is executed giving 2 integer runtime
arguments
class sample
{
public static void main(String args[])
{
try
{
int a=Integer.parseInt(args[0]);
int b=Integer.parseInt(args[1]);
int c = a + b;
System.out.println("Sum is "+c);
}
catch(ArithmeticException ae)
{ System.out.println("Arithmetic Exception "+ae.getMessage()); }
catch(NumberFormatException ne)
{ System.out.println("Number Format Exception "+ne.getMessage()); }
catch(Exception e)
{ System.out.println("Exception "+e); }
}
}
Choi
ce a

ArithmeticException

Choi
ce b

NumberFormatException

Choi
ce c

Exception

Choi
ce d

None of the above

Das könnte Ihnen auch gefallen