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[])
{
}
}
- Compile and run
- will not compile
- 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();
}
}
- Compile and run
- will not compile
- 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);
}
}
- Compile and run
- will not compile
- 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”);
}
}
- Compile time err
- Run time errjm
- Prints:123donefinalxxx
- 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”);
}
}
- Compile time err
- Run time err
- Prints:123catchfinal
- Prints123catchdonefinalxxx
19.
Protected memebr are visible in
- Inside same class
- inside same package
- inside same package and subclases of other package
20.
--------- keyword is used to declare class as abstract
- public
- private
- abstract
21.
Which of the following can not be declared inside <Head>
- table
- script
- style
- title
22.
In <img> tag src is used for ---------
- type of image
- path of file
- type of file
23.
Wrapper class for char is -------
- CHAR
- character
- Char
- Character
24.
In ordered list default attribute for type is\
- 1
- A
- I
- i
25.
In which list tag list will be printed as 1. 2. 3. 4. …….
- <ul>
- <ol>
- <dt>
- <dl>
26.
Which of the following attribute for giving line break in html
- <BR>
- line break
- line_break
27.
Which of the following attribute is invalid in <Form>
- name
- action
- method
- Get
28.
Which of the following can be used to create filled form
- <form>
don’t remember other options……
29.
What is the coorect way to declare script language
- <script language=”XXX.js”>
- language=java script
- <script_language=”java script”>
- <script language=”java script”>
30.
Which of the following can be used to itterate through all the objects
- do … while
- while
- for in
- for
31.
which of following is correct way to declare arrays in java script
- a={1,2,3}
- a=new {1,2,3}
- a=new Array(10);
32.
“Network is a computer” is themeline of _________
- microsoft
- Cisco
- Sun microsystem
- IBM
- Wipro Technologies
33.
setTimeOut() method in java script is used to
- delay the java script by specified time
- block the browser for specified time
- display time
- set the clock
34.
<Title> tag is declared in side which tag
- Before <Body>
- After <Body>
- Between <Head>
- Anywhere in html
35.
Which is not a font attribute
- size
- color
- face
- list
36.
Which of the following is used to display > symbol in html
- &th;
- >
- ®
- ©
37.what is default value for method attribute in <Form>
- get
- post
- set
- let
38.
How we call function abc() in java script.
- call abc()
- calling abc
- abc()
- none
39.
which method is used to get the values of components in html
- getParam()
- getParameter()
- getValue()
- getParameterValues()
40.
All classes extends Object true or false
- true
- 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
- a=new window();
- window.open(“ABC”);
- mywin=open(“ABC”,”disp”)
45.
What we use for session tracking if there is no cookie.
- url rewriting
- session object
- not possible without cookies
46.
In jdbc type 4 driver is written in
- java
- native
- c
- c++
47.
What is the correct format of JDBC URL
- jdbc:<subprotocol>:<subname>
- jdbc:<subprotocol>:<subname>:driver
- jdbc:<subprotocol>
48
From which class / interface statement can be created
- Statement
- Connection
- Class
- Resultset
49.
When no data is found which of the following will return false
- % rowcount
- %found
- %notfound
50.
What is used to set attributes in callable statement
- *
- $
- #
- ?
51.
JSP means
- java server pages
- java super pages
- 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>
- name
- calss
- type
- id
55.
Which of the following is mutating
- setValue()
- setProperty()
- getProperty()
- getValue()
56.
Jsp pages are compiled into
- java server pages
- servlet
- classes
- 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
- valid
- invalid
- 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
- select
- from
- in
No comments:
Post a Comment