Java Programming Questions and Answers Set 27

Java Programming OOPs

Questions 261 to 270



261.
When an applet container encounters an HTML file that specifies an applet to execute, the applet container automatically loads ________ of the applet from the same directory as that of the HTML file.
(a)
the .java file
(b)
the .class file
(c)
the main line
(d)
the .htm file
(e)
the .jva file.
262.
Which of the following is the default Layout Manager for an Applet?
(a)
FlowLayout
(b)
BorderLayout
(c)
GridLayout
(d)
CardLayout
(e)
MarginLayout.
263.
Single-line comments that should be ignored by the compiler are denoted using
(a)
Two forward slashes ( // )
(b)
A slash and a star ( /* )
(c)
System.out.println
(d)
System.out.print
(e)
One forward slash.
264.
Which of the following escape sequences represents carriage return?
(a)
\n
(b)
\r
(c)
\\
(d)
\c
(e)
\\r.
265.
What is the value of result after the following Java statements execute?
int a, b, c, d;
a = 4;
b = 12;
c = 37;
d = 51;
result = d % a * c + a % b + a;
(a)
119
(b)
  51
(c)
127
(d)
  59
(e)
159.
266.
List the following operators in the order that they will be evaluated: -, *, (), %, +, /.  Assume that if two operations have the same precedence, the one listed first will be evaluated first.
(a)
()/*%+-
(b)
-+%*/()
(c)
-*()%+/
(d)
()*/%-+
(e)
/,  *,  (),  %,  -,  +.
267.
If ClassA extends ClassB, then
(a)
ClassA is a superclass
(b)
ClassB is a base class
(c)
ClassB is a subclass
(d)
ClassB is a derived class
(e)
ClassA is a base class.
268.
Which exception is thrown by the getConnection() method of the DriverManager class?
(a)
ConnectionNotFoundException
(b)
IOException
(c)
SQLException
(d)
ReadException
(e)
DataExecption.
269.
Which of the following is valid to open a database connection?
(a)
Connection con = DriverManager.getConnection(url, userid, password);
(b)
Connection con = DriverManager.getConnection();
(c)
Connection con = new DriverManager.getConnection();
(d)
Connection con = DriverManager.openConnection(url);
(e)
Connection con = new DriverManager.openConnection();.
270.
What does the following code do?
smt=con.createStatement();
(a)
A Prepared Statement object is created to send sql commands to the database
(b)
A Statement object is created to send sql commands to the database
(c)
A callable Statement is created to send sql commands to the database
(d)
A Statement object is created to execute parameterise SQL commands
(e)
A Default Statement object is created to send sql commands to the database.

Answers


261.
Answer : (b)
Reason  :       the .class file
262.
Answer : (a)
Reason  :       FlowLayout is the default Layout Manager for an Applet
263.
Answer : (a)
Reason  :       Two forward slashes ( // ).
264.
Answer : (b)
Reason  :       The escape sequence represents carriage return is . \r.
265.
Answer : (a)
Reason  :       the result of the above expression is 119.
266.
Answer : (d)
Reason  :       The correct order is  (), *, /, %, -, +.
267.
Answer : (b)
Reason  :       ClassB is a base class.
268.
Answer : (c)
Reason  :       SQLException is thrown by the getConnection() method of the Driver Manager classs.
269.
Answer : (a)
Reason  :       Connection con=DriverManager.getConnection(url, userid, password);  is valid to open a database connection
270.
Answer : (b)
Reason  :       A Statement object is created to send sql commands to the database.
<< Prev   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  Next >>


No comments :

What you think about these Questions and Answers ? Let me know in comments.

Post a Comment