0% found this document useful (0 votes)
31 views92 pages

Cutm1031 JT MCQ 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views92 pages

Cutm1031 JT MCQ 6

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 92

CENTURION UNIVERSITY OF TECHNOLOGY & MANAGEMENT

ANDHRA PRADESH

EXAMINATION CELL

SUBJECT NAME: (NAME IN FULL): JAVA TECHNOLOGIES

SUBJECT CODE: CUTM1031

MODULE NO: 1
S.
NO
1 What will be the output of the following
Java code?

class increment {
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
A 32 YES
B 33
C 24
D 25
2 Which of the following is not an OOPS
concept in Java?
A Polymorphism
B Inheritance
C Compilation YES

D Encapsulation
3 An expression involving byte, int, and
literal numbers is promoted to which of
these?

A int YES

B long
C byte
D float
4 Which of the following for loops will be
an infinite loop?
A for(; ;)
B for(i=0 ; i<1; i--)
C for(i=0; ; i++)
D All of the above YES
5 What will be the output of the following
Java code?

class area {
public static void main(String args[])
{
double r, pi, a;
r = 9.8;
pi = 3.14;
a = pi * r * r;
System.out.println(a);
}
}

A 301.5656 YES
B 301
C 301.56
D 301.56560000
6 Which of these coding types is used for
data type characters in Java?
A ASCII
B ISO-LATIN-1
C UNICODE YES
D None of the mentioned
7 Which one is a valid declaration of a
boolean?
A boolean b1 = 1;
B boolean b2 = ‘false’;
C boolean b3 = false; YES
D boolean b4 = ‘true’
8 What will be the output of the following
Java program?

class mainclass {
public static void main(String args[])
{
char a = 'A';
a++;
System.out.print((int)a);
}
}
A 66 YES
B 67
C 65
D 64
9 What will be the output of the following
Java program?

class mainclass {
public static void main(String args[])
{
boolean var1 = true;
boolean var2 = false;
if (var1)
System.out.println(var1);
else
System.out.println(var2);
}
}
A 0
B 1
C true YES
D false
10 Which of these can not be used for a
variable name in Java?

A identifier
B keyword YES
C identifier & keyword
D none of the mentioned
11 What will be the output of the following
Java program?

class dynamic_initialization
{
public static void main(String args[])
{
double a, b;
a = 3.0;
b = 4.0;
double c = Math.sqrt(a * a + b
* b);
System.out.println(c);
}
}
A 5.0 YES
B 25.0
C 7.0
D Compilation Error
12 Which of these is necessary condition for
automatic type conversion in Java?
A The destination type is smaller than
source type
B The destination type is larger than YES
source type
C The destination type can be larger or
smaller than source type
D None of the mentioned
13 What is Truncation is Java?
A Floating-point value assigned to an YES
integer type
B Integer value assigned to floating
type
C Floating-point value assigned to an
Floating type
D Integer value assigned to floating
type
14 What will be the output of the following
Java code?

class char_increment
{
public static void main(String args[])
{
char c1 = 'D';
char c2 = 84;
c2++;
c1++;
System.out.println(c1 + " " + c2);
}
}
A EU YES
B UE
C VE
D UF
15 What will be the output of the following
Java program?

class increment
{
public static void main(String args[])
{
double var1 = 1 + 5;
double var2 = var1 / 4;
int var3 = 1 + 5;
int var4 = var3 / 4;
System.out.print(var2 + " " +
var4);

}
}
A 11
B 01
C 1.5 1 YES
D 1.5 1.0
16 What will be the output of the following
Java program?

class Modulus
{
public static void main(String args[])
{
double a = 25.64;
int b = 25;
a = a % 10;
b = b % 10;
System.out.println(a + " " + b);
}
}

A 5.640000000000001 5 YES

B 5.640000000000001 5.0

C 55
D 5 5.640000000000001
17 What will be the output of the following
Java program?

class Output
{
public static void main(String args[])
{
int a = 1;
int b = 2;
int c;
int d;
c = ++b;
d = a++;
c++;
b++;
++a;
System.out.println(a + " " + b + " "
+ c);
}
}

A 324

B 323
C 234
D 344 YES
18 Which of these statements are
incorrect?

A The left shift operator, <<, shifts all of


the bits in a value to the left specified
number of times
B The right shift operator, >>, shifts all of
the bits in a value to the right specified
number of times
C The left shift operator can be used as an
alternative to multiplying by 2
D The right shift operator automatically YES
fills the higher order bits with 0
19 What will be the output of the following
Java program?

class bitwise_operator
{
public static void main(String args[])
{
int a = 3;
int b = 6;
int c = a | b;
int d = a & b;
System.out.println(c + " " + d);
}
}

A 72 YES
B 77
C 75
D 52
20 Which of these is returned by “greater
than”, “less than” and “equal to”
operators?
A Integers
B Floating – point numbers
C Boolean YES
D None of the mentioned
21 Which of the following operators can
operate on a boolean variable?
1. &&
2. ==
3. ?:
4. +=
A 3&2
B 1&4
C 1, 2 & 4
D 1, 2 & 3 YES
22 Which of these operators can skip
evaluating right hand operand(skip
evaluating right hand operand when
output can be determined by left
operand alone)?

A !
B |
C &
D && YES
23 What will be the output of the following
Java code?

class bool_operator
{
public static void main(String args[])
{
boolean a = true;
boolean b = !true;
boolean c = a | b;
boolean d = a & b;
boolean e = d ? b : c;
System.out.println(d + " " + e);
}
}
A false false
B true ture
C true false
D false true YES
24 What will be the output of the following
Java code?

class ternary_operator
{
public static void main(String args[])
{
int x = 3;
int y = ~ x;
int z;
z = x > y ? x : y;
System.out.print(z);
}
}

A 0
B 1
C 3 YES
D -4
25 What will be the output of the following
Java code?

class Output
{
public static void main(String args[])
{
boolean a = true;
boolean b = false;
boolean c = a ^ b;
System.out.println(!c);
}
}

A 0
B 1
C false YES
D true
26 Which of these statements are
incorrect?
A Equal to operator has least precedence
B Brackets () have highest precedence
C Division operator, /, has higher YES
precedence than multiplication operator
D Addition operator, +, and subtraction
operator have equal precedence
27 What will be the output of the following
Java code?

class operators
{
public static void main(String args[])
{
int var1 = 5;
int var2 = 6;
int var3;
var3 = ++ var2 * var1 / var2 +
var2;
System.out.print(var3);
}
}

A 10
B 11
C 12 YES
D 56
28 Which of these lines of Java code will
give better performance?

1. a | 4 + c >> b & 7;
2. (a | ((( 4 * c ) >> b ) & 7 ))

A 1 will give better performance as it has


no parentheses
B 2 will give better performance as it has
parentheses
C Both 1 & 2 will give equal performance YES
D Dependent on the computer system
29 Which of the following loops will execute
the body of loop even when condition
controlling the loop is initially false?
A do-while YES
B while
C for
D none of the mentioned
30 Which of these jump statements can skip
processing the remainder of the code in
its body for a particular iteration?
A break
B return
C exit
D continue YES
31 What will be the output of the following
Java program?

class selection_statements
{
public static void main(String args[])
{
int var1 = 5;
int var2 = 6;
if ((var2 = 1) == var1)
System.out.print(var2);
else
System.out.print(++var2);
}
}

A 1
B 2 YES
C 3
D 4
32 What will be the output of the following
Java program?

class comma_operator
{
public static void main(String args[])
{
int sum = 0;
for (int i = 0, j = 0; i < 5 & j < 5; +
+i, j = i + 1)
sum += i;
System.out.println(sum);
}
}

A 5
B 6 YES
C 14
D compilation error
33 What will be the output of the following
Java program?
class jump_statments
{
public static void main(String args[])
{
int x = 2;
int y = 0;
for ( ; y < 10; ++y)
{
if (y % x == 0)
continue;
else if (y == 8)
break;
else
System.out.print(y + " ");
}
}
}

A 1357
B 2468
C 13579 YES
D 123456789
34 What would be the output of the
following code snippet if variable a=10?

if(a<=0)
{
if(a==0)
{
System.out.println("1 ");
}
else
{
System.out.println("2 ");
}
}
System.out.println("3 ");

A 12
B 23
C 13
D 3 YES
35 What is true about do statement?
A do statement executes the code of a YES
loop at least once
B do statement does not get execute if
condition is not matched in the first
iteration
C do statement checks the condition at the
beginning of the loop
D do statement executes the code more
than once always
36 Which of the following is not a valid flow
control statement?
A exit() YES
B Break
C Continue
D return
37 Which concept of Java is achieved by
combining methods and attribute into a
class?
A Encapsulation YES
B Inheritance
C Polymorphism
D Abstraction
38 Which component is responsible for
converting bytecode into machine
specific code?
A JVM
B JDK YES
C JIT
D JRE
39 Which component is responsible to run
java program?
A JVM
B JDK
C JIT
D JRE YES
40 What is the extension of compiled java
classes?
A .class YES
B .java
C .txt
D .js
41 What is use of interpreter?
A They convert bytecode to machine
language code
B They read high level code and execute YES
them
C They are intermediated between JIT and
JVM
D It is a synonym for JIT

42 Which of the following is a valid


declaration of an object of class Box?
A Box obj = new Box(); YES

B Box obj = new Box;

C obj = new Box();

D new Box obj;

43 Which of these operators is used to


allocate memory for an object?
A malloc

B alloc

C new YES

D give

44 What will be the output of the following


Java program?

class box
{
int width;
int height;
int length;
}
class mainclass
{
public static void main(String args[])
{
box obj = new box();
obj.width = 10;
obj.height = 2;
obj.length = 10;
int y = obj.width * obj.height *
obj.length;
System.out.print(y);
}
}
A 12

B 200 YES

C 400

D 100

45 What will be the output of the following


Java program?

class box
{
int width;
int height;
int length;
}
class mainclass
{
public static void main(String args[])
{
box obj = new box();
System.out.println(obj);
}
}

A 0

B 1

C Runtime error

D classname@hashcode in hexadecimal YES


form
46 Which of the following for loop
declaration is not valid?
A for ( int i = 99; i >= 0; i / 9 ) YES

B for ( int i = 7; i <= 77; i += 7 )

C for ( int i = 20; i >= 2; - -i )

D for ( int i = 2; i <= 20; i = 2* i )

47 What is the output of this program?

int i = 1, j = 10;
do
{ if(i > j)
{
break;
}
j--;
} while (++i < 5);
System.out.println("i = " + i + " and j = " +
j);

A i = 6 and j = 5

B i = 5 and j = 5

C i = 6 and j = 4

D i = 5 and j = 6 YES

48 What is the output of the following


program?
public class Test{

public static void main(String


[]args){
for(int i = 0; i < 10; i++){
if(i % 2 == 0){

continue;
}

System.out.println(i);
}
}
}

A Program will print all even numbers


between 0 to 10

B Program will print all odd numbers YES


between 0 to 10

C Program gives a compilation error

D None of the above

49 What is the output of the below Java


program with WHILE, BREAK and
CONTINUE?
class Xyz
{
public static void main(String args[])
{
int cnt=0;
while(true)
{
if(cnt > 4)
break;
if(cnt==0)
{
cnt++;
continue;
}
System.out.print(cnt + ",");
cnt++;
}
}
}
A 0,1,2,3,4,

B 1,2,3,4, YES

C 1,2,3,4

D Compiler error

50 What is the output of the below java


program that implements nesting of
loops?
class Xyz
{
public static void main(String args[])
{

int i=1, j=1;


while(i<3)
{
do
{
System.out.print(j + ",");
j++;
}while(j<4);
i++;
}
}
}

A 1,2,3,4,1,2,3,4,

B 1,2,3,4, YES

C 1,2,3,1,2,3,
D 1,2,3,

CENTURION UNIVERSITY OF TECHNOLOGY & MANAGEMENT

ANDHRA PRADESH

EXAMINATION CELL

SUBJECT NAME: (NAME IN FULL): JAVA TECHNOLOGIES

SUBJECT CODE: CUTM1031

MODULE NO: 2
S. MCQ
NO
1 What will be the output of the following
Java program?

import java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c =
Class.forName("java.awt.Dimension");
Field fields[] =
c.getFields();
for (int i = 0; i <
fields.length; i++)

System.out.println(fields[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}

A Program prints all the constructors of


‘java.awt.Dimension’ package

B Program prints all the methods of


‘java.awt.Dimension’ package

C Program prints all the data members of YES


‘java.awt.Dimension’ package

D program prints all the methods and data


member of ‘java.awt.Dimension’ package

2 What will be the output of the following


Java program?

import java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c =
Class.forName("java.awt.Dimension");
Constructor
constructors[] = c.getConstructors();
for (int i = 0; i <
constructors.length; i++)

System.out.println(constructors[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}

A Program prints all the constructors of YES


‘java.awt.Dimension’ package
B Program prints all the possible
constructors of class ‘Class’

C Program prints “Exception”

D Runtime Error
3 Which of this package is used for
invoking a method remotely?

A java.rmi YES

B java.awt

C java.util

D java.applet
4 Which of these class allows us to get real
time data about private and protected
member of a class?

A java.io

B GetInformation

C ReflectPermission YES

D MembersPermission
5 Which of this package is used for
handling security related issues in a
program?

A java.security YES

B java.lang.security

C java.awt.image
D java.io.security
6 Which of this package is used for
analyzing code during run-time?

A java.applet

B java.awt

C java.io

D java.lang.reflect YES
7 Which of these package is used for
graphical user interface?

A java.applet

B java.awt YES

C java.awt.image

D java.io
8 Which of these keywords is used to
define interfaces in Java?

A interface YES

B Interface

C intf

D Intf
9 Which of these can be used to fully
abstract a class from its implementation?
A Objects

B Packages

C Interfaces YES

D None of the Mentioned


10 Which of these access specifiers can be
used for an interface?

A Public YES

B Protected

C private

D All of the mentioned


11 Which of these keywords is used by a
class to use an interface defined
previously?

A import

B Import

C implements

D Implements YES
12 Which of the following is the correct way
of implementing an interface salary by
class manager?

A class manager extends salary {}


B class manager implements salary {} YES

C class manager imports salary {}

D none of the mentioned


13 Which of the following is an incorrect
statement about packages?

A Interfaces specifies what class must do


but not how it does

B Interfaces are specified public if they are


to be accessed by any code in the
program

C All variables in interface are implicitly


final and static

D All variables are static and methods are YES


public if interface is defined pubic
14 What will be the output of the following
Java program?

interface calculate
{
void cal(int item);
}
class display implements calculate
{
int x;
public void cal(int item)
{
x = item * item;
}
}
class interfaces
{
public static void main(String args[])
{
display arr = new display;
arr.x = 0;
arr.cal(2);
System.out.print(arr.x);
}
}
A 0
B 2
C 4 YES
D None of the mentioned
15 What will be the output of the following
Java program?

interface calculate
{
void cal(int item);
}
class displayA implements calculate
{
int x;
public void cal(int item)
{
x = item * item;
}
}
class displayB implements calculate
{
int x;
public void cal(int item)
{
x = item / item;
}
}
class interfaces
{
public static void main(String args[])
{
displayA arr1 = new displayA;
displayB arr2 = new displayB;
arr1.x = 0;
arr2.x = 0;
arr1.cal(2);
arr2.cal(2);
System.out.print(arr1.x + " " +
arr2.x);
}
}

A 00

B 22

C 41 YES

D 14
16 Which of the following access specifiers
can be used for an interface?

A Protected YES

B Private

C Public

D Public, protected, private


17 Which of the following is the correct way
of implementing an interface A by class
B?

A class B extends A{}

B class B implements A{} YES

C class B imports A{}

D None of the mentioned


18 What type of variable can be defined in
an interface?

A public static

B private final

C public final

D static final YES


19 What does an interface contain?

A Method definition

B Method declaration YES

C Method declaration and definition

D Method name
20 What type of methods an interface
contain by default?

A abstract YES

B static

C final

D private
21 What will happen if we provide concrete
implementation of method in interface?

A The concrete class implementing that


method need not provide
implementation of that method

B Runtime exception is thrown


C Compilation failure YES

D Method not found exception is thrown


22 What happens when a constructor is
defined for an interface?

A Compilation failure YES

B Runtime Exception

C The interface compiles successfully

D The implementing class will throw


exception
23 What happens when we access the same
variable defined in two interfaces
implemented by the same class?

A Compilation failure

B Runtime Exception

C The JVM is not able to identify the


correct variable

D The interfaceName.variableName needs YES


to be defined
24 What is the length of the application box
made in the following Java program?

import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
Graphic g;
g.drawString("A Simple
Applet",20,20);
}

A 20

B Default value

C Compilation Error YES

D Runtime Error
25 What will be the output of the following
Java program?
import java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c =
Class.forName("java.awt.Dimension");
Method methods[] =
c.getMethods();
for (int i = 0; i <
methods.length; i++)

System.out.println(methods[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}

A Program prints all the constructors of


‘java.awt.Dimension’ package

B Program prints all the methods of YES


‘java.awt.Dimension’ package

C Program prints all the data members of


‘java.awt.Dimension’ package

D program prints all the methods and data


member of ‘java.awt.Dimension’ package
26 Which of these keywords is used to by
the calling function to guard against the
exception that is thrown by called
function?

A try

B throw

C throws YES

D catch
27 Which of these class is related to all the
exceptions that are explicitly thrown?

A Error
B Exception

C Throwable YES

D Throw
28 Which of these keywords is used to
generate an exception explicitly?

A try

B finally

C throw YES

D catch
29 What exception thrown by parseInt()
method?

A ArithmeticException

B ClassNotFoundException

C NullPointerException

D NumberFormatException YES
30 Which of these handles the exception
when no catch is used?

A Default handler YES

B finally

C throw handler

D Java run time system


31 Which of these class is related to all the
exceptions that cannot be caught?

A Error YES

B Exception

C RuntimeExecption

D All of the mentioned


32 Which of these class is related to all the
exceptions that can be caught by using
catch?

A Error

B Exception YES

C RuntimeExecption

D All of the mentioned


33 Which of these is a super class of all
exceptional type classes?

A String

B RuntimeExceptions

C Throwable YES

D Cacheable
34 Which of the following should be true of
the object thrown by a thrown
statement?

A Should be assignable to String type

B Should be assignable to Exception type

C Should be assignable to Throwable type YES

D Should be assignable to Error type


35 Which part of code gets executed
whether exception is caught or not?

A finally YES

B try

C catch

D throw
36 Which of the following handles the
exception when a catch is not used?

A finally

B throw handler

C default handler YES


D java run time system
37 Which of the following keyword is used
by calling function to handle exception
thrown by called function?

A throws YES

B throw

C try

D catch
38 Which of the following operators is used
to generate instance of an exception
which can be thrown using throw?

A thrown

B alloc

C malloc

D new YES
39 Which of the following is a super class of
all exception type classes?

A Catchable

B RuntimeExceptions

C String

D Throwable YES
40 Which of the following classes can catch
all exceptions which cannot be caught?

A RuntimeException

B Error YES

C Exception

D ParentException
41 Which of the following keywords is used
for throwing exception manually?

A finally

B try

C throw YES

D catch

42 What will be the output of the following


Java program?

class exception_handling
{
public static void main(String args[])
{
try
{
int i, sum;
sum = 10;
for (i = -1; i < 3 ;++i)
sum = (sum / i);
}
catch(ArithmeticException e)
{
System.out.print("0");
}
System.out.print(sum);
}
}

A 0

B 05

C Compilation Error YES

D Runtime Error

43 What will be the output of the following


Java program?

class exception_handling
{
public static void main(String args[])
{
try
{
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e)
{
System.out.print("B");
}
finally
{
System.out.print("C");
}
}
}

A A

B B

C AC

D BC YES

44 What will be the output of the following


Java program?

class exception_handling
{
public static void main(String args[])
{
try
{
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e)
{
System.out.print("B");
}
}
}

A A

B B YES

C Compilation Error
D Runtime Error

45 What will be the output of the following


Java program?

class exception_handling
{
public static void main(String args[])
{
try
{
System.out.print("Hello" + " " +
1 / 0);
}
catch(ArithmeticException e)
{
System.out.print("World");
}
}
}

A Hello

B World YES

C HelloWorld

D Hello World

46 Which of these keywords is used to


manually throw an exception?

A try

B finally

C throw YES

D catch

47 Which of these keywords must be used


to handle the exception thrown by try
block in some rational manner?

A try

B finally

C throw
D catch YES

48 Which of these keywords must be used


to monitor for exceptions?

A try YES

B finally

C throw

D catch

49 Which of these keywords is not a part of


exception handling?

A try

B finally

C thrown YES

D catch

50 When does Exceptions in Java arises in


code sequence?

A Run Time YES

B Compilation Time

C Can Occur Any Time

D None of the mentioned

CENTURION UNIVERSITY OF TECHNOLOGY & MANAGEMENT

ANDHRA PRADESH

EXAMINATION CELL

SUBJECT NAME: (NAME IN FULL): JAVA TECHNOLOGIES

SUBJECT CODE: CUTM1031


MODULE NO: 3

S.
NO
1 Which of these class can generate an
array which can increase and decrease in
size automatically?

A ArrayList() YES
B DynamicList()

C LinkedList()

D MallocList()
2 What will be the output of the following
Java program?

import java.util.*;
class Arraylist
{
public static void main(String args[])
{
ArrayList obj = new ArrayList();
obj.add("A");
obj.add("B");
obj.add("C");
obj.add(1, "D");
System.out.println(obj);
}
}

A [A, B, C, D]

B [A, D, B, C] YES

C [A, D, C]

D [A, B, C]
3 Which of these method of ArrayList class
is used to obtain present size of an
object?

A size() YES

B length()

C index()
D capacity()
4 Which of the below does not implement
Map interface?

A HashMap

B Hashtable

C EnumMap

D Vector YES
5 What is the difference between TreeSet
and SortedSet?

A TreeSet is more efficient than SortedSet

B SortedSet is more efficient than TreeSet

C TreeSet is an interface; SortedSet is a


concrete class

D SortedSet is an interface; TreeSet is a YES


concrete class
6 Which of these classes implements Set
interface?

A ArrayList

B HashSet YES

C LinkedList

D DynamicList
7 What will be the output of the following
Java program?

import java.util.*;
class Output
{
public static void main(String args[])
{
HashSet obj = new HashSet();
obj.add("A");
obj.add("B");
obj.add("C");
System.out.println(obj + " " +
obj.size());
}
}

A ABC 3

B [A, B, C] 3 YES

C ABC 2

D [A, B, C] 2
8 What will be the output of the following
Java program?

import java.util.*;
class Output
{
public static void main(String args[])
{
TreeSet t = new TreeSet();
t.add("3");
t.add("9");
t.add("1");
t.add("4");
t.add("8");
System.out.println(t);
}
}

A [1, 3, 5, 8, 9]

B [3, 4, 1, 8, 9]

C [9, 8, 4, 3, 1]

D [1, 3, 4, 8, 9] YES
9 Which of these object stores association
between keys and values?

A Hash table

B Map YES

C Array

D String
10 Which of these classes provide
implementation of map interface?

A ArrayList

B HashMap YES

C LinkedList
D DynamicList
11 Which of these method Map class is used
to obtain an element in the map having
specified key?

A search()
B get() YES
C set()
D look()
12 What will be the output of the following
Java program?

import java.util.*;
class Maps
{
public static void main(String args[])
{
HashMap obj = new HashMap();
obj.put("A", new Integer(1));
obj.put("B", new Integer(2));
obj.put("C", new Integer(3));
System.out.println(obj.keySet());
}
}

A [A, B, C] YES

B {A, B, C}

C {1, 2, 3}

D [1, 2, 3]
13 Which of these class object can be used
to form a dynamic array?
A ArrayList

B Map

C Vector

D ArrayList & Vector YES


14 What is multithreaded programming?

A It’s a process in which two different


processes run simultaneously

B It’s a process in which two or more parts YES


of same process run simultaneously

C It’s a process in which many different


process are able to access same
information

D It’s a process in which a single process


can access information from many
sources
15 Thread priority in Java is?

A Integer YES

B Float

C double

D long
16 Which of these statements is incorrect?

A By multithreading CPU idle time is


minimized, and we can take maximum
use of it

B By multitasking CPU idle time is


minimized, and we can take maximum
use of it

C Two thread in Java can have the same


priority

D A thread can exist only in two states, YES


running and blocked
17 What will be the output of the following
Java code?

class multithreaded_programing
{
public static void main(String args[])
{
Thread t =
Thread.currentThread();
System.out.println(t);
}
}

A Thread[5,main]

B Thread[main,5]

C Thread[main,0]

D Thread[main,5,main] YES
18 What is the priority of the thread in the
following Java Program?

class multithreaded_programing
{
public static void main(String args[])
{
Thread t =
Thread.currentThread();
System.out.println(t);
}
}

A 4

B 5 YES

C 0
D 1
19 What is the name of the thread in the
following Java Program?

class multithreaded_programing
{
public static void main(String args[])
{
Thread t =
Thread.currentThread();
System.out.println(t);
}
}

A main YES

B Thread

C System

D None of the mentioned


20 Which of these method of Thread class is
used to find out the priority given to a
thread?

A get()

B ThreadPriority()

C getPriority() YES

D getThreadPriority()
21 Which of these method of Thread class is
used to Suspend a thread for a period of
time?

A sleep() YES

B terminate()

C suspend()

D stop()
22 Which function of pre defined class
Thread is used to check weather current
thread being checked is still running?

A isAlive() YES
B Join()

C isRunning()

D Alive()
23 What is the name of the thread in output
in the following Java program?

class multithreaded_programing
{
public static void main(String args[])
{
Thread t =
Thread.currentThread();
System.out.println(t.getPriority());
}
}

A 0
B 1
C 4
D 5 YES
24 What is the name of the thread in output
in the following Java program?

class multithreaded_programing
{
public static void main(String args[])
{
Thread t =
Thread.currentThread();
System.out.println(t.isAlive());
}
}

A 0
B 1
C TRUE YES
D FALSE
25 Which of these method is used to
implement Runnable interface?

A stop()

B run() YES
C runThread()

D stopThread()
26 Which of these method is used to begin
the execution of a thread?

A run()

B start() YES

C runThread()

D startThread()
27 Which of these statement is incorrect?

A A thread can be formed by implementing


Runnable interface only

B A thread can be formed by a class that


extends Thread class

C start() method is used to begin execution


of the thread

D run() method is used to begin execution YES


of a thread before start() method in
special cases
28 What will be the output of the following
Java code?

class newthread implements Runnable


{
Thread t;
newthread()
{
t = new Thread(this,"My
Thread");
t.start();
}
public void run()
{

System.out.println(t.getName());
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}

A My Thread YES

B Thread[My Thread,5,main]

C Compilation Error

D Runtime Error
29 What will be the output of the following
Java code?

class newthread implements Runnable


{
Thread t;
newthread()
{
t = new Thread(this,"New
Thread");
t.start();
}
public void run()
{

t.setPriority(Thread.MAX_PRIORITY);
System.out.println(t);
}
}
class multithreaded_programing
{
public static void main(String args[])
{
new newthread();
}
}

A Thread[New Thread,0,main]

B Thread[New Thread,1,main]

C Thread[New Thread,5,main]

D Thread[New Thread,10,main] YES


30 Which of this method can be used to
make the main thread to be executed
last among all the threads?

A stop()
B sleep() YES

C join()

D call()
31 What is the default value of priority
variable MIN_PRIORITY AND
MAX_PRIORITY?

A 0 & 256

B 0&1

C 1 & 10 YES

D 1 & 256
32 Which of these method is used to
explicitly set the priority of a thread?

A set()

B make()

C setPriority() YES

D makePriority()
33 What is synchronization in reference to a
thread?

A It’s a process of handling situations when YES


two or more threads need access to a
shared resource

B It’s a process by which many thread are


able to access same shared resource
simultaneously

C It’s a process by which a method is able


to access many different threads
simultaneously

D It’s a method that allow too many


threads to access any information
require
34 What requires less resources?

A Thread YES

B Process
C Thread and Process

D Neither Thread nor Process


35 What does not prevent JVM from
terminating?

A Process

B Daemon Thread YES

C User Thread

D JVM Thread
36 What decides thread priority?

A Process

B Process scheduler

C Thread

D Thread scheduler YES


37 What is true about threading?

A run() method calls start() method and


runs the code

B run() method creates new thread

C run() method can be called directly


without start() method being called

D start() method creates new thread and YES


calls code written in run() method
38 Which of the following is a correct
constructor for thread?

A Thread(Runnable a, String str) YES

B Thread(int priority)

C Thread(Runnable a, int priority)

D Thread(Runnable a, ThreadGroup t)
39 Which of the following will ensure the
thread will be in running state?
A yield()

B notify()

C wait() YES

D Thread.killThread()
40 Which of these keywords are used to
implement synchronization?

A synchronize

B syn

C synch

D synchronized YES
41 What is synchronization in reference to a
thread?

A It’s a process of handling situations when YES


two or more threads need access to a
shared resource

B It’s a process by which many thread are


able to access same shared resource
simultaneously

C It’s a process by which a method is able


to access many different threads
simultaneously

D It’s a method that allow too many


threads to access any information the
require
42 Which of these packages contain all the
collection classes?

A java.lang

B java.util YES

C java.net
D java.awt

43 What is Collection in Java?

A A group of objects YES

B A group of classes

C A group of interfaces

D None of the mentioned

44 Which of these interface declares core


method that all collections will have?

A set

B EventListner

C Comparator

D Collection YES

45 Which of these are types of multitasking?

A Process based

B Thread based

C Process and Thread based YES

D None of the mentioned

46 What will happen if two thread of same


priority are called to be processed
simultaneously?

A Any one will be executed first


lexographically

B Both of them will be executed


simultaneously

C None of them will be executed

D It is dependent on the operating system YES

47 Which of these statements is incorrect?


A By multithreading CPU's idle time is
minimized, and we can take maximum
use of it.

B By multitasking CPU's idle time is


minimized, and we can take maximum
use of it.

C Two thread in Java can have same


priority

D A thread can exist only in two states, YES


running and blocked.
48 Which of these method of Thread class is
used to find out the priority given to a
thread?

A get()

B ThreadPriority()

C getPriority() YES

D getThreadPriority()

49 Which of these method waits for the


thread to treminate?

A sleep()

B isAlive()

C join() YES

D stop()

50 Which of these packages contain all the


Java's built in exceptions?

A java.io

B java.util

C java.lang YES

D java.net

CENTURION UNIVERSITY OF TECHNOLOGY & MANAGEMENT


ANDHRA PRADESH

EXAMINATION CELL

SUBJECT NAME: (NAME IN FULL): JAVA TECHNOLOGIES

SUBJECT CODE: CUTM1031

MODULE NO: 4
S.
NO
1 String in Java is a?
A class YES
B object
C variable
D character array
2 Which of these method of String class is used
to obtain character at specified index?
A char()
B Charat()
C charat()
D charAt() YES
3 Which of these keywords is used to refer to
member of base class from a subclass?
A upper
B super YES
C this
D none of the mentioned
4 Which defines a method called nextElement
that is used to get the next element in a data
structure that contains multiple elements?
A Bitset
B Vector
C Stack
D Enumeration YES
5 Consider the following two statements
int x = 25;
Integer y = new Integer(33);
What is the difference between these two
statements?
A Primitive data types
B primitive data type and an object of a wrapper YES
class
C Wrapper class
D None of the above
6 Where does the primitive data type values be
stored?
A Heap Memory
B Stack Memory YES
C Both A & B
D None of the above
7 What package is a part of the wrapper class
which is imported by default into all Java
programs?
A java.lang YES
B java.aw
C java.io
D java.util
8 Which of these method of String class can be
used to test to strings for equality?
A isequal()
B isequals()
C equal()
D equals() YES
9 Which of the following statements are
incorrect?
A String is a class
B Strings in java are mutable YES
C Every string is an object of class String
D Java defines a peer class of String, called
StringBuffer, which allows string to be altered
10 What will be the output of the following Java
program?
class string_demo
{
public static void main(String args[])
{
String obj = "I" + "like" + "Java";
System.out.println(obj);
}
}
A I
B like
C Java
D IlikeJava
11 What will be the output of the following Java
program?

class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.charAt(3));
}
}
A I YES
B L
C K
D E
12 What will be the output of the following Java
program?

class string_class
{
public static void main(String args[])
{
String obj = "I LIKE JAVA";
System.out.println(obj.length());
}
}
A 9
B 10
C 11 YES
D 12
13 What will be the output of the following Java
program?

class string_class
{
public static void main(String args[])
{
String obj = "hello";
String obj1 = "world";
String obj2 = obj;
obj2 = " world";
System.out.println(obj + " " + obj2);
}
}
A hello hello
B world world
C hello world YES
D world hello
14 What will be the output of the following Java
program?

class string_class
{
public static void main(String args[])
{
String obj = "hello";
String obj1 = "world";
String obj2 = "hello";
System.out.println(obj.equals(obj1) + " "
+ obj.equals(obj2));
}
}
A false false
B true true
C true false
D false true YES
15 Where an object of a class get stored?
A Heap YES
B Stack
C Disk
D File
16 Java uses two stage system for program
execution. They are
A Compiler and instruction
B Compiler and interpreter YES
C Copy and compiler
D None
17 Garbage collection in Java is
A Unused package in a program automatically
gets deleted.
B Memory occupied by objects with no YES
reference is automatically reclaimed for
deletion.
C Java deletes all unused java files on the
system.
D The JVM cleans output of Java program.
18 In what memory area, variable temp and
variable card written in main () get stored?
class CreditCard{
int num;

public class Bank {

public static void main(String[] args) {


int temp;
CreditCard card;

}
}

A Heap, Heap
B Stack, stack YES
C Heap, Stack
D Stack, Heap
19 Which of the following has the highest
memory requirement?
A Heap
B Stack
C JVM YES
D Class
20 Where is a new object allocated memory?
A Young space
B Old space
C Young or Old space depending on space
availability
D JVM YES
21 If an error occurs during the transaction the
troubleshoot is ____________
A delete
B rollback YES
C commit
D update
22 The variable which represents the default time
zone of the MySQL server is _____________
A time_zone YES
B system_time_zone
C date_and_time
D system_time
23 What creates the appropriate DateFormat
object and adds a day to the Date object?
A 35. DateFormat df =
DateFormat.getDateFormat();
d.setTime( (60 * 60 * 24) + d.getTime());

B 35. DateFormat df = YES


DateFormat.getDateInstance();
d.setTime( (1000 * 60 * 60 * 24) +
d.getTime());
C 35. DateFormat df =
DateFormat.getDateFormat();
d.setLocalTime( (1000*60*60*24) +
d.getLocalTime());
D 35. DateFormat df =
DateFormat.getDateInstance();
d.setLocalTime( (60 * 60 * 24) +
d.getLocalTime());
24 What will be the output by following code
snippet?
System.out.printf("%d,%f",10,20.35);
A Error
B 10,20.35
C 10,20.350000 YES
D 10,20.00
25 Consider the following object declaration
statement
Scanner objectName= new
Scanner(System.in);
What is System.in in this declaration?
A Class which point input device
B Reference to Input stream YES
C Reference to Computer System
D None of these
26 Which is the correct syntax to declare Scanner
class object?
A Scanner objectName= Scanner();
B Scanner objectName= new Scanner();
C Scanner objectName= Scanner(System.in);
D Scanner objectName= new YES
Scanner(System.in);
27 Which method does not store string value
after space?
A next() YES
B nextString()
C nextLine()
D Both 1 and 3
28 Which Scanner class method is used to read
string value from the user?
A next()
B nextString()
C nextLine()
D Both 1 and 3 YES
29 Which Scanner class method is used to read
integer value from the user?
A next()
B nextInteger()
C nextInt() YES
D readInt()
30 How to get UTC time?
A Time.getUTC();
B Date.getUTC();
C Instant.now(); YES
D TimeZone.getUTC();
31 What does LocalTime represent?
A Date without time
B Time without Date YES
C Date and Time
D Date and Time with timezone
32 How is Date stored in database?
A java.sql.Date YES
B java.util.Date
C java.sql.DateTim
D java.util.DateTime
33 How to format date from one form to
another?

A SimpleDateFormat YES
B DateFormat
C SimpleFormat
D DateConverter
34 How to convert a String to a Date object?
A SimpleDateFormat sdf = new YES
SimpleDateFormat("yyyy-mm-dd");
sdf.parse(new Date());

B SimpleDateFormat sdf = new


SimpleDateFormat("yyyy-mm-dd");
sdf.format(new Date());
C SimpleDateFormat sdf = new
SimpleDateFormat("yyyy-mm-dd");
new Date().parse();
D SimpleDateFormat sdf = new
SimpleDateFormat("yyyy-mm-dd");
new Date().format();
35 How to identify if a timezone is eligible for
DayLight Saving?
A useDaylightTime() of Time class
B useDaylightTime() of Date class
C useDaylightTime() of TimeZone class YES
D useDaylightTime() of DateTime class
36
If a new object is created as an exact copy of
the existing object then it is called as _______.
A Overloading
B Overriding
C Cloning YES
D None of the above
37 Which of these classes is the superclass of
every class in Java?
A Integer
B Math
C Object YES
D Exception
38 Find the output of the below Java program?

class P {
int x = 10;
}

class Q extends P {
int y = 20;
}

class R extends Q implements Cloneable {


int z = 30;

public static void main(String[] args)


throws CloneNotSupportedException{
R r1 = new R();
R r2 = (R) r1.clone();
r1.x = 100;
r1.y = 200;
r1.z = 300;
System.out.println(r2.x+" "+r2.y+" "+r2.z);
}
}
A 100 200 300
B 10 20 30 YES
C 10 20 300
D 100 200 30
39 Find the output of the below Java program?

class Student implements Cloneable {


int id;
Student(int id) {
this.id = id;
}

public static void main(String[] args)


throws CloneNotSupportedException {
Student s1 = new Student(9);
Student s2 = (Student) s1.clone();

s1.id = 18;
System.out.println(s1.id+" "+s2.id);
}
}

A 99
B 18 9 YES
C 9 18
D 18 18
40 Find the output of the below Java program?

class Student implements Cloneable {


int id;
Student(int id) {
this.id = id;
}

public static void main(String[] args)


throws CloneNotSupportedException {
Student s1 = new Student(9);
Student s2 = s1;
s1.id = 18;
System.out.println(s1.id+" "+s2.id);
}
}
A 99
B 18 9
C 9 18
D 18 18 YES
41 Which of the following statement is true about
the Cloneable interface?

A It doesn’t contain any method. YES

B It contains only one method.

C It contains multiple methods.

D None of these

42 Which of the following statement is not


applicable for the clone() method of Object
class?
A To execute the clone() method on an object
the class must implement java.lang.Cloneable
interface.
B It is a protected method.

C It throws CloneNotSupportException.

D It is a static method. YES

43 What is the return type of clone() method in


the Object class?
A Class

B Object YES

C int

D String

44 What will be the output of the following Java


program?

class Output
{
public static void main(String args[])
{
Integer i = new Integer(257);
float x = i.floatValue();
System.out.print(x);
}
}

A 0

B 1

C 257

D 57.0 YES

45 What will be the output of the following Java


program?

class Output
{
public static void main(String args[])
{
char a[] = {'a', '5', 'A', ' '};
System.out.print(Character.isDigit(a[0])
+ " ");
System.out.print(Character.isWhitespac
e(a[3]) + " ");
System.out.print(Character.isUpperCase
(a[2]));
}
}

A true false true

B false true true YES

C true true false

D false false false

46 Which of the following is method of wrapper


Integer for converting the value of an object
into int?
A bytevalue()

B int intValue(); YES

C Bytevalue()

D Byte Bytevalue()

47 Which of these is a wrapper for simple data


type char?
A Float

B Character YES

C String

D Integer

48 Which of these is a super class of wrappers


Long, Character & Integer?
A Long

B Digits

C Float

D Number YES

49 Which of these is a wrapper for data type int?

A Integer YES

B Long

C Byte

D Double

50 The wrapper classes are part of the which


package, that is imported by default into all
Java programs?

A java.lang YES

B java.awt

C java.io

D java.util

CENTURION UNIVERSITY OF TECHNOLOGY & MANAGEMENT

ANDHRA PRADESH

EXAMINATION CELL
SUBJECT NAME: (NAME IN FULL): JAVA TECHNOLOGIES

SUBJECT CODE: CUTM1031

MODULE NO: 5

S.
NO
1 Which of these is used to perform all
input & output operations in Java?
A streams YES
B Variables
C classes
D Methods
2 Which of these is a type of stream in
Java?
A Integer stream
B Short stream
C Byte stream YES

D Long stream
3 Which of these packages contain classes
and interfaces used for input & output
operations of a program?
A java.util
B java.lang
C java.io YES
D all of the mentioned
4 Which of these class is not a member
class of java.io package?
A String YES
B StringReader
C Writer
D File
5 Which of these interface is not a
member of java.io package?
A DataInput
B ObjectInput
C ObjectFilter YES
D FileFilter
6 Which of these class is not related to
input and output stream in terms of
functioning?
A File YES
B Writer
C InputStream
D Reader
7 Which of these is specified by a File
object?
A a file in disk
B directory path
C directory in disk YES
D none of the mentioned
8 Which of these is method for testing
whether the specified element is a file
or a directory?
A IsFile()
B isFile() YES
C Isfile()
D isfile()
9 What will be the output of the following
Java code?

import java.io.*;
class files
{
public static void main(String args[])
{
File obj = new
File("/java/system");
System.out.print(obj.getName());
}
}
A java
B system YES
C java/system
D /java/system
10 Which of these class is used to read
from byte array?
A InputStream
B BufferedInputStream
C ArrayInputStream
D ByteArrayInputStream. YES
11 Which of these classes are used by Byte
streams for input and output operation?
A InputStream YES
B InputOutputStream
C Reader
D All of the mentioned
12 Which exception is thrown by read()
method?
A IOException YES
B InterruptedException
C SystemException
D SystemInputException
13 Which of these is used to read a string
from the input stream?
A get()
B getLine()
C read()
D readLine() YES
14 Which of these class is used to read
characters and strings in Java from
console?
A BufferedReader YES
B StringReader
C BufferedStreamReader
D InputStreamReader
15 Which of these classes are used by
character streams for input and output
operations?
A InputStream
B Writer YES
C ReadStream
D InputOutputStream
16 Which of these class is used to read
from byte array?
A InputStream
B BufferedInputStream
C ArrayInputStream
D ByteArrayInputStream YES
17 What will be the output of the following
Java program if input given is
‘abcqfghqbcd’?

class Input_Output
{
public static void main(String args[])
throws IOException
{
char c;
BufferedReader obj = new
BufferedReader(new
InputStreamReader(System.in));
do
{
c = (char) obj.read();
System.out.print(c);
} while(c != 'q');
}
}
A abcqfgh
B abc
C abcq YES
D abcqfghq
18 What will be the output of the following
Java program?

class output
{
public static void main(String args[])
{
StringBuffer c = new
StringBuffer("Hello");
System.out.println(c.length());
}
}
A 4
B 5 YES
C 6
D 7
19 Which of these stream contains the
classes which can work on character
stream?

A InputStream
B OutputStream
C Character Stream YES
D All of the mentioned
20 Which of these class is used to read
characters in a file?

A FileReader YES

B FileWriter
C FileInputStream
D InputStreamReader
21 Which of these method of FileReader
class is used to read characters from a
file?
A read() YES
B scanf()
C get()
D getInteger()
22 Which of these class can be used to
implement the input stream that uses a
character array as the source?
A BufferedReader
B FileReader
C CharArrayReader YES
D FileArrayReader
23 Which of the following is not a segment
of memory in java?
A Stack Segment
B Heap Segment
C Code Segment
D Register Segment YES
24 What is JVM?
A Bootstrap
B Interpreter YES
C Extension
D Compiler
25 Which of these is a method to clear all
the data present in output buffers?
A clear()
B flush() YES
C fflush()
D close()
26 Which of these method(s) is/are used
for writing bytes to an outputstream?
A put()
B print() and write() YES
C printf()
D write() and read()
27 What will be the output of the following
Java program? (Note: inputoutput.java
is stored in the disk.)

import java.io.*;
class filesinputoutput
{
public static void main(String args[])
{
InputStream obj = new
FileInputStream("inputoutput.java");
System.out.print(obj.available());
}
}

A true
B false
C prints number of bytes in file YES
D prints number of characters in the file
28 Which of these classes are used by Byte
streams for input and output operation?
A InputStream YES
B InputOutputStream
C Reader
D All of the mentioned
29 Which of these class is implemented by
FilterInputStream class?
A InputStream
B BufferedInputStream
C FileInputStream YES
D BufferedFileInputStream
30 Which of these class contains the
methods print() & println()?
A System
B System.out
C BUfferedOutputStream
D PrintStream YES
31 Which of these method of class
StringBuffer is used to reverse sequence
of characters
A reverse() YES
B reverseall()
C Reverse()
D reverseAll()
32 Before we try to write applets, we must
make sure that Java is installed properly
and also ensure that either the java is
installed properly and also ensure that
either the java …………….. or a java-
enabled browser is available.
A viewer( )
B appletviewer( ) YES
C appletrunner( )
D browserviewer( )
33 Arrange the steps involved in developing
and testing the applet in correct order.

i) creating an executable applet


(.classfile)
ii) preparing <APPLET> tag
iii) creating HTML file
iv) building an applet code (.java file)
v) testing the applet code
A 1-i, 2-ii, 3-iii, 4-iv, 5-v
B 1-ii, 2-iii, 3-iv, 4-v, 5-i
C 1-iv, 2-i, 3-ii, 4-iii, 5-v YES
D 1-iii, 2-iv, 3-v, 4-i, 5-ii
34 State whether the following statements
about the Applets are True or False.
i) Applets can communicate with other
services on the network.
ii) Applets cannot run any program from
the local computer.

