Javaq 1 - Java MCQ\'s PDF

Title Javaq 1 - Java MCQ\'s
Author Altu Faltu
Course Bsc (computer science)
Institution Savitribai Phule Pune University
Pages 13
File Size 461.9 KB
File Type PDF
Total Downloads 114
Total Views 133

Summary

Java MCQ's...


Description

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

Seat No Total number of questions : 60 11393_CS 335 PROGRAMMING IN JAVA I Time : 1hr Max Marks : 50 N.B 1) All questions are Multiple Choice Questions having single correct option. 2) Attempt any 50 questions out of 60. 3) Use of calculator is allowed. 4) Each question carries 1 Mark. 5) Specially abled students are allowed 20 minutes extra for examination. 6) Do not use pencils to darken answer. 7) Use only black/blue ball point pen to darken the appropriate circle. 8) No change will be allowed once the answer is marked on OMR Sheet. 9) Rough work shall not be done on OMR sheet or on question paper. 10) Darken ONLY ONE CIRCLE for each answer.

Q.no 1. Which method is used to set the graphics current color to the specified color in the graphics class? A : public abstract void Color(Color C)

C : public abstract void drawString(String str, int x, int y) D : public abstract void Color() Q.no 2. What is used to run an Applet? A : An AppletViewer tool(for testing purpose) B : An html file

D : None of the above Q.no 3. Give the abbreviation of AWT? A : Applet Windowing Toolkit

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

1/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

C : Absolute Windowing Toolkit D : Absolute Windowing Tools Q.no 4. Which are passive controls that do not support any interaction with the user? A : Choice B : List C : Checkbox

Q.no 5. Exception is a class/interface/abstract class/other?

B : Interface C : Abstract class D : Other Q.no 6. Which of this method of class StringBuffer is used to concatenate the string representation to the end of invoking string? A : concat()

C : join() D : concatenate() Q.no 7. Which of these keywords must be used to handle the exception thrown by try block in some rational manner? A : try

C : throw D : finaly Q.no 8. Which of these keywords is not a part of exception handling? A : try B : catch

D : finaly https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

2/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

Q.no 9. Which method is called only once during the run time of your applet? A : stop() B : paint() C : destroy()

Q.no 10. Which of the following classes can catch all exceptions which cannot be caught? A : RuntimeException

C : Exception D : ParentException Q.no 11. Which AWT component is not editable? A : Button B : Label C : FlowLayout

Q.no 12. Which method is used to check the status of checkbox? A : getStatus( )

C : isChecked( ) D : getChecked( ) Q.no 13. Which of the following is true about interfaces in java? Consider an interface that has 5 methods in it. A : A class can implement few methods which is required for the class.

C : The class must not implement the five methods. D : The class can extends few methods. Q.no 14. When comparing java.io.BufferedWriter and java.io.FileWriter, which capability exist as a method in only one of two ? A : closing the stream https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

3/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

B : flushing the stream C : writting to the stream

Q.no 15. Which of these values are returns under the case of normal termination of a program?

B:1 C:2 D:3 Q.no 16. Which is a component in AWT that can contain another components like buttons, textfields, labels etc.? A : Window

C : Panel D : Frame Q.no 17. What is the value of “d” in the following Java code snippet? Double d = Math.round ( 2.5 + Math.random() ); A:2

C:4 D : 2.5 Q.no 18. Button Control implements following listener interface. A : ItemListener

C : FlowListener D : Adapter Q.no 19. Which of the following statement is correct?

B : reverseall() method reverses all characters https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

4/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

C : replace() method replaces first occurrence of a character in invoking string with another character D : replace() method replaces last occurrence of a character in invoking string with another character Q.no 20. Which are the common security restrictions in applets? A : Applets can't load libraries or define native methods B : An applet can't read every system property C : Applets can play sounds

Q.no 21. Which part of code gets executed whether exception is caught or not? A : try B : catch C : throw

Q.no 22. Which class cannot be sub classed?

B : Object class C : abstract class D : child class Q.no 23. Which one is correct declaration for implementing two interfaces? Consider, Interface A and B. class C wants to implements both interfaces. A : class C implements A, implements B

C : class C implements A extends B D : class C extends A extends B Q.no 24. The ActionListener interface is used for handling action events,For example,it's used by a A : JButton B : JCheckbox C : JMenuItem https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

5/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

Q.no 25. Which of the following applet tags is legal to embed an applet class named Test into a webpage? A : B : code=Test.class width=200 height=100>

D :

Q.no 26. Which of these operators can be used to get run time information about an object? A : getInfo B : Info

D : getinfoof Q.no 27. Which of the following keyword is used by calling function to handle exception thrown by called function?

B : throw C : try D : catch Q.no 28. What is subclass in java?

B : A subclass is a class declared inside a class C : A subclass is a class declared outside a class D : A subclass is a class declare inside a interface Q.no 29. __________ method returns currently selected item in choice. (a) getSelectedItem( ) (b) getSelectedElement( )

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

6/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

