Google Analytics

Friday 19 August 2011

Sample PRP Questions


1.   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
      }}

    prints: A.m1
    Compile-time error at line 1
    Compile-time error at line 2
    Run-time error at line 1

2.
      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);
      }
      }      
      What is the output ?

    Compilation Error
    Runtime Error
    10
    20

3.
Which of the following is not a mandatory attribute for <APPLET> tag?

    code
    width
    height
    name

4.
________ components can be used for guiding the user with description for input components  in GUI.

    JLabel
    JPanel
    JButton
    Any of the above

5.

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
         }}

    Prints: A.m1
    Compile-time error at  line1.
    Compile-time error at line 2.
    Run-time error at  line 1.

6.

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 {
      protected 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
         }}

    Prints: A.m1
    Compile-time error at  line1.
    Compile-time error at line 2.
    Run-time error at  line 1.


7.

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

    0
    102
    1
    02

8.
A software blueprint for objects is called a/an

    Interface
    Class
    Prototype
    method

9.
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){
      Test t = new Test();
      t.method();
      }
      }

 Compile time error
 Throws RuntimeException
 Throws IllegalAccessException
 No output

10.

Which of the following layout manager arranges components along  north, south, 
east, west and center of the  container?

 BorderLayout
 BoxLayout
 FlowLayout
 GridLayout

11.

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 {
       public 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 {
       public static void main(String[] args) {
         A a = new A(); // line 1
         a.m1();  // line 2  
      }}

 Prints: A.m1
 Compile-time error at  line1.
 Compile-time error at line 2.
 Run-time error at  line 1.

12.
Which of the following is not a primitive data type

 int
 bool
 float
 long

13.

Which of the following keyword can be used for intentionally throwing user
defined exceptions?

 throw
 throws
 finally
 try

14.

Class A{
A(){}
}

Class B{}

Class C
{
            Public static void main(String arg[])
{
}
}

  1. Compile and run
  2. will not compile
  3. will throw runtime exception

15.

Class A{
A(){}
}

Class B
{
            B(int x){}
}

Class C
{
            Public static void main(String arg[])
{
            A ab=new A();
            B cd=new B();
}
}

  1. Compile and run
  2. will not compile
  3. will throw runtime exception

16.

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

}
}

  1. Compile and run
  2. will not compile
  3. will throw runtime exception


17.

Consider the following prg
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”);
}
}

  1. Compile time err
  2. Run time errjm
  3. Prints:123donefinalxxx
  4. Prints123catchdonefinalxxx

18.

Consider the following prg
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”);
}
}

  1. Compile time err
  2. Run time err
  3. Prints:123catchfinal
  4. Prints123catchdonefinalxxx

19.

Protected memebr are visible in

  1. Inside same class
  2. inside same package
  3. inside same package and subclases of other package

20.

--------- keyword is used to declare class as abstract

  1. public
  2. private
  3. abstract

21.
Which of the following can not be declared inside <Head>
  1. table
  2. script
  3. style
  4. title

22.
In <img> tag src is used for ---------
  1. type of image
  2. path of file
  3. type of file

23.
Wrapper class for char is -------
  1. CHAR
  2. character
  3. Char
  4. Character

24.
In ordered list default attribute for type is\
  1. 1
  2. A
  3. I
  4. i

25.

In which list tag list will be printed as 1. 2. 3. 4. …….
  1. <ul>
  2. <ol>
  3. <dt>
  4. <dl>

26.
Which of the following attribute for giving line break in html
  1. <BR>
  2. line break
  3. line_break

27.
Which of the following attribute is invalid in <Form>
  1. name
  2. action
  3. method
  4. Get

28.
Which of the following can be used to create filled form
  1. <form>
don’t remember other options……

29.
What is the coorect way to declare script language
  1. <script language=”XXX.js”>
  2. language=java script
  3. <script_language=”java script”>
  4. <script language=”java script”>