A True, False
B False, True YES
C True, True
D False, False
35 Applet class is a subclass of the panel
class, which is again a subclass of the
………………….. class.
A object
B component
C awt
D container YES
36 The ………………… method called the first
time an applet is loaded into the
memory of a computer.
A init( ) YES
B start( )
C stop( )
D destroy( )
37 The ……………………… method is called
every time the applet receives focus as a
result of scrolling in the active window.
A init( )
B start( ) YES
C stop( )
D destroy( )
38 Which of the following applet tags is
legal to embed an applet class named
Test into a webpage?
A <applet class=Test width=200
height=100></applet>
B <applet>
code=Test.class width=200 height=100>
</applet>
C <applet code=Test.class width=200 YES
height=100>
</applet>
D <applet
param=Test.class width=200
height=100>
</applet>
39 The …………………. class is an abstract
class that represents the display area of
the applet.
A display
B graphics YES
C text
D area
40 In java applet, we can display numerical
values by first converting them into
string and then using the …………………
method.
A paint( )
B drawstring( ) YES
C draw( )
D convert( )
41 Applets are designed to be embedded
within an __________.
A Javascript

B Css

C HTML YES

D SQL

42 Which of the following is required to


view an applet?
A JCM

B JDM

C JVM YES
D Java class

43 An applet is a Java class that extends


