CS506 MIDTERM SOLVED MCQS with references by MOAAZ - VuDaily.com

Dark mode

CS506 MIDTERM SOLVED MCQS with references by MOAAZ



CS506 MIDTERM SOLVED MCQS with references by MOAAZ

CS506 MIDTERM SOLVED MCQS with references by MOAAZ

Click here to download the solution file from here.


 If we remove static from main then program __________.

 Program cannot compile
 Program will compile and work properly
 Run time errors
 Exception throws in main
 4



 If we remove String array from main then program__________.

 Program cannot compile
 Program will compile and work properly
 Run time errors
 Exception throws in main
 3



 Java developed in _________.

 1990
 1995
 1997
 2000
 2



 Which of the following methods are invoked by the AWT to support paint and repaint operations?

 paint( )
 repaint( )
 draw( )
 redraw( )
 1



 When defining a method you must include a ___________ to declare any exception that might be thrown but is not caught in the method.

 try block
 finally block
 catch block
 throws-clause
 4



 Aside from the Scanner class, which of the following classes can be used for text-file file input?

 ObjectInputStream
 BufferedReader
 StringTokenizer
 None of these
 2



 Which of the following statements is true regarding Vectors with no specified base type?

 A base type is needed because Java needs to know how to allocate memory.
 No base type is needed because Java will use the Object class as a base type.
 If a base type is not specified the code will not compile.
 No base type is needed because Vectors default to storing String objects.
 2



 A serializable class must implement the method(s) _________.

 readObject and writeObject
 Either readObject or writeObject, or both, depending upon the desired behavior
 No need to implement any method
 None of the given option
 3



 You can ---------to a network using sockets.

 Read
 Write
 Read/Write
 None of these
 3



 Socket is a --------------communication channel between hosts.

 Uni-directional
 Bi-directional
 Multi-directional
 None of these
 2



 Which of the following are passed as an argument to the paint ( ) method?

 A Canvas object
 A Graphics object
 An Image object
 A paint object
 2



 The code below draws a line. What color is the line?
g.setColor(Color.red.green.yellow.red);
g.drawLine(0, 0, 100,100);

 Red
 Green
 Yellow
 Black
 4



 To create DataBaseMetaData object we write following line of code

 DataBaseMetaData db = con.getMeataData();
 ResultSetMetaData rsmd = rs.getMetaData();
 ResultSetMetaData rsmd = rs.setMetaData();
 DataBaseMetaData db = con.setMeataData();
 1



 Event source can have --------- listeners registered on it.

 Single
 Double
 Triple
 Multiple
 4



 An abstract class --------------- instantiated.

 Can’t be
 Can be
 Must
 None of these
 1



 A ___________ defines the way and method of communication between two parties.

 Compiler
 Protocol
 Tool
 Technique
 2



 What if the static modifier is removed from the signature of the main method?

 The program does not compile
 The program compiles but does not run
 The program compiles and runs properly
 The program throws an exception on compile time
 4



 What if the main method is declared as private?

 The program does not compile…
 The program compiles but does not run
 The program compiles and runs properly
 The program throws an exception on compile time
 2



 A member variable or method prefixed by the protected access modifier can be accessed:

 Within the same class
 Within the sub-class
 Within the same package
 All of the above
 4



 A top-level class without any modifier is accessible to

 any class
 any class within the same package
 any class within the same file
 any subclass of this class
 2

Post a Comment

0 Comments

Was this article useful? Please Leave Your Feedback by writing what's in your mind.