Quiz Summary
0 of 60 questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 60 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- Current
- Review
- Answered
- Correct
- Incorrect
-
Question 1 of 60
1. Question
- ______ is the super interface of the HttpServletRequest interface.
CorrectIncorrect -
Question 2 of 60
2. Question
- Which of the following methods of an Exception class return the details about the exception that has occurred?
CorrectIncorrect -
Question 3 of 60
3. Question
3. Which of the following statements truly specifies the characteristics of static methods in Java?
CorrectIncorrect -
Question 4 of 60
4. Question
- What will be the output of the below Java program?
class MyThread extends Thread
{
MyThread() {}
MyThread(Runnable r) {super(r); }
public void run()
{
System.out.print(“Inside Thread “);
}
}
class RunnableDemo implements Runnable
{
public void run()
{
System.out.print(” Inside Runnable”);
}
}
class ThreadDemo
{
public static void main(String[] args)
{
new MyThread().start();
new MyThread(new RunnableDemo()).start();
}
}
CorrectIncorrect -
Question 5 of 60
5. Question
- Which of the following interface does not inherit from the Collection interface?
CorrectIncorrect -
Question 6 of 60
6. Question
6. Which of the following statements are true regarding a constructor in a class?
CorrectIncorrect -
Question 7 of 60
7. Question
7. Identify the shortest manner in which you can declare a Java annotation
CorrectIncorrect -
Question 8 of 60
8. Question
8. All the methods of the _____________ class are inherited by the Exception class as the former is the super class of all the exceptions and errors in the Java language.
CorrectIncorrect -
Question 9 of 60
9. Question
- ServletConfig Interface
CorrectIncorrect -
Question 10 of 60
10. Question
- In Servlet which Method Returns the client IP address
CorrectIncorrect -
Question 11 of 60
11. Question
- Which is the most suitable data-structure to store small amount of data for rapid access that need not be sorted or checked for uniqueness?
CorrectIncorrect -
Question 12 of 60
12. Question
12. Which class represents the socket used by both the client and server for communicating data over TCP/IP?
CorrectIncorrect -
Question 13 of 60
13. Question
13. Which of the following statements correctly defines an immutable class?
CorrectIncorrect -
Question 14 of 60
14. Question
14. Check the following
interface Base
{
boolean m1 ();
byte m2(short s);
}
which two code fragments will compile?
- interface Base2 implements Base { }
- abstract class Class2 extends Base
{ public boolean m1( ){ return true; }}
- abstract class Class2 implements Base { }
- abstract class Class2 implements Base
{ public boolean m1( ){ return (7 > 4); }}
- abstract class Class2 implements Base
{ protected boolean m1( ){ return (5 > 7) }}
CorrectIncorrect -
Question 15 of 60
15. Question
- If private members are to be called outside the class, which is a good alternative?
CorrectIncorrect -
Question 16 of 60
16. Question
16. The ability for programmers to use the same written and debugged existing class
CorrectIncorrect -
Question 17 of 60
17. Question
17. What will be the output of the following program?
public class UseGenerics {
public static void main(String args[]){
MyGen<Integer> m = new MyGen<Integer>();
m.set(“merit”);
System.out.println(m.get());
}
}
class MyGen<T>
{
T var;
void set(T var)
{
this.var = var;
}
T get()
{
return var;
}
}
CorrectIncorrect -
Question 18 of 60
18. Question
- A servlet-mapping element specifies ______.
CorrectIncorrect -
Question 19 of 60
19. Question
- ______________ represents the need of information in the program without presenting the details.
CorrectIncorrect -
Question 20 of 60
20. Question
20. Which among the following is true?
CorrectIncorrect -
Question 21 of 60
21. Question
21. Which member can never be accessed by inherited classes?
CorrectIncorrect -
Question 22 of 60
22. Question
- Match the methods of the HttpServletRequest interface methods with their corresponding description.
CorrectIncorrect -
Question 23 of 60
23. Question
- Which of the statement will compile with error
- A) if (zone.equals(“East”)) {
shippingCost = weight * 0.23f;
}
B) if(rate = 100) {
…
}
C) if(rate = = 100) {
…
}
D) None of the above
CorrectIncorrect -
Question 24 of 60
24. Question
24. Which switch statement will give the error
A) switch (zone) {
case 5:
shippingCost = weight * 0.23f;
break;
case 6:
shippingCost = weight * 0.23f;
break;
default:
shippingCost = weight * 0.25f;
}
B) switch (zone) {
case 5:
case 6:
shippingCost = weight * 0.23f;
break;
default:
shippingCost = weight * 0.25f;
}
C) switch (zone) {
default:
shippingCost = weight * 0.25f;
break;
case 5:
case 6:
shippingCost = weight * 0.23f;
break;
}
D) None of them
CorrectIncorrect -
Question 25 of 60
25. Question
- Which of the following for loop statement is wrong
A) for (int i = 1; i <= 10; i++) {
}
B) for (int i = 1,j=10; i <= 10; i++,j–) {
}
C) for (int i = 1,j=10; i <= 10;j<=0; i++,j–) {
}
D) None of above
CorrectIncorrect -
Question 26 of 60
26. Question
- Which of the following statement is wrong
A) do < statement>
while (< boolean-expression >);
B) while (<boolean-expression>)
< statements >;
C) for (< dataType variabl e> : <collection/array> );
D) while (<boolean-expression>)
do <statement>;
CorrectIncorrect -
Question 27 of 60
27. Question
- What is the output of the following program?
public class JavaApplication2
{
public static void main(String[] args)
{
List<String> list1 = new LinkedList<>();
list1.add(“Kodnest”);
list1.add(“Best”);
list1.add(“Kodnest”);
list1.add(“KBK”);
list1.add(“KodnestBestKodnest”);
List<String> list2 = new LinkedList<>();
list2.add(“Kodnest”);
list1.removeAll(list2);
for (String temp : list1)
System.out.printf(temp + ” “);
System.out.println();
}
}
CorrectIncorrect -
Question 28 of 60
28. Question
- What will be the result of the expression 13 & 25?
CorrectIncorrect -
Question 29 of 60
29. Question
- Which keyword is used for passing current object to a method
CorrectIncorrect -
Question 30 of 60
30. Question
- The concept of multiple inheritances is implemented in Java by
I. Extending two or more classes.
II. Extending one class and implementing one or more interfaces.
III. Implementing two or more interfaces.
CorrectIncorrect -
Question 31 of 60
31. Question
31. Java source code compiled into
CorrectIncorrect -
Question 32 of 60
32. Question
- Which of the following statements are valid array declaration ?
A. int number( );
B. float average[ ];
C. double[ ] marks;
D. counter int[ ];
CorrectIncorrect -
Question 33 of 60
33. Question
- What will be the output of the following program?
public class ExamQuestion6
{
static int x;
boolean catch( )
{
x++;
return true;
}
public static void main(String[] args)
{
x=0;
if ((catch( ) | catch( )) || catch( ))
x++;
System.out.println(x);
}
}
CorrectIncorrect -
Question 34 of 60
34. Question
- Which statement is true?
CorrectIncorrect -
Question 35 of 60
35. Question
- You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
CorrectIncorrect -
Question 36 of 60
36. Question
- What will be the output of the program?
int i = 1, j = 10;
do
{
if(i > j)
{
break;
}
j–;
} while (++i < 5);
System.out.println(“i = ” + i + ” and j = ” + j);
CorrectIncorrect -
Question 37 of 60
37. Question
37. Which statement is true?
CorrectIncorrect -
Question 38 of 60
38. Question
38. What will be the output of the program?
class Exc0 extends Exception { }
class Exc1 extends Exc0 { } /* Line 2 */
public class Test
{
public static void main(String args[ ])
{
try {
throw new Exc1( ); /* Line 9 */
}
catch (Exc0 e0) /* Line 11 */
{
System.out.println(“Ex0 caught”);
}
catch (Exception e)
{
System.out.println(“exception caught”);
}
}
}
CorrectIncorrect -
Question 39 of 60
39. Question
39. What will be the output of the program?
public class Foo
{
public static void main(String[ ] args)
{
try{
return;
}
finally {
System.out.println( “Finally” );
}
}
}
CorrectIncorrect -
Question 40 of 60
40. Question
40. When a user types the URL
http://www.javaprepare.com/scwd/index.html
Which HTTP request gets generated. Select one correct answer.
CorrectIncorrect -
Question 41 of 60
41. Question
41. Which two packages contain the classes and interfaces that are required to build servlets?
CorrectIncorrect -
Question 42 of 60
42. Question
42. HttpSession Interface
CorrectIncorrect -
Question 43 of 60
43. Question
43. Which error will be produced if private members are accessed?
CorrectIncorrect -
Question 44 of 60
44. Question
44. What is the output of the following program?
public class Test
{
public Test()
{
System.out.printf(“1”);
new Test(10);
System.out.printf(“5”);
}
public Test(int temp)
{
System.out.printf(“2”);
new Test(10, 20);
System.out.printf(“4”);
}
public Test(int data, int temp)
{
System.out.printf(“3”);
}
public static void main(String[] args)
{
Test obj = new Test();
}
}
CorrectIncorrect -
Question 45 of 60
45. Question
45. The _____ interface provides various methods to configure a servlet, before processing the data requested by the client.
CorrectIncorrect -
Question 46 of 60
46. Question
46. What will be the order of output of the program?
class Test extends Thread {
public
void run()
{
System.out.println(“Run”);
}
} class Myclass {
public
static void main(String[] args)
{
Test t = new Test();
t.start();
System.out.println(“Main”);
}
}
CorrectIncorrect -
Question 47 of 60
47. Question
What is the output of the following program?
public class Test
{
public static void main(String[] args)
{
int value = 554;
String var = (String)value; //line 1
String temp = “123”;
int data = (int)temp; //line 2
System.out.println(data + var);
}
}
CorrectIncorrect -
Question 48 of 60
48. Question
48. Number of threads in below java program is
public class ThreadExtended extends Thread {
public void run() {
System.out.println(“\nThread is running now\n”);
}
public static void main(String[] args) {
ThreadExtended threadE = new ThreadExtended();
threadE.start();
}
}
CorrectIncorrect -
Question 49 of 60
49. Question
49. Which of the following is not the Java keyword?
CorrectIncorrect -
Question 50 of 60
50. Question
50. Which function among the following can’t be accessed outside the class in java in same package?
CorrectIncorrect -
Question 51 of 60
51. Question
What is the output of the following program?
import java.io.IOException;
class Derived
{
public void getDetails() throws IOException //line 23
{
System.out.println(“Derived class”);
}
}
public class Test extends Derived
{
public void getDetails() throws Exception //line 24
{
System.out.println(“Test class”);
}
public static void main(String[] args) throws IOException //line 25
{
Derived obj = new Test();
obj.getDetails();
}
}
CorrectIncorrect -
Question 52 of 60
52. Question
What is the Output of following Java Program?
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
class Demo {
public void show()
{
ArrayList<String> list = new ArrayList<String>();
list.add(“banana”);
list.add(“apple”);
Iterator itr = list.iterator();
Collections.sort(list);
while (itr.hasNext()) {
System.out.print(itr.next() + ” “);
}
}
} public class Main {
public static void main(String[] args)
{
Demo demo = new Demo();
demo.show();
}
}
CorrectIncorrect -
Question 53 of 60
53. Question
Which technique is not used to copy one array to another?
CorrectIncorrect -
Question 54 of 60
54. Question
What is the output of the following Java program?
public class ThreadDemo implements Runnable
{
private int x=0;
private int y=0;
public static void main(String [] args)
{
ThreadDemo obj = new ThreadDemo();
(new Thread(obj)).start(); /*Line 8*/
(new Thread(obj)).start(); /*Line 8*/
}
public synchronized void run () /*Line 11*/
{
for (int i=0;i<10;i++) /*Line 13*/
{
x++;
y++;
System.out.println(“x = “ +x+” ; y = “+y);
}
}
}
CorrectIncorrect -
Question 55 of 60
55. Question
55. Assume the following method is properly synchronized and called from a thread A on an object B: wait(2000); After calling this method, when will the thread A become a candidate to get another turn at the CPU?
CorrectIncorrect -
Question 56 of 60
56. Question
- 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);
}
}
CorrectIncorrect -
Question 57 of 60
57. Question
Predict the output of the following program.
abstract class demo
{
public int a;
demo()
{
a = 10;
}
abstract public void set();
abstract final public void get();
}
class Test extends demo
{
public void set(int a)
{
this.a = a;
}
final public void get()
{
System.out.println(“a = ” + a);
}
public static void main(String[] args)
{
Test obj = new Test();
obj.set(20);
obj.get();
}
}
CorrectIncorrect -
Question 58 of 60
58. Question
What will be the output of the program?
class Test
{
public static void main(String [] args)
{
Test p = new Test();
p.start();
}
void start()
{
boolean b1 = false;
boolean b2 = fix(b1);
System.out.println(b1 + ” ” + b2);
}
boolean fix(boolean b1)
{
b1 = true;
return b1;
}
}
CorrectIncorrect -
Question 59 of 60
59. Question
What are valid statements for yield method?
CorrectIncorrect -
Question 60 of 60
60. Question
Which of the following tag can be used to print the value of an expression?
CorrectIncorrect