the?
A java.Applet class

B java class

C Applet class

D java.applet.Applet class YES

44 Which are the common security


restrictions in applets?
A Applets can't load libraries or define
native methods
B An applet can't read every system
property
C Applets can play sounds

D Both A & B YES

45 What is the length of the application box


made by the following Java program?

import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("A Simple Applet",
20, 20);
}
}

A 20 YES

B 50

C 100

D System dependent

46 What is the Message is displayed in the


applet made by the following Java
program?

import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("A Simple Applet",
20, 20);
}
}

A A Simple Applet YES

B A Simple Applet 20 20

C Compilation Error

D Runtime Error

47 Which of these modifiers can be used


for a variable so that it can be accessed
from any thread or parts of a program?
A transient

B volatile

C global YES

D No modifier is needed

48 Which of these methods can be used to


output a string in an applet?
A display()

B print()

C drawString() YES

D transient()

49 Which of these functions is called to


display the output of an applet?

A display()

B paint() YES

C displayApplet()

D PrintApplet()

50 Which of the following statement is


correct?
A reverse() method reverses all characters YES

B reverseall() method reverses all


characters.
C replace() method replaces first
occurrence of a character in invoking
string with another character.
D replace() method replaces last
occurrence of a character in invoking
string with another character

CENTURION UNIVERSITY OF TECHNOLOGY & MANAGEMENT

