Google Analytics

Saturday 13 August 2011

JAVA PRP IMPORTANT QUESTIONS


1)      What will be the output for the program?

     Declare
Var number;
Begin
Var:=null;
For var in 10..100
Loop
Dbms_output.put_line(var);
End loop;
Dbms_output.put_line(var);
End;


2)      Which is a wrapper class?
a)      float
b)      char
c)      int
d)     bool

3)      Predict the output
Class sample
{
Public static void main(string args)
{
}
}

4) Class A
{
A()

{
}
}

Class B
{
B()
{
}
}

Class C
{
Public static void main(string[] args)
{
}
}


5)      Class test
         {
Public static void main(string[] args)
{
int one=1;
int two=2;
system.out.println(“Parvathi”+one+two);
}
}

6)      Attribute in an applet tag is _________________
a)      codeclass
b)      codename
c)      codebase
d)     none

7)      Attribute in an applet tag is _________________
a)      length
b)      width
c)      class
d)     breadth

8)      Default trigger is ____________
9)      Class loader is in ____________
10)  <%int a=10;%>
<%=a%>

11)  The description of an instance is
a)      method
b)      property
c)      keyword
d)     literal


12)  JSP expression is represented by ___________
a) <%        %>
b) <%0        %>
c) <% !       %>
d) <% =      %>


13) JSP directive is represented by ___________
a) <%        %>
b) <%0        %>
c) <% !       %>
d) <% =      %>


14)  select ename from emp where ename like ‘%s%s%o’ ESCAPE’%’;

15)  Try to add the value 3000 to the column which is declared as number(3)


16)  Client bean call session bean and connect directly to the database
  1. true
  2. false

17)  log() method is available in which interface?

18)  If <DOCBASE> is declared in a html page for the appearance of font color etc., then <font> attribute overwrite the docbase attribute

19)  Which is the serializable interface

a)      object
b)      method
c)      classes
d)     state

20)  A procedure consists of all parameters as IN parameter which is declared/defined in the packages. If we want to change the IN parameter as OUT parameter, then what we have to do?
a)      in Package Specification
b)      in package body
c)      both
d)     none of the above


21)  class A
{
A()
{
}
}
Class B extends A
{
B()
{
}
}
Class C
{
Public static void main(string args[])
{
}
What will be the output?
a)      compile time error
b)      run time error
c)      both compile and run time error
d)     none of the above


22)  If a table has 2 columns with NOT NULL and UNIQUE constraints on it ..what will be the candidate/ primary key?
a)      both are called candidate key
b)      one can be a primary key
c)      one can be a candidate key
d)     none of the above


23)  What will specify IS A relationship?
a)      IS A
b)      Extends
c)      Volatile
d)     Instance of

24)  Abstract class can be ___________
a)      subclass
b)      instantiated
c)      none
d)     final

25)  Super key can be of __________
a)      primary key + a non key
b)      unique key + a non key
c)      candidate key + a non key
d)     none of the above

26)  Implicit cursors will be used in __________
a)      select query
b)      update query
c)      delete query
d)     all the above


27)  comparison operator in SQL
a)      =
b)      *
c)      $
d)     #


28)  What will be the column heading for the given query?
SELECT sal*10 supply FROM emp;
a)      supply
b)      Supply
c)      SUPPLY
d)     sal*10

29)  Class sample
{
Public Static Void Main(string a[])
{
int one=1,two=2;
System.Out.Println(one+”Hello”+two);
}
}

a)      1+Hello+2
b)      One+Hello+two
c)      Hello
d)     None of the above

30)   The syntax for the frame _______________
a)      frame is declared within the body
b)      frameset is declared within body
c)      frame is declared within frameset
d)     frameset is declared within frame

31)  How to give the title to a table?
a)      <title>
b)      <head>
c)      <caption>
d)     <body>

32)  How to give the italics style in html
a)      <ii>
b)      <it>
c)      <i>
d)     <italics>
33)  _____________ is the superclass of all classes that are in input streams.
a)      output stream
b)      input stream
c)      buffered o/p stream
d)     object output stream

34)   What is the immediate superclass of panel?
a)      window
b)      component
c)      container
d)     object

35)  ____________ class is a wrapper class for the character data type.
a)      char
b)      character
c)      CHAR
d)     CHARACTER

36)  What will be the output for the given query?

SELECT ‘wipro’ FROM dual where NULL is NULL;
a)      Wipro
b)      Error
c)      No output
d)     Null values