30.
Which of the following can be used to itterate through all the objects

  1. do … while
  2. while
  3. for in
  4. for

31.
which of following is correct way to declare arrays in java script

  1. a={1,2,3}
  2. a=new {1,2,3}
  3. a=new Array(10);

32.
“Network is a computer” is themeline of _________
  1. microsoft
  2. Cisco
  3. Sun microsystem
  4. IBM
  5. Wipro Technologies

33.
setTimeOut() method in java script is used to

  1. delay the java script by specified time
  2. block the browser for specified time
  3. display time
  4. set the clock

34.
<Title> tag is declared in side which tag

  1. Before <Body>
  2. After <Body>
  3. Between <Head>
  4. Anywhere in html

35.
Which is not a font attribute

  1. size
  2. color
  3. face
  4. list

36.

Which of the following is used to display > symbol in html
  1. &th;
  2. &gt;
  3. &#174
  4. &#169

37.what is default value for method attribute in <Form>

  1. get
  2. post
  3. set
  4. let

38.
How we call function abc() in java script.
  1. call abc()
  2. calling abc
  3. abc()
  4. none

39.
which method is used to get the values of components in html
  1. getParam()
  2. getParameter()
  3. getValue()
  4. getParameterValues()

40.
All classes extends Object true or false
  1. true
  2. false

41.       In Java which event handling method called when page finish to load 
•           onFinish
•           onLoad
•           onCompile
•           onImage

42.
.           What is the maximum size of an cookie
•           4kb
•           20kb
•           300kb
•           30kb

43. how many cookies per web server browser supports.
1. 10
2. 22
3. 30
4. 20

44.
How to create new window in java script

  1. a=new window();
  2. window.open(“ABC”);
  3. mywin=open(“ABC”,”disp”)

45.
What we use for session tracking if there is no cookie.
  1. url rewriting
  2. session object
  3. not possible without cookies

46.
In jdbc type 4 driver is written in

  1. java
  2. native
  3. c
  4. c++

47.
What is the correct format of JDBC URL
  1. jdbc:<subprotocol>:<subname>
  2. jdbc:<subprotocol>:<subname>:driver
  3. jdbc:<subprotocol>

48

From which class / interface statement can be created
  1. Statement
  2. Connection
  3. Class
  4. Resultset

49.
When no data is found which of the following will return false

  1. % rowcount
  2. %found
  3. %notfound

50.
What is used to set attributes in callable statement

  1. *
  2. $
  3. #
  4. ?



51.
JSP means

  1. java server pages
  2. java super pages
  3. java supported pages

52.
Diff between include directive and <jsp:include>

53.
One question on getServletConfig.getInitParameter()

54.
What is compulsary in in <jsp:usebean>
  1. name
  2. calss
  3. type
  4. id

55.
Which of the following is mutating
  1. setValue()
  2. setProperty()
  3. getProperty()
  4. getValue()

56.
Jsp pages are compiled into

  1. java server pages
  2. servlet
  3. classes
  4. bytecode


57. questions on commit and rollback in case of trigger

58. question related to user_tables

59. question related to creating procedure and then again compiling it then what will be its status in data dictionary

  1. valid
  2. invalid
  3. compiled

60. pure functions in case of oracle.

61. java support multiple inheritance using classes T/F

62. foreign key can be created on more than on coloumn T/F

63. Question regarding Check Constraint.

64. def of trigger

65. if u want to return value wt will u use
1. procedure
2. function
3. anonymous block.

66.
 Number of methods available in MouseListener Interface
            a)1
            b) 5
            c) 6
            d) 4

67.

Which is not a jsp:setproperty?
            a) name
            b) property
            c) Id
            d) Param
68.

Java Applets can be executed in _______________

            a) Java-enabled web browser
            b) windows web browser
            c) any web browser
            d) none of the above

69. inline queries can be written in select using

  1. select
  2. from
  3. in




No comments:

Post a Comment