(c) getSelectedIndex( ) (d) getItem( ) A : Both a & d B : only b C : a ,b, c & d

Q.no 30. Which of the following methods can be used to draw the outline of a square within a java.awt.Component object? (A) fillRect() (B) drawLine() (C) drawRect() (D) drawString() (E) drawPolygon()

B : C), (D) & (E) C : (A), (B), (C) & (E) D : A), (B) & (C) Q.no 31. which of the following is true about methods in an interface in java?

B : We can define a method in an interface C : Private and protected access modifiers can also be used to declare methods in interface D : We can define a constuctor in an interface Q.no 32. The method ___________ places a Menu m into the MenuBar mb. (a) mb.addMenuItem(m) (b) mb.addItem(m) (c) mb.add(m) A : only a B : only b

D : All the above Q.no 33. Which of the following is true about AWT and Swing components. A : AWT components creates a process where as swing components creates a thread https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

7/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

B : AWT components creates a thread where as swing components creates a process

D : Both AWT and swing components creates a thread Q.no 34. Which applet java.awt.component class provides the life cycle method?

B : public void destroy() C : public void stop() D : public void init() Q.no 35. Which of these exceptions handles the divide by zero error?

B : MathException C : IllegalAccessException D : IllegarException Q.no 36. Which of these method of Object class can generate duplicate copy of the object on which it is called?

B : copy() C : duplicate() D : dito() Q.no 37. What are the different types of controls in AWT? A. Labels B. Pushbuttons C. Checkboxes D.Choice lists A : A,B &C

C : B, C & D D : A,C &D Q.no 38. Which of these methods of class StringBuffer is used to extract a substring from a String object?

B : Substring() https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

8/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

C : SubString() D : sub() Q.no 39. Which keyword is used to declare an interface in java? A : class

C : implements D : abstract Q.no 40. False statement about Java interface A : It is used to achieve abstraction and multiple inheritance in Java.

C : There can be only abstract methods in the interface not method body. D : Object of an interface cannot be created. Q.no 41. The setBackground() method is part of the following class in java.awt package:

B : Graphics C : Container D : Applet Q.no 42. Which method is used to process mouse click? A : public void mouseClicked(MouseListener m) B : public void mouseIsClicked(MouseEvent m)

D : public void mouseClick(MouseEvent m) Q.no 43. Which of the following methods can be used to remove a java.awt.Component object from the display? A : remove()

C : disappear() D : delete() https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

9/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

Q.no 44. How many types of controls does AWT support? A:5 B:6

D:8 Q.no 45. Which of these class contains only floating point functions?

B : Process C : System D : Object Q.no 46. Which class provides many methods for graphics programming? A : java.awt B : java.Graphics

D : None of the above Q.no 47. Which is a special type of program that is embedded in the webpage to generate the dynamic content? A : Package

C : Browser D : None of the above Q.no 48. Which of these class is related to all the exceptions that are explicitly thrown? A : Error B : Exception

D : Throw Q.no 49. Which is a component in AWT that can contain another component like buttons, text fields, labels etc.? A : Window https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

10/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

C : Panel D : Frame Q.no 50. MouseEvent is subclass of which of the following class? A : ComponentEvent B : ContainerEvent C : ItemEvent

Q.no 51. Which of these events will be notified if scroll bar is manipulated? A : ActionEvent B : ComponentEvent

D : WindowEvent Q.no 52. Which of these classes are the direct subclasses of the Throwable class? A : RuntimeException and Error class B : Exception and VirtualMachineError class

D : IOException and VirtualMachineError class Q.no 53. Which of these methods is used to write() into a file? A : put() B : putFile()

D : writeFile() Q.no 54. In which process, a local variable has the same name as one of the instance variables? A : Serialization

C : Abstraction D : Multi-threading https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

11/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

Q.no 55. To use the ActionListener interface it must be implemented by a class there are several ways to do that find in the following? A. Creating a new class B. Using the class the graphical component C. An anonymous inner class A:A&B B:A&c

D:B&C Q.no 56. How can we delete all files in a directory?

B : Files.deleteDir() C : Directory.delete() D : Directory.delete(path) Q.no 57. What is a listener in context to event handling? A : A listener is a variable that is notified when an event occurs

C : A listener is a method that is notified when an event occurs D : None of the above Q.no 58. What is the use of \w in regex? A : Used for a whitespace character B : Used for a non-whitespace character

D : Used for a non-word character Q.no 59. What do you mean by nameless objects? A : An object created by using the new keyword. B : An object of a superclass created in the subclass. C : An object without having any name but having a reference.

Q.no 60. What will be the output of the following Java program? class output { https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

12/13

16/10/2020

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

public static void main(String args[]) { String s1 = "Hello"; String s2 = s1.replace('l','w'); System.out.println(s2); }} A : hello B : helwo C : hewwo

https://sppu.wheebox.com/WAC-3/allqusdownloadhtml.ils?testNo=1162&code=1052000&showTest=1037&actForm=edit&set=1

13/13...


Similar Free PDFs