ANDHRA PRADESH

EXAMINATION CELL

SUBJECT NAME: (NAME IN FULL): JAVA TECHNOLOGIES

SUBJECT CODE: CUTM1031

MODULE NO: 6
S.
NO
1 Which of these methods is a part of
Abstract Window Toolkit (AWT) ?

A display()
B paint() YES
C drawString()
D transient()
2 Which of these operators can be used to
get run time information about an
object?
A getInfo
B Info
C instanceof YES

D getinfoof
3 Which of these package is used for text
formatting in Java programming
language?

A java.text YES
B java.awt
C java.awt.text
D java.io
4 Which of these packages contains all the
classes and methods required for even
handling in Java?
A java.applet
B java.awt
C java.event
D java.awt.event YES
5 What is an event in delegation event
model used by Java programming
language?
A An event is an object that describes a YES
state change in a source
B An event is an object that describes a
state change in processing
C An event is an object that describes any
change by the user and system
D An event is a class used for defining
object, to create events
6 Which of these methods are used to
register a keyboard event listener?
A KeyListener()
B addKistener()
C addKeyListener() YES
D eventKeyboardListener()
7 What is a listener in context to event
handling?
A A listener is a variable that is notified
when an event occurs
B A listener is a object that is notified YES
when an event occurs
C A listener is a method that is notified
when an event occurs
D None of the mentioned
8 Event class is defined in which of these
libraries?
A java.io
B java.lang
C java.net
D java.util YES
9 Which of these class is super class of all
the events?
A EventObject YES
B EventClass
C ActionEvent
D ItemEvent
10 Which of these events will be notified if
scroll bar is manipulated?
A ActionEvent
B ComponentEvent
C AdjustmentEvent YES
D WindowEvent
11 Which of these events will be generated
if we close an applet’s window?
A ActionEvent
B ComponentEvent
C AdjustmentEvent
D WindowEvent YES
12 Which is the container that doesn't
contain title bar and MenuBars but it
can have other components like button,
textfield etc?
A Window
B Frame
C Panel YES
D Container
13 The Swing Component classes that are
used in Encapsulates a mutually
exclusive set of buttons?

