All Milestone MCQ PDF 585813515 All Milestone MCQ PDF
All Milestone MCQ PDF 585813515 All Milestone MCQ PDF
Object of which class(from the hierarchy shown above) can be safety substituted in place of xx in the
method doSomething()?
a) Object of class A c) Object of class C
b) An array object of class B d) An array object of class C
14. Which one of the following is a core interface in the collection framework?
a) Set b) Stack c) Array d) Tree
15. Which class in the collection framework has its implementation based on Hash Table and doubly
Linked list data structure?
a) Hashtable b) HashSet c) Vector d) LinkedHashSet
EXPLANATION:-The LinkedHashSet class implements the Set interface and uses the hash-table data
structure to store the elements.
16. What is the output?
public class TestLiterals{
public static void main(String[] args){
float f1=2.0;
float f2=4.0f;
float result=f1*f2;
System.out.println(result);
}}
A. A value which is exactly 8.0 C. Compilation error at Line 4
B. Compilation error at Line 3 D. Compilation error at Line 5
17. What is the output?
Given the following.
public class RTExpect{
public static void throwit(){
System.out.println(“throwit”);
throw new RuntimeExpection();
}
public static void main(String [] args){
try{
System.out.println(“hello”);
throwit();
}
catch (Expection re){
System.out.println(“caught”);
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
}
finally{
System.out.println(“finally”);
}
System.out.println(“after”);
}}
A. hello throwit caught D. hello throwit caught finally after
B. hello throwit Runtime Expection caught after RuntimeException
C. hello throwit caught finally after
18. public class ExceptionTest{
public static void main(String[] args){
try{
ExceptionTest a=new ExceptionTest();
a.badmethod();
System.out.println(“A”);
}
catch (Exception e){
System.out.println(“B”);
}
finally{
System.out.println(“C”);
}}
void badmethod(){
throw new Error();
}
}
A. BC followed by Error exception C. C followed by Error Exception
B. Error Exception followed by BC D. Error Exception followed by C
19. What will be the result of attempting to complete and run the following program?
public class polymorphism{
public static void main(String[]args){
Aref1 = new C();
Bref2 = (B)ref1;
System.out.println(ref2.f());
}}
class A{int f(){return 0;}}
class B extends A{int f(){return 1;}}
class C extends B{int f(){return 2;}}
A.The program will fail to compile
B. The program will compile without error, but will throw a ClasscastException when run
C. The program will compile without error and print 1 when run
D. The program will compile without error and print 2 when run
20. compile and/or run the program?
package mypack;
public class A {
public void m1() {System.out.print("A.m1");} }
class B {
public static void main(String[] args) {
A a = new A(); // line 1
a.m1(); // line 2
}}
a) prints: A.m1 c) Compile-time error at line 2
b) Compile-time error at line 1 d) Run-time error at line 1
21. What is the output ?
class Super{
int i=0;
Super(String s){
i=10;
}
}
class Sub extends Super {
Sub(String s){
i=20;
}
public static void main(String args[]) {
Sub b=new Sub("hello");
System.out.println(b.i);
} }
a) Compilation Error b) Runtime Error c) 10 d) 20
Explaination: if u have parameterized constructor then there must be a default constructor.
22. What is the result of attempting to compile and run the program
// Class A is declared in a file named A.java.
package pack1;
public class A {
void m1() {System.out.print("A.m1");}
}
// Class D is declared in a file named D.java.
package pack1.pack2;
import pack1.A;
public class D extends A{
public static void main(String[] args) {
A a = new A(); // line 1
a.m1(); // line 2
}}
a) Prints: A.m1 c) Compile-time error at line 2.
b) Compile-time error at line1. d) Run-time error at line 1.
Explaination: m1() in A is not visible in class D
23. What gets printed when the following gets compiled and run:
public class example {
public static void main(String args[]) {
int x = 0;
if(x > 0) x = 1;
switch(x) {
case 1: System.out.print(“1”);
case 0: System.out.print(“0”);
case 2: System.out.print(“2”);
break;
} } }
a) 0 b) 102 c) 1 d) 02
24. A software blueprint for objects is called a/an
a) Interface b) Class c) Prototype d) method
25. What is the output when the following code is compiled and/or executed?
public class Test {
private void method(){
System.out.println(“method”);
throw new RuntimeException();
}
public static void main(String[] args){
26. Which of the following layout manager arranges components along north, south, east, west and
center of the container?
a) BorderLayout b) BoxLayout c) FlowLayout d) GridLayout
27. Which of the following is not a primitive data type
a) int b) bool c) float d) long
28. Which of the following keyword can be used for intentionally throwing user defined exceptions?
a) throw b) throws c) finally d) try
29. Class A{
A(){}
}
Class B{}
Class C{
Public static void main(String arg[]){
}
}
a) Compile and run b) will not compile c) will throw runtime exception
30. Class A{
A(){}
}
Class B{
B(int x){}
}
Class C{
Public static void main(String arg[]){
A ab=new A();
B cd=new B();
}
}
a) Compile and run b) will not compile c) will throw runtime exception
31. Class A{
A(){}
}
Class B{
B(){}
B(int a){super(200);}
}
Class C{
Public static void main(String arg[]){
A ab=new A();
B cd=new B(23);
}
}
a. Compile and run b. will not compile c.will throw runtime exception
32. Consider the following program
class A{
Psvm(String a[]){
int x[]={1,2,3};
try{
for(int i=0;i<x.length;i++){
S.op(x[i]);
}
S.o.p(“Done”);
}
Catch(NullPointerException ne){
S.o.p(“Catch”);
}
Finally{
S.o.p(“Final”);
}
S.o.p(“XXX”);
}
}
a) Compile time error c) Prints:123DoneFinalXXX
b) Run time error d) Prints123catchdonefinalxxx
33. Consider the following program
Class A{
Psvm(String a[]){
int x[]={1,2,3};
try{
For(int i=0;i<=x.length;i++){
S.op(x[i]);
}
S.o.p(“Done”);
}
Catch(ArrayIndexOutofBoundException ae){
S.o.p(“Catch”);
}
Finally{
S.o.p(“Final”);
}
S.o.p(“XXX”);
}
}
a) Compile time err c) Prints:123CatchFinalXXX
b) Run time err d) Prints123catchdonefinalxxx
34. Protected member are visible in
a) Inside same class c) inside same package and subclasses of
b) inside same package other package
39. Which of the following is the operator used to generate an exception programmatically
a) throws b) throw c) catch d) try
40. Which of these array declarations and initialization are legal
(i) int arr[4] = new int[4]; (iii) int arr[] = new int[4];
(ii) int[4] arr = new int[4]; (iv) int[] arr = new int[4];
a) True b) False c) NA d) NA
46. is the Root Class of all Exception classes
a) Exception b) Error c) Throws d) Throwable
47. is the "Block of code" that is always executed (normal execution)
a) Catch (Exception Ex) c) Finally
b) Destructor d) None of the above
(i) public class Myclass implements IA, IB, IC // IA, IB, IC are different interfaces
{
MyClass mc = new Myclass();
}
(ii) public class Myclass extends A, B, C // A, B, C are classes (may be abstract)
{
MyClass mc = new Myclass();
}
a) i b)ii c) both i and ii d)NA
Explaination: Multiple inheritance is not allowed in java.
51. Which of these is the valid declaration for the main method?
a) public void main(); c) public static void main(String);
b) public static void main (String args[]) d) public static int main(String args[])
52. Which of the following statements is true?
a) Abstract modifier can be applied to classes c) An abstract class can have all or more abstract
and methods. methods
b) The abstract class cannot be instantiated. d) All of the above
53. If no access modifier is specified in Java the default access modifier assumed is
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
66. You can implement the selected methods of interface. This can be achieved by
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
69. System.in can be used to directly read lines from the console
a) true b) false c) Ignore this option d) Ignore this option
70. From OO point of view which of the following is better option for creating a thread
a) extending Thread class c) implementing Runnable interface
b) extending Runnable interface d) none of the above
71. 'this' is used for referring
a) current object c) super class object
b) any object used in the application d) none of the above
72. In an Object-Oriented system, objects interact with each other by sending and receiving _
a) arguments c) methods
b) messages d) None of these
73. Given these class definitions
class Superclass{}
class Subclass1 extends Superclass{}
and these objects
Superclass a = new SuperClass();
Subclass1 b = new Subclass1();
constructor
[ iv] fails if there is neither implicit nor explicit zero parameter
constructor in the super class.
a) all of the above b) [i], [ii],[iii] c) [i], [ii] d) [i], [ii],[iv]
80. Ture or False?
There are methods, System.gc() and Runtime.gc() that look as of they run the garbage collector but
even these methods do not have any control on the garbage collection process.
a) False b) True c) Ignore this option d) Ignore this option
81. What are the advantages of wrapper classes in Java?
a) Java contains many subsystems that work only with objects and not with primitive types
b) They are more object oriented than primitive data types
c) They can encapsulate the power of the functions related with something that they wrap which
primitives cannot do.
d) all of the above
82. What happens when object of the file class is garbage collected
a) file is permanently deleted from the hard disk
b) file is deleted but can be retrieved using some utilities
c) file is not deleted but the reference to the file is not available anymore.
d) file is closed and made inaccessible.
83. Which of the following statements are correct regarding the Object class in Java
[i] this is super class of all other classes in Java.
[ii] when you want to write a generic method which needs to accept any kind of object you can use this
class
[iii] Object o=new Emp();
[iv] Emp e=new Object();
a) all of the above b) [i], [ii], [iii] c) [i], [ii] d) [i], [iii]
84. Which of the following is true about the abstract classes and interface
a) Abstract class may contain some implemented, some unimplemented methods. Interface
cannot have implemented ones.
b) Abstract classes can have instances and interfaces cannot.
c) Abstract classes are useful without inheritance and interfaces have to be implemented to be usable.
d) Interfaces cannot contain anything other than method declarations while as abstract classes can
contain variables as well.
85. We can synchronize
[i] block [ii] method [iii] object [iv] class
a) only [ii] b) [ii], [iii] c) [i], [ii], [iii], [iv] d) none of the above
86. What access control keyword should you use to enable other classes to access a method freely within
its package, but to restrict classes outside of the package from accessing that method?
a) private c) protected
b) public d) Do not supply an access control keyword
87. Multiple inheritance is achieved in Java with
95. A is a part of JVM that loads all classes that are required for the execution of the java program.
a) JRE b) bytecode loader c) class verifier d) classloader
96. Which of the following statements are true?
1] Abstract class cannot be instantiated
2] We cannot declare abstract constructors
3] We may declare abstract static methods
a) 1 is true b) 2 is true c) 1 & 2 are true d) All the above are true
97.keyword is used to declare class as abstract
a) public b) private c) abstract
98. What will be the output?
public class TestConstructor extends Object{
TestConstructor(){
super();
this(10);
}
TestConstructor(int i){
this(i,11);
}
TestConstructor(int i,int j){
System.out.println(“i=”+i+”j=”+j);
}
public static void main(String[] args){
TestConstructor tc=new TestConstructor();
}}
a.No output b.i=10 j=11 c.compilation error d.runtime error
Explaination: this(10) should be first statement of constructor.
99. Given:
1. Abstract class AbstractClass{
2. void setup(){ }
3. abstract int execute();
4. }
5. class EC extends Abstractclass{
6. int execute(){
7. System.out.println(“execute of EC invoked”);
8. return 0;
9. }
10. }
11. Public class TestEC{
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
Which one of the following code fragments inserted at lines 4,5 will not compile?
a.return null; c.Object[] t=ne Object[10]; return t;
b.Object t=new Object(); return t; d.Object[] t=new Integer[10]; return t;
101. Given:
1. public interface Constants{
2. static final int SEASON_SUMMER=1;
3. final int SEASON_SPRING=2;
4. static int SEASON_AUTUMN=3;
5. public static const int SEASON_WINTER=4;
6.}
String s1=”yes”;
System.out.println(ch+s1);
}
}
a) Compilation error b) Runtime error c) ayes d) none of the above
104. class DD{
public static void main(String args[]){
try{
Integer i1=3.3;
double d1=1.2;
System.out.println(i1*d1);
}
catch(Exception e1){
System.out.println(“caught”);
System.out.println(“after try-catch”);
}
}
}
What is the output of above program?
a) 3.599 after try-catch c) Compilation error
b) 3 after try catch d) Runtime error
105. Which of the field declaration is legal within the body of an interface?
a) protected static int answer=42; c) int answer=42;
b)int answer; d) private final static int answer=42;
106. public class Test{
public static void main(String[] args)
{
System.out.println(6^4) ;
}}
What is the output?
a) 1296 b) 24 c) 2 d) Compilation Error
Ans: c) 2
107. What is the role of "RMI" in the "n" tier architecture?
a) RMI will always be the third tier of the architecture
b) RMI can be any tier of the architecture
c) RMI will be used between any 2 tiers for communication
d) all of the above
108. Abstract class is a class which
a) Inherits Abstract Methods/interface but doesn't Implement it
b) Implements Abstract Methods
c) Does not have Abstract methods (but is denoted abstract )
d) Implements an abstract Interface
109. The serialization process can be controlled using the interface
a) Externalizable c) ActionListener
b) Serializable d) Runnable
110. Class C is inherited from class A and class B,class D is inherited from class C; Which of the following
is true?
i> class C inherits class A attributes iii> class D inherits class B attributes only
ii> class C inherits class B attributes iv> class D inherits class A attributes only
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
116. If one needs to find out what are the methods of one object/class by reading a .class file(without having
.java file) what way/API can help
a) API cannot do this work, you must have a c) Util package has the API to do this
specialized software for this. d) You cannot do this by any way
b) Reflection API can do this
120. Which of the following tools is used to generate the stubs and skeletons for a remote service?
a) javac b) rmic c) java d) rmiregistry
121. What interface must a class inherit from before an object of that type could be written to a stream?
a) Serializable c) any one of the above
b) Remote d) none of the above
122. What is the main disadvantages of using Java vis-à-vis C/C++ language
a) Interpretation of the program before each execution makes it slow.
b) Objects can be garbage collected resulting in unstability of programs
c) The LOc (lines of code) required for a java program is more when compared to the C/C++ counterpart
d) None of the above
123. Inside the interface, while declaring a function that others can access remotely, you must extend which
interface?
a) Cloneable b) Serializable c) RemoteObject d) Remote
124. What variables are substitute in java for the global variables
a) Instance variables b)static variables c)public variables d)final variables
125. The following code which is saved in c:\test.java. Choose the appropriate statement which will compile
it and do the placement of the bytecode accurately.
package mypackage;
public class test
{
}
a) c:\>javac -d . test.java c) c:\mypackage> javac test.java
b) c:\> javac test.java d) c:\mypackage> javac c:\test.java
126. The capability of an object to exist beyond the execution of the program that created it its indicated by
inherting from
a) Serializable interface c) both of the above
b) Remote interface d) this cannot be achieved without database or a file.
131. Select which of the following is the best place to close the connection in the simple java code
a) try block b) catch block c) finally block d) any of the above
10. Which of the following is the wrapper class for char data type?
a) java.lang.Char b) java.util.Char c) java.lang.Character d) java.util.Character
11. Junit is
a) a product from Jakarta c) An Opensource testing framework
b) a product from Apache d) None of the above
12. Which of the following method in the ResultSet is used to retrieve date values?
a) getDate(int columnIndex) c) getTime(int columnIndex)
b) getSQLDate(int columnIndex) d) getString(int columnIndex)
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
13. If auto-commit mode has been disabled in a JDBC application ,the SQL statements are grouped into
transactions which must be terminated by calling either or
a) setAutoCommit(true),setAutoCommit(false) c) executeQuery(),executeUpdate()
b) commit(),rollback() d) commit(),close()
14. Upperclass of all the classes representing the output stream of bytes is
a) InputStream b) Writer c) OutputStream d) Reader
15. Term tuple in RDBMS indicates
a) a column in a table c) Pool of values for specific column
b) a row in a table d) No of rows in a table
16. Which of this method is used to read a string from the input stream?
a) int read() c) String readLine()
b) int read() throws IOException d) String readstring() throws IOException
17. Which command is used to drop a view called “v1”?
27. Which of this class contains the method for deserialization object?
a) InputStream b) ObjectInputStream c) OutputStream d) ObjectOutputStream
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
28. Which method should be a non abstract class implementing a runnable interface implement?
33. The synchronized modifier is used to control access to critical code in multithreaded programs.
a) False b) True c) Ignore d) Ignore
34. JNDI is
a) Naming service b) directory interface c) both of the above d) none of the above
35. A head request is just like a get request except that
a) it asks server to return response headers only and not the complete resource.
b) is used to check characteristics of a resource without downloading it
c) is used when you don't need actual file contents
d) all of the above
36. java.io.Serializable is
a) Marker interface in Java
b) contains functionality required for serialization of objects
c) a class containing the serialize function
d) all of the above
37. The process of writing the state of an object to a byte stream, To save the state of your program to a
persistent storage area such as a file is called as . The process of restoring these objects by
using the process of .
a) Serialization, deserialization c) Serialization, Externalization
b) deserialization, Serialization d) none of the above
38. Which of the following type of driver was widely used when JDBC was very new.
a) JDBC-ODBC bridge plus ODBC driver c) JDBC-Net pure Java driver
b) Native-API partly-Java driver d) Native protocol-pure Java driver
39. The JDBC API consists of some classes and some interfaces. Identify which out of the following is/are
class/classes
a) DriverManager b) CallableStatement C) Connection d) All of the above
40. The advantages of RMI are
a) Built in JDK1.3 b) free of cost c) easy to use d) all of the above
41. execute(" ") method of a Statement is used when
a) The query to be executed is dynamic and it is not known whether it is select or update statement.
b) The query to be executed is very complex
c) The query to be executed is not a DML statement
d) None of the above
42. What is the modifier that for a method, so that only one thread can access it at a time, in a multi-threading
context
a) Final b) Synchronized c) Abstract d) Static
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
51. Which of the following annotations are used to annotate a test method in Junit?
a) @After b) @AfterClass c) @Before d) None of the above
52. Drop table statement removes
a) Only the rows of the table c) Removes the columns , rows and structure
b) Only the columns of the table definitions
d) None of the choices
Ans : removes the data definition and all data, indexes, triggers, constraints, and permission
specifications for the table
53. All the Junit method should be marked with Annotations
a) @After b) @Test c) @Before d) @BeforeClass
54. Annotation is a feature added in Package of Java
a) java.annotaion b) java.util.annotation c) java.lang.annotation d) None of the above
55. public class MyThread extends Thread{
private int count;
MyThread(){count=1;}
public void run(){
synchronized(count){
count++;
System.out.print(count);
}
}
public static void main(String[] args){
MyThread mt=new MyThread();
mt.start();
}
}
What will be the result of the above code?
a) Prints 1 b) Prints 2 c) Compile-time error d) None of the above
56. Which program declaration is correct for a function?
a) CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER(10)) RETURN NUMBER
b) CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER
c) CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER, p_amount OUT NUMBER)
d) CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER()RETURN NUMBER(10,2)
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
59. Super class of all classes representing an input stream of characters is ------------
a) InputStream b) Writer. c) Reader d) OutputStream
Explanation: This abstract class is the super class of all classes representing an input stream of bytes.
60. Super class of all classes representing an output stream of characters is ------------
a) InputStream. b) Writer c) Reader d) OutputStream
Explanation: This abstract class is the super class of all classes representing an output stream of bytes.
61. What can be one of the possible output?
public class TestRunnable implements Runnable{
public static void main(String args[]) throws Exception{
Thread t1=new Thread(new TestRunnable());
T1.start();
System.out.print(“Start”);
T1.join();
System.out.print(“End”);
}
public void run(){
for(int i=0;i<3;i++){
System.out.print(i);}
}}
a) An Exception is thrown at runtime. c) The code Executes and prints “SartEnd012”.
b) The code Executes and prints “SartEnd”. d) The code Executes and prints “Sart012End”.
62. With respect to the program given below,which of the following is correct?
import java.io.*;
class Test{
public static void main(String args[]){
InputStreamReaderisr=new InputStreamReader(System.in);
BufferedReaderbr=new BufferedReader(isr);
String s=br.readLine();
}}
a) Compilation error might occur as the checked exception is not handled
b) Might throw a runtime exception.
c) Compiles and reads one line of input from the console.
d) Reads one line at a time till we press „q‟.
63. Which of the following are true regarding the JDBC-ODBC Bridge driver
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
65. Is the following command right? UPDATE EMP SET ENAME="JACK" WHERE EMPNG=7788
a) True b) False
66. Foreign key is
a) Key which references column in same table. c) Is always unique
b) Key which references column from other table d) Both A and B
A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table
or the same table, a foreign key is a field (or collection of fields) in one table that uniquely identifies a row
of another table or the same table.
67. In which mode Formal parameter acts as a constant?
a)IN b) OUT c) IN OUT d) OUT IN
Answer: a Default mode& Formal parameter acts like a constant
68. A(n) contains a subset of the conceptual view, relevant to a particular group of users.
a)Physical view b)E-R model c)External view d)internal view
69. Say true or false?In Junit 4.x the java class which we are testing should extends from TestCase class?
a)Trueb)False
70. A parameter with OUT mode needs to be passed as a when the concerned procedure is invoked.
a)Value b)Variable c)Variable or Value d)None of the choices
71. public class Demo implements Runnable{
public static void main(String args[]){
Thread t7=new Thread(new Demo());
t7.start();
System.out.print("Vehicle");
try{
t7.join();
}catch(InterruptedException e){
System.out.print("InterruptedException");
}
System.out.print("Bus");
}
public void run(){
for(int index=7;index>3;index--){
System.out.print(index);}}}
What will be the output?
a) Compilation fails c) The code executes and prints”VechicleBus7654”.
b) An exception is thrown at runtime d) The code executes &prints”Vechicle7654Bus”
72. Given the following:
publicclass p1 implementsRunnable{
publicvoidrun(){
intarray[]={4,5,6};
for(int element :array)
System.out.println(element);
}}
a) The code execute and prints “fruit456apple” c) Compilation error.
b) The code execute and prints “fruitapple456” d) Run time exception
73. How would you restart a dead thread?
a) you cannot restart. c) By calling the Run() method
b) By calling the start() method d) By calling the restart() method
74. Disadvantage of file processing system include
a) Reduced data dependence c) Limited data by storing
b) Program dependent data d) Both b and c.
75. the following code snippet is an example of
@twizzle
Public void toggle(){}
Public @interface twizzle{}
a) Marker annotation c) Multi value annotation
b) Single value annotation d) None of the above
a) sql statements to the database c) Both sql and pl/sql statements to the database
b) pl/sql statements to the database d) None of the above
99. Threading in Java can be implemented by
a) Subclassing Thread and overriding "run" c) Either a or b
b) Implementing "Runnable" Interface d) None of the above
100. Thread are synchronized by
a) sleep and wakeup c) synchronize and desynchronize
b) wait and notify d) sleep and notify
101. Which of the following is true about DSN
a) It's a data source name used to identify which database is to connectedfrom the program
b) created using control panel of windows OS and hence platform dependant
c) created while using JdbcOdbc bridge driver from the java program
d) all of the above.
102. In Java, when two or more threads need access to a shared resource, is a way to ensure that the
resource will be used by only one thread at a time.
a) creating a semaphore c) Synchronization
b) Using mutex d) none of the above.
}
class p1 {
public static void main(String args[]) {
YY y1=new YY();
Y1.m1(3);
}}
a) 3 b) Integer:3 c) Compilation error d) Runtime error
107. The default ResultSet object moves only in the forward direction.
a.True b.False
108. Given the following
class RunOne implements Runnable{
public void run(){
System.out.println(Thread.currentThread().getName());
}
}
public class p1{
public static void main(String args[])
{
Thread t1=new Thread(new RunOne(),"ThreadOne");
t1.run();
}}
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
b.main
c.ThreadOne
main
d.No output
109. class DD{
public static void main(String rg[]){
try{
Integer i1=3.3;
double d1=1.2;
System.out.println(i1*d1);
}
System.out.println(“after try-catch”);
}}
What is output of above program?
a.3.599 after try-catch c.Compilation error
b.3 after try-catch d.Runtime Error
111. Which of the annotation in Junit 4.x,does the role of classwide setup method of previous versions?
a) @Before b) @BeforeClass c) @Test d) none of the above
112. Which one statement below is true concerning the following code?
class MyRunnable extends Object implements Runnable{
public void run(String message){
System.out.println(“in space run method:”+message);
}}
Public class TestThread{
Public static void main(String args[]){
MyRunnablemr=new MyRunnable();
Thread mt=new Thread(mr);
mt.start();
}}
a) The code will compile completely and will execute without throwing any exception.
b) There will be a complier error because the class MyRunnabledoesnot compile correctly.
c) There will be a compiler error at line 9,because the parameter passed to Thread proper type.
d) The code will compile correctly but will cause run time error on executing the line 10.
113. State which of the following statement is true.
a) The process of executing a synchronized method requires the thread to acquire a lock.
b) Any overriding method of a synchronized method is implicitly synchronized.
c) If any method in a class is synchronized, then the class itself must also be declared using the
synchronized modifier.
d) If a thread invokes a static synchronized method on an instance of class A, then the thread must
acquire the lock of that instance of class A.
114. In which of the package is the Wrapper classes found?
a) java.lang b) java.util c) java.io d) java.sql
115. An application view known as TRANS_HIST_V IS no longer needed. Which SQL statement should you
use to remove the view?
129. classThreadExextendsThread{
publicvoidrun(){
System.out.println("ThreadEx");
} }
publicclass p1{
publicstaticvoidmain(String args[]) {
ThreadExTex=newThreadEx();
Tex.start();
Tex.start();
} }
What is the result of attempting to compile and run the program?
a) The program compiles and runs without error
b) The second attempt to start thread ThreadEx is successful
c) Compile-time error
d) It prints ThreadEx and a runtime exception is thrown after that
130. Which of the following are optional parameters of Junit @Test annotation?
a. expected c. Both expected and timeout
b. timeout d. None of the above
131. The PL/SQL function body must have at least ................ RETURN statement(s)
a)0 b)1 c)2 d)many
132. float f=new Float(2.5);
Above line is example of
a)Unboxing b)AutoBoxing c)Boxing d)None of the above
133. After COMMIT,allsavepoints are saved
a)true b)false
134. Benefits of PL/SQL
a)Portability b)Exception Handling c)Modularization d)All the above
135. External View is
a) individual user view c) Storage view
b) Community user view d) None of the above
136. Which program declaration is correct for a procedure?
139. what will be the result of compiling and running the following code?
public class p1{
public static void main(String argv[]){
Thread1 Thread1=new Thread1();
Thread2 Thread2=new Thread2();
Thread1.start();
Thread2.start();
System.out.println("In main");
}
}
class Thread1 extends Thread{
public void run(){
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
System.out.println("In Thread1");
}
}
class Thread2 extends Thread{
public void run(){
System.out.println("In Thread2");
}
}
a) The code will not compile
b) The code will compile and print the following messages in the order given as in main
In Thread1
In Thread2
c) The code will compile correctly and print the following message in the order given as
In Thread2
In Thread1
In main
d) The code will compile and print the following messages in any random order
In Thread1
In Thread2
In main
140. what is the output of the following program
class p1{
publicstaticvoidmain(String a[]){
Double d=new Double("wipro");
System.out.println(d.doubleValue());
}
}
a) Compilation error c) Throws InputMismatchException at runtime
b) ThrowsNumberFormatException at runtime d)0
141. Commit() and RollBack() are methods belonging to which of the following classes?
a) Driver b) Connection c) Statement d) ResultSet
142. The process of ensuring that any shared resource is accessed by a single thread at a time is called as
a) Multi-threading b) Synchronization c) Cloning d) Serialization
143. What will happen if the code below is executed?
Assume that Dept table exists and is empty
import java.sql.*;
class JDBCDemo{
public static void main(String[] args) {
String url = "jdbc:oracle:thin:@192.168.121.13:1521:enr";
String user = "scott";
String password = "tiger";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection(url,user,password);
String sqlInsert = "INSERT INTO DEPT VALUES" +
"( 12 , 'WENA', 'BLR')";
Statement si = con.createStatement();
int rowsInserted = si.executeUpdate(sqlInsert);
con.rollback();
con.close();
}
catch (Exception e) {
System.err.println("Error!!");
}
}
}
a) One row will be inserted and committed
b) One row will be inserted and then will be rolledback when program terminates normally
c) Insertion will not happen
d) Will throw an error because executeUpdate() method cannot be used for inserts
144. In case an error occurs in the execution of a Oracle stored procedure from a Java program
a) SQLException is thrown and the oracle error code returned
b) SQLException is thrown and the JDBC error code is returned
c) IOException is generated as the database connection is lost
d) No exception is returned but the program hangs
145. You can make an object that reads and writes records from a database safe for multiple clients by
a) declaring its methods to be synchronized
b) declaring the method as throwing a RemoteException
c) implementing the remote interface
d) closing the file on finalize()
146. Usually, Server Socket waits on a port for requests, and upon receiving a request, gives a socket
connection on the
a) same port c) a port number which matches that on the client end
b) different port d) None of the above
147. Socket communication is an example of
a) Common information like protocol, ipaddress which is required forlooking up most of the remote
objects in one project
b) Common information like the object name, which is required for looking up each of the remote
objects in one project
c) Specific information like unique name required for each lookup
d) none of the above
160. We can synchronize
[i] block [ii] method [iii] object [iv] class
a) only [ii] b) [ii], [iii] c) [i], [ii], [iii], [iv] d) none of the above
161. Choose best answer for the following questionNaming.rebind method
a) re-registers the same remote object again in the rmiregistry
b) registers the remote object in rmiregistry with the unique namegiven as parameter to this method.
c) removes the registration of the remote object which is already registered with the unique name given
as parameter to this method.
d) both c and b
162. Why are programs needed on Server-side?
a) Dynamic Content generation c) Transactions
b) Database access d) All of the above
163. sql code finally gets converted to JDBC code.
System.out.println("hi");
}
}
a) This program compiles and word ""hi"" appears in the standard output (once).
b) This program compiles and word ""hi"" appears continuously in the standard output until the user hits
Ctrl+C to stop the program."
c) compilation error
d) runtime error
165. The lowest level synchronization which synchronizes the smallest unit is
a) synchronizing a method c) synchronizing a block
b) synchronizing a object d) synchronizing a class
166. Which one of the following interface is used to call a stored procedure from java
a) StoredCall b) CallProcedure c) CallableStatement d) None of the above
167. From OO point of view which of the following is better for creating a thread
a) Instantiate Thread class c) extend from Runnable
b) extend from Thread class d) implement Runnable
168. translates the standard JDBC calls into the specific calls required by the database it supports.
a) JVM b) Drivermanager c) Driver d) none of the above
169. If we have not created a DSN for the database, it is possible to access this database from Java?
a) Yes b) No
170. Select the odd man out
a) DCOM b) EJB c) CORBA objects d) JNDI
171. Whenever user issues insert,update or delete statement on the table Oracle implicitly locks the table in
a) Row share mode c) share row exclusive mode
b) Row Exclusive mode d) No lock occurs implicitly.
172. Which one of the following is true with Object Types in Oracle?
a) Once the object is created we cannot modify the attributes and methods of a type
b) Once the object is created we cannot modify the attributes of a type but we can modify the
methods of a type using alter type command.
c) we can modify the attributes and methods of a type even if objects are created. .
d) we can modify the attributes but we cannot modify the methods of a type once the object is created.
173. Which of the following situation in a PL/SQL block leads to too_many_rowsexception.
a) When any of the DML statement fetches more than one row from the table
b) when select statement fetches more than one row from the table
c) when select statement fetches more than one row from the table or cannot fetch any row from the table.
d) a and c
174. Unique Index is implicitly created by oracle
a) whenever primary key constraint is imposed on a table column.
b) whenever unique key constraint is imposed on a table column.
c) both a) and b)
d) Oracle does not create unique index implicitly.
175. Raise_application_error can have error code ranging from
a)-20000 to -20999 ** c) any integer number
b)20000 to 20999 d) Only positive integer number
176. PGA is created
a) whenever Oracle instance is created c) at the mount stage of oracle database
b) whenever a user is connected to the oracle d) none of the above
database
177. Each user has a separate SGA in the Oracle Server.
a) TRUE b)FALSE
178. I want to store Employee number , Employee Photograph and Employee description (having data
in MB's) in a table. Which of the following description is invalid
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
183. Which one of the below list is not a SQL *plus command
a) SPOOL b) STOP c) EXIT d) SAVE
184. Which of the following statement is false
a) PL/SQL table consists of homogeneous c) PL/SQL table is a multi-dimensional table
elements d) None of the above
b) PL/SQL table is indexed by integers
185. Which of the following stores character data
88
What is the output of: select rownum from Temp1 order by B desc;
a) 6 7 8 b) 8 7 6 c) 1 2 3 d) 3 2 1
187. Maximum what size of binary data can be stored in BLOB datatype?
a) 1 GB b) 2 MB c) 4 MB d) 4 GB
188. The memory structure that does not constitute the ORACLE instance is
a) System global Area b) Dictionary Cache c) Redo Log Buffer d) None Of these
189. Primary key is implicitly indexed
a) TRUE b) FALSE
190. Indexing
a) Speedens Inserts c) Reduces space requirements
b) Speedens updates d) Increases space requirements
191. if checkpoint is not enabled which of the following process does the job of a checkpoint.
a) DBWR b) LGWR c) SMON d) PMON
192. Which of the following statement is true?
a) An extent consists of contiguous data blocks c) A data block is the smallest unit of I/O used by
b) A segment may not consist of contiguous data the database.
blocks. d) All of the above
199. An object table is a special kind of table that holds objects and provides a relational view of the attributes
of those objects
a) True ** b) False
200. Which Static data dictionary view describes the columns of tables, views and clusters owned by the
current user?
a) COLS c) USER_TAB_COLUMNS
b) USER_COLL_TYPES d) USER_IND_COLUMNS
201. How do you drop a user (say Anil) from the database with all the objects/resources owned by him?
a) DROP USER ANIL
b) DROP USER ANIL CASCADE
c) First drop all the objects/resources individually owned by ANIL and then use „DROP USER ANIL‟
d) Both options (b) and (c)
202. A Join condition involving an operator other than the equivalency is called
a) Non EquiJoin b) EquiJoin c) OuterJoin d) Inner Join
203. When an Oracle Database is started, memory is set aside and one or more processes are started in that
memory, and that memory is called as System Global Area(SGA)
a) True b) False
204. Which of the following are background processes in an oracle instance?
a) DataBaseWriter(DBWR) b) Log Writer(LGWR)
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
234. Select Min(Sal) from emp where sal>(Select min(sal) from empwhere sal> (select min(sal) from emp))
a) ERROR c) Displays Third lowest Sal from emp table
b) Displays Third highest Sal from emp table d) Displays Second highest Sal from emp table
235. Find the odd statement out
a) A table may or may not have a primary key c) A table must have at-least one foreign key
b) A table can have at-most one primary key d) A table might have more than one foreign key
240. Choose the correct answer with respect to the statements given below
I] Functions cannot have out parameter as they already have a return type
II] Functions cannot return more than one value by any means
a) Only I is true b) Both are false c) only II is true d) Both are true
241. What will the following statement do?
PRAGMA EXECEPTION_INIT(EX1,-20000)
a) will associate EX1 with -20000 ** c) can't assign -20000 as it is reserverd error code
b) will raise the exception when encounters - d) none of the above
20000
242. The VALUES clause of the INSERT statement can use functions
a) true b) false
243. The main interfaces that every Driver layer must implement are
a) Driver c) Resultset
b) Connection d) All of the above
244. How to enable output in SQL*PLUS environment
7. In html which of the following button is used to send form data to a server
a.submit b.button c.reset d.all of the above
8. Syntax for defining action elements in jsp
a.<% %> c.<jsp:action_name attribute="value"/>
b.<% /%> d.none of the above
9. Which method of the servlet will be called when a servelet is undeployed in a server?
a.close b.terminate c.destroy d.abort
10. The values selected in the HTML form elements is passed on to the servlet through
A)HttpServletResponse B)HttpSession C)HttpServletRequest D)cookie
11. the canvas element in html5 is used to
a. to play audio files b. to play video files c.to draw graphics d.none of the above
12. Which of the following session tracking mechanism are supported by servlets
a.uri rewriting d.it supports all the above session tracking
b.cookies mechanism
c.hidden from fields
13. The src attribute of an<IMG> tag indicates
A) a short description of an image C) The height of the image
B) the path of the location of an image D) None of the above
14. If I have to create a checkbox in HTML, which of the following needs to be done?
A) <input type=”check” name=”vehicle” value=”bike”/>
B) <input type=”checkboxgroup” name=”vehicle” value=”bike”/>
C) <input type=”checkbox” name=”vehicle” value=”bike”/>
D) none of the above
15. What is the output of the following code?
<script> Alert(2+3+”3”); </script>
A)233 B) 53 C) error D) None of the above
16. Which of the following is true?
A) XML is a direct subset of SGML C) XML is a kind of dynamic HTML
B) SGML is an application of HTML D) SGML and XML are the same thing
17. Syntax for defining expression in JSP is
A) <%!........ %> C) <%=……. %>
B) %@......... % D) <% ......... %>
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
19. Given an HttpServletRequest requested and HttpServletResponse response, which option sets a cookie “username”
with the value “joe” in a Servlet?
A)request.setCookie(“username”,”joe”);
B)request.addCookie(new Cookie(“username”,”joe”));
C)response.addCookie(new Cookie(“username”,”joe”));
D)response.addHeader(new Cookie(“username”,”joe”));
20. Using CSS,how do you make each word in a text start with a capital letter?
A) text-transform:capitalize C) text-transform:uprcase
B) text-transform:uppercase D) You can‟t do with CSS
21. Which attribute of the tag denotes how much space to put between cells?
A) cellspacing C) cellpadding
B) border D) bgcolor
22. What is the output of the following?
<script>
X=”1”;
Y=1;
If(x==y)
Alert(“same”);
Else
Alert(“not same”);
</script>
A) yes B) no
27. Which of the statement is correct for the given code?
Given MyBean.java
Package test;
Public class MyBean{
Public MyBean(int x) {}
}
And test.jsp
<jsp:usebean id=”my” class=”test.mybean” scope=”page”/>
a) It will work fine 28. Http is a
b) Compiler will complain because there is no
type attribute specified
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
36. Which of the following event is trigerred when an element in an HTML Form looses focus?
a) Onclick b) Onblur c)Onfocus d) None of the above
37. To add cookie to the user‟s machine,the following method of the HttpResponse object is used:
a) addCookie() b) addSession() c) setCookie() d) setSession()
38. An XML document is valid if
a) It is well formed c) Conforms to the constraints specified in the DTD
b) It declares a DTD d) All of the above
39. What is the output of the following program?
<script>
alert(Math.round(-10.6));
</script>
43. Which of the following is used to insert java values directly into the output of a JSP page?
a.expressions b.scriplets c.directives d.declaration
44. What is the name of deployment descriptor file of a web application?
a.dd.xml b.server.xml c.web.xml d.web-app.xml
45. After compilation a JSP page translates into
a.Applet b.Servlet c.Application d.Midlet
46. The java Server pages (JSP)technology model <%=”India”+username%> is an example of
a.Jsp.Scriplet b.Jsp.Comment c.Jsp.Declaration d.Jsp.Expression
51. Which of the following is legal JSP SYNTAX to print the value of i?
a.<%int i=1;%><%=i;%> c. <%int i=1%><%=i%>
b. <%int i=1;i;%> d. <%int i=1;%><%=i%>
52. Which of the following statement is NOT true about servlets?
a.servlets start a new process for each request
b.servlets run in the same server process as the HTTP server
c.servlets can use the JDBC API to connect to the database
d.servlets are platform independent
53. HTML tags are case sensitive
a.true b.false
54. Which package does generic servlet belong to?
a.javax.servlet b.javaxservlet.http c.javax.servlet.generic d.java.servlet.http
55. ……..method allows the servlet to receive the value for the given input field passed by the client in the HTML
form
a.getparam(“fieldname”); c. getParameterNames();
b.getParameterValues(); d. getParameter(“fieldname”);
56. HTML5 is
a. HTML+CSS3+JavaScript APIs c. HTML+JavaScript APIs
b. HTML+CSS1+JavaScript APIs d. HTML+CSS2
57. How do you change the left margin of an element?
for(var i=3;i>=3;i--){
Document.write(„The‟+suffixes[i]+‟student is‟+students[i]);
}
</script>
a. It prints „The 3rd students is vinod‟ c. It prints „The 3rd student is vinod‟
b. It prints „The 4th students is susil‟ d. None of the above
65. What is the correct place in the HTML document from where you can enter to an external style sheet?
a.At the end of the document c.In the head section
b.At the top of the document d.In the body section
66. Which of the following is correct syntax to forward the request to another page?
a. <%2page:forward page=”HelloWorld.jsp”%> c. .<jsp:forward jsp=”HelloWorld.jsp”/>
b. <jsp:forward page=”HelloWorld.jsp”/> d. .<%!forward jsp=”HelloWorld.jsp”/>
67. In Javascript, which of the following event handler method is called when the mouse pointer moves over an item in
the webpage?
a.onMouse() b.onMouseMove() c.onMouseOver() d.onMouseAbove()
68. If a text in HTML needs to be both bold and underlined which of the following format should we choose?
a.<b><i>Hi</i></b> b. <b><u>Hi</u></b> c. .<b>Hi</b> d. .None of the above
69. Your web application named “FWorks”uses special Math.class. This is an unbundled class and is not contained in
any jar file. where will you keep this class file?
a. FWorks/WEB-INF c. FWorks/WEB-INF/lib/classes
b. FWorks/WEB-INF/classes d. FWorks/classes
70. What does following code fragement do?<%int accesscount=0;%>Accesses to page since server
reboot:<%=++accesscount%>
a. prints out the number of times the current page hae been requested since the servlet class was changed
and reloaded
b. prints out the number of times the current page hae been requested by the user
c. always prints one
d.nothing is printed out
71. In HTML target=_blank specifies that
a. the page will shut down c. window will open blank
b. the page is defined as a target and will be d. when clicking a link ,it will open in a new
found by the arrow command window
72. Which protocol would you use to access a file on the World Wide Web through a secure connection?
(HTTPS, HTTP, FTP, SMTP)
73. Which of the following is not true about scriplets?
a) in scriplets statements should be ended with semicolon
b) scriplets code goes into the service method of the JSP‟s compilee servlet
c) scriplets are executed at initialization time
d) scriplets are executed at request time
74. Which of the following is true abput <% @ include %> dirctive and <jsp:include>action?
a) Include directive includs the file at runtime whereas the include action includes the file at translation time
b) Include directive includs the file at translation time whereas the include action includes the file at run
time
c) Both of them includes the file at translation time
d) Both of them includes the file at runtime
75. Which is the correct tag for the smallest heading?
a) <h6> b) <h1> c) <h0> d) <h5>
76. Which of the following allows the web server to store small pieces of data on the client that can be sent back to the
server on subsequent page requests?
(Header,cookie,session,parameter)
77. which method of the HttpServletRequest object is used, if there is a chance of retrieving multiple values for any
given input parameter?
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
(retrieveFormValues,gerFormValues,gerMultipleValues,getParameterValues)
78. which of the following is one of the argument of doGet()method of HttpServlet?
10
( Request,Response,ServletRequest,Http ServletRequest)
79. Which is output?
<script language=”javascript” type=”text/javascript”>
Var name1=”Neil”;
Var name2=”Sriram”;
Function greet(who)
{
Document.write(who+”<br>”);
}
</script>
<script language=”javascript” type=”text/javascript”>
greet(name1);
greet(name2);
</script>
a) No output
b) Neil
Sriram
c) Sriram
d) Neil
80. The three life cycle methods of a servlet are called/invoked in this order
a) init(),destroy(),service() c) init(),service(),destroy()
b) destroy(),Init(),service() d) service(),Init(),destroy()
86. Which method of the servlet will be called to process a clients request in a servlet?
a) Process b) Service c) Execute d) Handle
87. In javascript which of the following event handler method is called when a text field in a web page is changed by
the user?
a.onChange() b.onTextChange() c.onEdit() d.onTextEdit()
88. Which of the following are true regarding naming variables in javascript?
A the variable name can start with an alphabhet
B the variable name can start with an underscore(_)
C the variable name can start with a dollar sign($)
D all of the above are true
89. Between which set of tags does most of the content of your web page need to be placed?
a.<text></text> b. <body></body> c.<head></head> d.<title></title>
90. Which of the following is one of the arguments of doGet() method of HttpServelt?
A.Request b.Response c.ServletRequest d.HttpServletRequest
91. .xml is a specification which is developed by
a.microsoft c.a working group of the world wide web
b.oracle consortium(W3C)
d.none of the above
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
11
92. Which of the following property is used to set the color property of an object called fruit>
A) <jsp.setvalue name=”fruit” property=”color”value=”white/>
B) <jsp.setproperty id=”fruit”name=”color”value=”white”>
C) <jsp.setproperty name=‟fruit”property=”color”value=”white”/>
D) <jsp.setvalue id=”fruit”name=”color”value=”white”>
93. Which of the following is false about servlets?
a.init() gets invoked only once c.init() gets invoked for every request
b.service() gets executed for each request d. service() takes two parameters
94. ----------property specifies the size of the background image .when you use this property, the background image
grows in size ,as you keep appending text
A) background-height C) background-image-width
B) background-origin D) background-size
95. Which of the following is root tag in html?
99. A JSP page uses the java.util.ArrayList class many times.Instead of reffering the class by its complete package
name each time.We want to just use ArrayList.Which attribute of page directivemust be specified to achieve this?
a. extends b. import c. include d. package
100. In which deployment descriptor in the <servelrt-mapping> and <servlet>elements defined
a. web.jar.xml b. web-war.xml c web.xml d. ejb.jar.xml
101. Which of the following is the correct URL format,when the browser passes the information to a server called
hellousing GET method?
a. http://www.test.com/hello&key1|value1.key2|value2
b. http://www.test.com/hello?key1=value1&key2=value2
c. http://www.test.com/hello|key1=value1,key2=value2
d. http://www.test.com/hello&key1=value1?key2=value2
102. The alert method belongs to which object?
a. document c. window
b. dot d. it does not belong to any object
103. Which of the following page directive attribute can appear multiple times in a jsp file ?
a) Info b) Session c) Import d) Extends
104. Assuming that lion.jpg cannot be found, what will be displayed when the following code is loaded in the browser?
<img src=‟lion.jpg‟ alt=‟lion‟/>
a) A warning message on the page c) The text „lion‟
b) A warning message in an alert box d) None of the above
105. Given an HttpServletRequest request and HttpServlet Response response.which option sets a cookie “username”
with the value „joe‟ in a servlet?
a) Request.setCookie(“username”) c) Response.addCookie(new name)
b) Request.addCookie(new Cookiename) d) Response.addHead(new)
106. what is the output of the following ?
<script>
X=”1”+2+4;
Alert(x);
</script>
12
13
14
124. In JavaScript,which of the following event handler methods is called when a submit button is pressed in the web
page?
a.onButtonSubmit() b.onSubmit() c.onButtonPressed() d.onButtonReleased()
125. CSS declarations are pairs seperated by semi colon
a.key value pair b.key property pair c.property value pair d.property key pairs
126. What is the output of the following code?
<script>
x=((45%2)==0?”Hi”:”Bye”);
alert(x);
<script>
a.Hi b.Bye c.Error d.None of the above
127. Which event captured a keypress?
a) onkeydown b)onmousedown c)onfocus d)onclick
128. The property is used to add rounded corners to HTML elements.
a) border-shadow b)border-radius c)box-rounded d)border-image
129. How do you write “Wipro Technologies” in a pop up box?
a) alert(“Wipro Technologies”) c) confirm(“Wipro Technologies”)
b) prompt(“Wipro Technologies”) d)none of the above
130. To place an image in a particular position on the web page which CSS property is used?
a) background-position c) background-align
b) background-placement d) background-alignment
131. Which of the following are valid input types in html file?
15
H1{color:red:}
16
144. When both internal and external style sheet are defined which of the following is true?
A.external style sheet over rules all the other styles given
B. internal style sheet over rules the external styles defined
C. defining both internal and external style sheets for one page is not possible
D. user has to explicitly declare which style to apply
145. Using servlets, the getParameterValues() method returns a
A.String array B.int value C.String D.void
146. The state information for a client is stored in
a) The HttpServletSession object c) The ServletSession object
b) The SessionScope object d) The HttpSession object
147. Which of the following are true about HTML attributes?
a)Attributes provide additional information about an element
b)Attributes are always specified in the start tag
c) Attributes come in name/value pairs like name=”value”
d) all the above
148. In javascript, which of the following event handler method is called when an item on the web page gains focus?
a)OnLoad() b)OnFocusGained() c)OnFocus() d)OnGained()
149. What is the correct javascript syntax to write “Hello World”?
a) response.write(“Hello World”) c) document.write(“Hello World”)
b)<%=”helloworld”%> d)None of the above
150. Which of the button type in HTML is used to reset the values of all the controls of a form to their initial values?
a.submit b.button c.reset d.none of these
151. Which attribute of <form> tag is used to specify where to send the form-data when a form is submitted
a.method b.name c.action d.none of these
152. Order of priority for applying the rules
1.browser default 2.external 3.internal 4.inline
a)1 2 3 4 b)2 3 4 1 c)1 4 3 2 d)4 3 2 1
153. What is XHTML stands for
a) eXtra Hypertext Markup Language c) eXtended Hypertext Markup Language
b)eXtension Hypertext Markup Language d) eXtensible Hypertext Markup Language
154. External style sheet should be stored with extension
17
c) HTML
d) None of the above
11
b) Any web server with built in Servlet engine / add on for the servlet engine
c) Any server that has JVM inside it.
d) all of the above
163. Pre-requisites for running Servlets are
a) Web Server that is Java Enabled C) Java Runtime Environment
b) Servlet API Class library d) All the above
164. HTTP header fields include
a) Content-length c) Type of request - POST or GET
b) Cookies d) All the above
165. Method that is used to retrieve value from a session variable is (assuming session is an object of HttpSession)
a) session.getValue("sessionvarname"); c) session.getDetails("sessionvarname");
b) session.getAttribute("sessionvarname"); d) Options a and b
166. If the user opens two instances of browsers separately and accesses the same ASP page, how many session objects
will be created on the Application Server?
a)1 b)2 c)3 d)4
167. GET method of HTTP is more secure than POST method
a) true b) false c) can't say d) none of the above
168. 'this' is used for referring
a) current object c) super class object
b) any object used in the application d) none of the above
169. Name the class that includes the getSession method that is used to get the HttpSession object.
a) HttpServletResponse c) SessionContext
b) HttpServletRequest d) SessionConfig
170. The method getWriter returns an object of type PrintWriter. This class has println methods to generate output.
Which of these classes define the getWriter method? Choose the correct option
a) HttpServletRequest c) ServletConfig
b) HttpServletResponse d) ServletContext
171. To send text output in a response, the following method of HttpServletResponse may be used to get the
appropriate Writer/Stream object. Choose the correct option.
Downloaded by Sanket !! ([email protected])
lOMoARcPSD|43369215
13
173. Servlets classes specific to your application are placed in which directory on the TOMCAT Server?
a) /lib/ b) /WEB-INF/classes/ c) /classes d) /WEB-INF/lib/
174. If a frame uses a grid layout manager and does not contain any panels,
a) then all the components within the frame are of different width and height
b) then all the components within the frame are the same width and height.
c) then all the components within the frame are smaller
d) then all the components within the frame are not completely visible
175. Servlet becomes thread safe by implementing the javax.servlet.SingleThreadModel interface
a) as every request is handled by separate instances of the servlet
b) as a single thread serves all the client requests
c) as all the requests are serialised
d) a first to-be loaded servlet and is loaded by the server during startup
176. You must ideally use Servlets for
i] Extending Server functionality and simple business logic
ii] Work flow management and presentation logic
iii] Work flow management and complex database queries
iv] NON-HTML data generation such as XML generation and parser
a) i only b) i, ii, iii c) i and ii only d) All of i, ii, iii and iv
177. Some purposes for which servlets can be used are:
i] file access on the client side iii] any purpose at the server end
ii] starting distributed transactions iv] calling an enterprise bean
a) All of i, ii, iii and iv c) iii only
b) ii, iii and iv only. File access is not possible. d) None of i, ii, iii and iv
178. Looking at the following piece of the code, Select the correct statement out of the given options
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
a) This is exactly same as import statement
b) This is used to make a connection with database
c) Usually written in the init() method of Servlet to load the driver into memory**
d) None of the above
179. Servlets can follow
a) single thread model b) multi thread model c) both d) none of the above
180. Which of the following server can host servlets?
a)Apache server b)IIs c)Windows 2000 Server d)Tomcat Server
181. Select the odd man out of
a) JButton b) Dialog c) ScrollPane d) Panel
182. Which of the following is the best answer
a) Although webservers can be configured to ports other than 80 for http requests, it is fine to configure
them to 8000 in production environments
b) Although webservers can be configured to ports other than 80 for http requests, it is not fine to configure them
to 8000 in production environments
c) Webservers do not allow you to configure to ports other than 80 and 443
d)Ignore this Option
183. The following method is used to create a PrintWriter object that can be used to write text to the response
a) getWriter() b) getOutputStream() c) getBinaryStream() d) getStream()
184. The service() method has objects of these classes as parameters - HttpServletRequest and HttpServletResponse
a) True b) False c) Ignore this option d) Ignore this option
185. Consider the following servlet
import javax.servlet.*;
import javax.servlet.http.*;
14
import java.io.*;
public class MyServlet extends HttpServlet {
int var;
public void init() throws ServletException {
var=0;
}
....}
For every browser request, a new instance of the servlet is created by the server
a) True b) False c) Ignore this option d) Ignore this option
186. Name the class that can be used to get the cookies from the client browser
a. HttpServletResponse b) HttpServletRequest c) SessionContext d) SessionConfig
187. Which of the following is not a server-side technology?
a) Servlets b) Java Server Pages c) DHTML d) CGI
188. Which method returns an array of String objects containing all of the values the given request parameter has
a) getParameter() b) getParameterNames() c) getParameterValues() d) None of the above
189. ASP Scripting
a) is browser dependent scripting c) is built on COM based technologies
b) Can be copied and downloaded by the client d) Can be coded only in VB Script
browser
190. Choose the correct statement
15
203. The URL in the POST method can be used to find out the query parameters
a) true b) false
204. Which of the following is not a mandatory attribute for <APPLET> tag?
a) code b) width c) height d) name
205. components can be used for guiding the user with description for input components in GUI.
a) JLabel b) JPanel c) JButton d) Any of the above
206. Panel is a container
a) from which you inherit the Applet class
b) that helps you add multimedia elements
c) that helps you add event handling for your applications
d) that helps you to create windows for your applications
207. init method of a servlet is called only once in its lifetime
a) False b) True c) Invalid option d) Invalid option