Java, Programming Online Test

How can you change the current working directory using an instance of the File class called FileName?
FileName.cwd("DirName")
FileName.chdir("DirName")
The File class does not support directly changing the current directory.
FileName.cd("DirName")
Given the following code import java.io.*; public class Th{ public static void main(String argv[]){ Th t = new Th(); t.amethod(); } public void amethod(){ try{ ioCall(); }catch(IOException ioe){} } } What code would be most likely for the body of the ioCall method
public void ioCall () throws IOException{ DataInputStream din = new DataInputStream(System.in); din.readChar(); }
public void ioCall () throw IOException{ DataInputStream din = new DataInputStream(System.in); din.readChar(); }
public void ioCall (){ DataInputStream din = new DataInputStream(System.in); din.readChar(); }
) public void ioCall throws IOException(){ DataInputStream din = new DataInputStream(System.in); din.readChar(); }
Debuging of servlet is not done by Servlet log();
True
False
Which of the following layout manager is the default Layout Manager for the Frame class in Java
GridLayout 
GridBagLayout 
CardLayout 
FlowLayout 
BorderLayout 
What will be displayed when you attempt to compile and run the following code //Code start import java.awt.*; public class Butt extends Frame{ public static void main(String argv[]){ Butt MyBut=new Butt(); } Butt(){ Button HelloBut=new Button("Hello"); Button ByeBut=new Button("Bye"); add(HelloBut); add(ByeBut); setSize(300,300); setVisible(true); } } //Code end
One button occupying the entire frame saying Hello
Two buttons at the top of the frame one saying Hello the other saying Bye
Two buttons side by side occupying all of the frame, Hello on the left and Bye on the right
One button occupying the entire frame saying Bye
Which isolation level prevents dirty read in JDBC, connection class
TRANSACTION_SERIALIZABLE
TRANSACTION_REPEATABLE_READ. 
TRANSACTION_READ_UNCOMMITTED
TRANSACTION_READ_ COMMITTED
If you run the code below, what gets printed out? String s=new String("Bicycle"); int iBegin=1; char iEnd=3; System.out.println(s.substring(iBegin,iEnd));
Bic
icy
ic
error: no method matching substring(int,char)
What will be the result when you attempt to compile and run the following code?. public class Conv{ public static void main(String argv[]){ Conv c=new Conv(); String s=new String("ello"); c.amethod(s); } public void amethod(String s){ char c='H'; c+=s; System.out.println(c); } }
Compile time error
Compilation and output the string "ello"
Compilation and output the string "Hello"
Compilation and output the string elloH
What is byte code in the context of Java?
It is another name for comments written within a program.
The type of code generated by a Java Virtual Machine
The type of code generated by a Java compiler
It is the code written within the instance methods of a class.
It is another name for a Java source file
JDBC-ODBC Bridge does not support multiple concurrent open statements per connection ?
True
False
Which of the following helps in garbage collection?
finally
final
finalizer
finalize
Is the JDBC-ODBC bridge multithreaded ?
True
False
Which method will cause a Frame to be displayed?
displayFrame( ) 
show( )
setVisible( )
display( )
Which of the following denote the type of servlet?
HttpServlet
GenericServlet
Both (A) and (B)
None of the Above
ResultSet.CONCUR_UPDATABLE used with the result set is used to update the rows directly in the database.
True
False
Bean methods can be called by other Beans or via scripting languages.
True
False
Which of the following statements are true?
private methods cannot be overloaded
Methods cannot be overriden to be more private
An overloaded method cannot throw exceptions not checked in the base class
static methods cannot be overloaded
IOException is thrown by the read method defined in InputStream class
True
False
What is the output of the following code? import java.util.*; public class Example {     final Vector v;     public Example()    {    } }
The above code will compile and throw a Runtime Exception
The above code will compile and not throw any Exception during runtime. V is initialized to null
The above code will not compile, Vector v is not initialized
None of the Above.
Which of the following describes the correct sequence of the steps involved in making a connection with a database. 1. Loading the driver 2. Process the results. 3. Making the connection with the database. 4. Executing the SQL statements.
1,4,2,3
1,2,3,4
4,1,2,3 
1,3,4,2
Description:

This is a test on JAVA, Programming Language which incorporates C, C++ in its syntex
Disclaimer: Content, such as images used in the questions (if any), have been picked up from various places for the sole purpose of Instruction.

Discussion

nehajain

flowlayout manager is the default layout in java in question 4
plz check it out

3247 days 11 hours 14 minutes ago

Your Facebook Friends on WizIQ

More Tests By Author

ASP Server Controls
10 Questions | 667 Attempts

ASP.NET, Namespaces ASP.NET
10 Questions | 2028 Attempts

An ASP.NET Application
10 Questions | 437 Attempts