A AbstractButton
B ButtonGroup YES
C JButton

D ImageIcon
14 Which package provides many event
classes and Listener interfaces for event
handling?
A java.awt
B java.awt.Graphics
C java.awt.event YES
D None of the above
15 Name the class used to represent a GUI
application window, which is optionally
resizable and can have a title bar, an
icon, and menus.

A Window
B Panel
C Dialog
D Frame YES
16 To use the ActionListener interface it
must be implemented by a class there
are several ways to do that find in the
following?
A Creating a new class
B Using the class the graphical component
C An anonymous inner class
D All mentioned above YES
17 Which is a component in AWT that can
contain another component like buttons,
text fields, labels etc.?
A Window
B Container YES
C Panel
D Frame
18 Which is used to store data and partial
results, as well as to perform dynamic
linking, return values for methods, and
dispatch exceptions?

A Window
B Panel
C Frame YES
D container
19 What are the different types of controls
in AWT?

A Labels
B Pushbuttons
C Checkboxes&Choice list
D All of these YES
20 Give the abbreviation of AWT?
A Applet Windowing Toolkit
B Abstract Windowing Toolkit YES
C Absolute Windowing Toolkit
D None of the above
21 Which class provides many methods for
graphics programming?

A java.awt
B java.Graphics
C java.awt.Graphics YES
D None of the above
22 By which method You can set or change
the text in a Label?