37)   ______________ is a single occurrence of entity type
a)      row
b)      column
c)      instance
d)     none of the above

38)  SELECT empno|| ‘ ‘||eage||’ ‘||edate||’ ‘||Hiredate from emp;
a)      Datatype mismatch
b)      It will display all the columns it mentioned
c)      Error
d)     No output

39)  Which operator is used as a termination operator in SQL?
a)      ;
b)      @
c)      #
d)     !

40)  Write a subquery to select a department where there are no employees in it.
41)  Transaction is ____________
a)      group of DML statements that can’t be rolled back
b)      group of DML statements on a single table
c)      group of DML statements on different tables of same schema
d)     group of DML statements that are executed (all) or none

42)  Vector v=new vector(10);
What will be the next line?
a)      v.addElement(10);
b)      v.add(10);
c)      v.addElement(new Integer(10))
d)     v.addElement(Integer(10))

43)  Output and input streams are __________ classes
a)      static
b)      final
c)      abstract
d)     concrete


44)  %rowcount gives __________
a)      no of rows in the table
b)      no of rows processed so far
c)      none of the above
d)     both a and b


45)  In a table tag, which option is used to get the space between table border and cells?

a)      cellspacing
b)      cellpadding
c)      rowspan
d)     colspan


46)  Return type of getparameter(string) is ____________
a)      string
b)      object
c)      int
d)     character


47)  abstract class A
{
abstract void m1();
abstract void m2();
}
abstract class  B extends A
{
void m1()
{
};
}
Class C extends A
{
  void m2()
{
}
}

Class D
{
Public Static Void Main()
{
C c1=new C();
C.m2();
}

a)      compiler time error
b)      runtime time error
c)      logical error
d)     none of the above

48)  Interface sample
{
  abstract void m2(){ };
}
Class A implements Sample
{
   Public Void m1()          //line1
}
Class B implements Sample{ void m1(int j){ }}  //line 2
Class C implements Sample{ void m2(int i){ }}  //line 3

Which line(s) will throw error?
a)      Line 1
b)      Line 2
c)      Line 2 and Line 3
d)     Line 3


49)  What is the return type of execute()
a)      result
b)      resultset
c)      int
d)     Boolean


50)  Servlet is ___________
a)      j2ee application
b)      CGI
c)      Java API
d)     Netscape


51)  Implicit savepoint is created
a)      when a transaction starts
b)      when user starts a session
c)      when the user logs off the session
d)     none of the above


52)  What is the relationship in the network model?
a)      1:1
b)      1:M
c)      M:1
d)     M:M


53)  __________ is a Type II driver
54)  ___________ is a Type I driver
55)  When the index is removed, _________________
a)      only the index is dropped
b)      both the table & index gets dropped
c)      table becomes invalid
d)     none of the above


56)   When the sequence is removed, _________________
a)      only the index is dropped
b)      both the table & index gets dropped
c)      table becomes invalid
d)     none of the above

57)  Write the sequences of stages while creating the cusors
58)  Classloader is a part of ______________
a)      JNI
b)      JVM
c)      JSM
d)     None

59)  The argument for the service method
a)      service(HttpRequest,HttpResponse)
b)      service(HttpResponse,HttpRequest)
c)      service(ServletRequest,ServletResponse)
d)     service(ServletResponse,ServletRequest)

60)   The package of Generic Servlet is ____________
a)      Java.Servlet
b)      Javax.Servlet
c)      Javax.Servlet.generic
d)     Javax.Servlet.http

61)  If you are changing the code in the procedure,the previous procedure code and the changed source code will be in ______________
a)      USER_DEPENDENCIES
b)      USER_PROCEDURE
c)      USER_SOURCE
d)     USER_SOURCECODE

62)  ISA relationship in Java is indicated as _________
a)      extend
b)      extends
c)      ::
d)     Isa

63)  Array in java is ____________
a)      string of characters
b)      string of numbers
c)      reference type
d)     primitive datatype

64)  What is the superclass of Exception?

65)  Class super
{
int i=10;
void display()
{
System.Out.Println(i);
}
}

Class sub extends super
{
int j=10;
void getmethod()
{
i=20;
System.Out.Println(i);
}
}

Public Static Void Main(string args[])
{
Super obj=new sub();
Obj.getmethod();
}


66)  Interface A
{
void display();
}

