Java Programming OOPs
Questions 141 to 150
141.
|
The code
fragment:
char ch = ' ';
try {
ch
= (char) System.in.read();
while(
(ch >= 'A') && (ch <= 'Z'))
ch
= (char) System.in.read();
} catch (Exception e) {
System.out.println("error
found.");
}
can be
expressed equivalently as:
|
||||||||||
What will
the following program print when it is executed?
public
class Practice11 {
public
static void main(String args[]) {
int
i = 0;
while
(i < 3) {
if(
i++ == 0 ) System.out.print("Merry");
if(
i == 1) System.out.print("Merr");
if(
++i == 2) System.out.print("Mer");
else
System.out.print("Oh no!");
}
}
}
|
|||||||||||
Which of
the following is true?
|
|||||||||||
Which
method that executes immediately after the init () method in an applet?
|
|||||||||||
When you
run an applet, which of the following is invoked first?
|
|||||||||||
When you
run the following applet from a browser, what is displayed?
import
javax.swing.*;
public
class Test extends JApplet {
public
Test() {
System.out.println("Default
constructor is invoked");
}
public
void init() {
System.out.println("Init
method is invoked");
}
}
|
|||||||||||
What must A
method declare to throw?
|
|||||||||||
What
information may be obtained from a ResultSetMetaData object?
|
|||||||||||
Which of
the following statements is true?
|
|||||||||||
Which is a
special file that contains information about the files packaged in a JAR
file?
|
Answers
141.
|
Answer : (a)
Reason : Know
the difference between while() and do--while(). Also, make sure you know the
syntax of do--while().
|
Answer : (b)
Reason : This
program exercises your ability to walk through if() statements as well as
post and pre increment. Be sure to carefully walk through the code and don't
forget the while() loop.
|
|
Answer : (a)
Reason : Any
applet must be an instance of java.awt.Applet except this statement remaining
all are false.
|
|
Answer : (b)
Reason : start()
method that executes immediately after
the init() method in an applet
|
|
Answer : (b)
Reason : When
the applet is loaded to the Web browser, the Web browser creates an instance
of the applet by invoking the applet?s default constructor.
|
|
Answer : (a)
Reason : When
the applet is loaded to the Web browser, the Web browser first creates an
instance of the applet by invoking the applet?s default constructor, and then
invokes the init() method
|
|
Answer : (b)
Reason : A
method must declare to throw checked options.
|
|
Answer : (c)
Reason : Number
of columns in the resultset information may be obtained from a
ResultSetMetaData object.
|
|
Answer : (e)
Reason : All
the given statements are with respect to JDBC.
|
|
Answer : (d)
Reason : Manifest
file is a special file that contains information
about the files packaged in a JAR file
|
Thank you very useful
ReplyDelete