A setText() YES
B getText()
C Both A & B
D None of the above
23 Which class can be used to represent a
checkbox with a textual label that can
appear in a menu.
A MenuBar
B MenuItem
C CheckboxMenuItem YES
D Menu
24 The following specifies the advantages
of It is lightweight. It supports pluggable
look and feel. It follows MVC (Model
View Controller) architecture.
A Swing YES

B AWT
C Both A & B
D None of the above
25 Which are passive controls that do not
support any interaction with the user?
A Choice
B List
C Labels YES
D Checkbox
26 The following way is used to create a
frame is by creating the object of Frame
class?
A inheritance
B association
C Both A & B YES
D None of the above
27 Which of the following classes are
derived from the Component class.
A Container
B Window
C List
D MenuItem YES
28 Which is the container that doesn't
contain title bar and MenuBars but it
can have other components like button,
text field etc?
A Window
B Frame
C Panel YES
D Container
29 Which object can be constructed to
show any number of choices in the
visible window?
A Labels
B Choice
C List YES
D Checkbox
30 What are the different types of controls
in AWT?
A Labels, Pushbuttons, Checkboxes, Choice
lists, Lists, Scrollbars, Text components
B These controls are subclasses of
component
C Both A and B YES
D None
31 What are the component and container
class?
A Button
B Canvas
C Checkbox
D All of these. YES