Class B implements A
{
   Public void display(){} //line 1
Private void display(){}//line 2
Protected void display(){}// line 3
}

Which is invalid?
a)      line 1
b)      line 2
c)      line 3
d)     All the above

67)  What is true about ORACLE?
a)      It will detect the deadlock & handles it rather than preventing
b)      It will not allow other user to read the data when one is already reading

68)  Interface A()
{
void ABC()
}
Class B implements A
{
void ABC()
{
int i=10;
}
void display()
{
System.Out.Println(i);
}
}
Public Static Void Main(string args[])
{
A obj=new B();
Obj.ABC();
Obj.display();
}

69)  Which is not primitive data type?
a)      int
b)      long
c)      short
d)     char

70)  In “emp” table, there are null values for some of the columns in all the  rows. Totally there are 14 rows in the table. What will be the output if the given query is executed?
SELECT 5000 FROM emp;
a)      Null is printed only once
b)      NULL will be printed 14 times null
c)      5000 will be printed 14 times
d)     rror
71)   which provides transaction?
a)      RMI
b)      JNDI

72)  What is true about EntityBean(EB) and SessionBean(SB)?
a)      EB is the superclass of SB
b)      Sb is the superclass of EB
c)      EB is accessible to all the users of SB which is session specific
d)     None

73)  Predict the output for the given query:
SELECT * FROM emp where ename between ‘A’ and ‘C’;

74)   Emp Table has 3 columns like Empno,Ename,Passport….All the columns are unique. Which key can be considered as a primary key?
a)      All the three
b)      None
c)      empno
d)     Passport
75) Dependent entity should have __________
a)      same data type as the parent
b)      differs in their datatype from the parent one
c)      we can’t create a dependent enitity
d)     none of the above

76) The Main difference between the anonymous block and the procedure
e)      We can’t define %rowtype in anonymous block but it is possible in procedure
f)       Anonymous block is not an object but procedure is an object

77)    Which of the following is/are true?
i)        subquery will return more than one value
ii)      Subquery should be declared on the right hand side of the operator

a)      i only
b)      ii only
c)      both i and ii
d)     neither i nor ii

78)    Class can be declared as Abstract class by prefixing the keyword __________
Ans: abstract

79)    We can’t use final in __________
a)      class
b)      methods
c)      variable
d)     constructor

80)    Can we use operators in for loop
a)      we can’t use it for loop
b)      we have to declare it before, when we use it
c)      Infinite loop
d)     None of  the above

81)    Locks in oracle can be ___________
a)      Row level
b)      Table level
c)      Both row and table
d)     None of  the above

82)    TABLESPACE is _______________
a)      Default system space is called tablespace
b)      Each user may have tablespace
c)      There is no concept called TABLESPACE in oracle
d)     Collection of DataBases

83)    ER diagram is _______________
a)      high level model
b)      low level model
c)      representational model
d)     hierarchical model

84)    The Function of LGWR
85)    Which file is responsible for transaction recovery?
a)      data file
b)      control file
c)      redologfile
d)     archive file

86)    What will getparametervalue() will return?
87)    When will the scriplet tag(<%      %>) will execute?
a)      compilation time
b)      run time
c)      translation time
d)     none

88)    What will int=execute() do?
a)      compiler error
b)      runtime error
c)      It wont return any value
d)     none


89)     What will int=executeQuery() do?
a)      compiler error
b)      runtime error
c)      It wont return any value
d)     none

90)    What will int=executeupdate() do?
a)      compiler error
b)      runtime error
c)      It wont return any value
d)     none

91)    Interface I1{ }//line1
Interface I2{ }// line 2
Interface I1 extends I2//line3

Which line(s) produce the error?
a)      line 1 & 2
b)      line 3
c)      line 2
d)     all the three

92)    What are the comments available in java?
93)    What will happen if the given line is executed?
For &variable in 1..20
a)      Error
b)      loop executes for 20 times
c)      infinite loop
d)     None of the above

12 comments:

  1. Please write answers for each question

    ReplyDelete
  2. please let us know all the answers

    ReplyDelete
  3. pls send me the answers i am in needd plss

    ReplyDelete
  4. I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with
    us.



    Java and J2EE Training in Chennai - AmitySoft

    ReplyDelete
  5. where can i find the answers for these?

    ReplyDelete
  6. kindly send answer for this question to karuppuchamy89@gmail.com

    ReplyDelete