32 What is the parameter specification for


the public static void main method?
A String args []
B String [] args
C Both A and B YES
D None
33 Where can the event handling code be
written?
A Same class
B Other class
C Anonymous class
D All mentioned above YES
34 Where is the CardLayout used?
A CardLayout is used where we need to
have a bunch of panel or frames one
laying over another
B It is replaced by TabbedPane in Swing
C Both A and B YES
D None
35 What does the following line of code
do?
Textfield text = new Textfield(10);
A Creates text object that can hold 10
rows of text.
B Creates the object text and initializes it
with the value 10.
C Creates the object text and initializes it YES
with the value 10.
D The code is illegal
36 Which of the following applet tags is
legal to embed an applet class named
Test into a Web page?
A < applet class = Test width = 200 height
= 100>
B < applet>
code = Test.class width = 200 height =
100>
C < applet code = Test.class width = 200
height = 100>wrong
D < applet param = Test.class width = 200 YES
height = 100>
37 Which of the following methods can be
used to draw the outline of a square
within a java.awt.Component object?
(A) fillRect()
(B) drawLine()
(C) drawRect()
(D) drawString()
(E) drawPolygon()
A (A), (B), (C) & (E)
B (A), (B) & (E)
C (B), (D) & (E)
D (B) & (E) YES
38 Where are the following four methods
commonly used?
1) public void add(Component c)
2) public void setSize(int width,int
height)
3) public void setLayout(LayoutManager
m)
4) public void setVisible(boolean)
A Graphics class
B Component class YES
C Both A & B
D None of the above
39 In Graphics class which method is used
to draws a rectangle with the specified
width and height?
A public void drawRect(int x, int y, int YES
width, int height)
B public abstract void fillRect(int x, int y,
int width, int height)
C public abstract void drawLine(int x1, int
y1, int x2, int y2)
D public abstract void drawOval(int x, int y,
int width, int height)
40 Which is used to store data and partial
results, as well as to perform dynamic
linking, return values for methods, and
dispatch exceptions?
A Window
B Panel
C Frame YES
D Container
41 Which class is used for this Processing
Method processActionEvent( )?
A Button,List,MenuItem YES

B Button,Checkbox,Choice

C Scrollbar,Component,Button

D None of the above

42 The following
a) It is lightweight.
b) It supports pluggable look and feel.
c) It follows MVC (Model View
Controller) architecture
are the advantages of _____ .
A Swing YES

B AWT

C Both A & B

D None of the above

43 The Following steps are required to


perform
1) Implement the Listener interface and
overrides its methods
2) Register the component with the
Listener
A Exception Handling

B String Handling

C Event Handling YES

D None of the above

44 Which of these events is generated


when a button is pressed?
A ActionEvent YES

B KeyEvent

C WindowEvent

D AdjustmentEvent

45 Which of these events is generated


when the size of an event is changed?
A ComponentEvent YES

B ContainerEvent

C FocusEvent

D InputEvent

46 Which of these events is generated


when computer gains or loses input
focus?
A ComponentEvent

B ContainerEvent

C FocusEvent YES

D InputEvent

47 Which of these is superclass of


ContainerEvent class?
A WindowEvent

B ComponentEvent YES

C ItemEvent

D InputEvent

48 MouseEvent is subclass of which of


these classes?
A ComponentEvent

B ContainerEvent

C ItemEvent YES

D InputEvent

49 Which of these interfaces define a


method actionPerformed()?

A ComponentListener

B ContainerListener

C ActionListener YES

D InputListener

50 Which of these methods will be invoked


if a character is entered?
A keyPressed()

B keyReleased()

C keyTyped() YES

D keyEntered()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy