2211520100
2211520100
2. Which of these operators can be used to get run-time information about an object?
Option a) getInfo
Option b) Info
Option c) instanceof
Option d) getinfoof
Ans: c) instanceof
4. The order of the three top-level elements of the Java source file are___
Option a) Import, Package, Class
Option b) Class, Import, Package
Option c) Package, Import, Class
Option d) Random order
Ans: c) Package, Import, Class
7. Java language has support for which of the following types of comments?
Option a) block, line, and javadoc
Option b) javadoc, literal, and string
Option c) javadoc, char, and string
Option d) single, multiple, and quote
Ans: a) block, line, and javadoc
8. Command to execute a compiled Java program is:
Option a) javac
Option b) java
Option c) run
Option d) execute
Ans: b) java
9. __ is a mechanism for naming and visibility control of a class and its content.
Option a) Object
Option b) Packages
Option c) Interfaces
Option d) None of the mentioned
Ans: b) Packages
12. Which is the container that doesn't contain title bars and MenuBars but it can have other
components?
Option a) Window
Option b) Frame
Option c) Panel
Option d) Container
Ans: c) Panel
13. Which is used to store data and partial results, as well as to perform dynamic linking,
return values for methods, and dispatch exceptions?
Option a) Window
Option b) Panel
Option c) Frame
Option d) Container
Ans: d) Container
14. AWT has more powerful components like tables, lists, scroll panes, color chooser, tabbed
panes, etc.
Option a) True
Option b) False
Ans: b) False
15. Which are passive controls that do not support any interaction with the user?
Option a) Choice
Option b) List
Option c) Labels
Option d) Checkbox
Ans: c) Labels
17. The classes which inherit RuntimeException are known as unchecked exceptions.
Option a) True
Option b) False
Ans: a) True
19. ___ is used to place important code, it will be executed whether an exception is handled or
not.
Option a) Finalize
Option b) Final
Option c) Finally
Option d) None of the above
Ans: c) Finally
24. The Java Development Kit (JDK) is a software development environment used to develop
Java applications and applets.
Option a) True
Option b) False
Ans: a) True
25. Which class is used to access actual bits or content information of a URL?
Option a) URL
Option b) URLConnection
Option c) URLDecoder
Option d) All of the mentioned
Ans: b) URLConnection
26. _ is thrown to indicate that the IP address of a host could not be determined.
Option a) UnknownHostException
Option b) IOException
Option c) HostNotFoundException
Option d) None of these
Ans: a) UnknownHostException
29. A __ variable is shared by all instances of the class. It exists even before an object is
created.
Option a) abstract
Option b) instance
Option c) interface
Option d) static
Ans: d) static
30. ____ is a wrapper around everything associated with a reply from an HTTP server?
Option a) HTTP
Option b) HttpResponse
Option c) Httpserver
Option d) httpserver
Ans: b) HttpResponse
33. Which of these methods of httpd class is used to read data from the stream?
Option a) getData()
Option b) GetResponse()
Option c) getStream()
Option d) getRawRequest()
Ans: c) getStream()
34. Which of these methods of httpd class is used to get a report on each hit to the HTTP
server?
Option a) log()
Option b) logEntry()
Option c) logHttpd()
Option d) logResponse()
Ans: a) log()
35. Which of these methods are used to find a URL from the cache of httpd?
Option a) findfromCache()
Option b) findFromCache()
Option c) serveFromCache()
Option d) getFromCache()
Ans: b) findFromCache()
36. Which of these variables stores the number of hits that are successfully served out of
cache?
Option a) hits
Option b) hitstocache
Option c) hits_to_cache
Option d) hits.to.cache
Ans: c) hits_to_cache
37. Which of these methods of httpd class is used to write UrlCacheEntry object into the local
disk?
Option a) writeDiskCache()
Option b) writetoDisk()
Option c) writeCache()
Option d) writeDiskEntry()
Ans: a) writeDiskCache()
39. Which of the following functions is used to find the column count of a particular ResultSet?
Option a) getMetaData()
Option b) simple
Option c) getColumnCount()
Option d) parameterized
Ans: c) getColumnCount()
49. Which of the following methods is used to get the length of an array in Java?
Option a) getLength()
Option b) length()
Option c) size()
Option d) length()
Ans: b) length()
52. Which of these classes is used to handle the reading and writing of files in Java?
Option a) FileReader
Option b) BufferedReader
Option c) FileWriter
Option d) All of the above
Ans: d) All of the above
57. Which of the following is true about the String class in Java?
Option a) Strings are mutable
Option b) Strings are immutable
Option c) Strings can be changed directly
Option d) None of the above
Ans: b) Strings are immutable
58. Which of the following is the correct syntax for a comment in Java?
Option a) /* comment */
Option b) // comment
Option c) # comment
Option d) Both a and b
Ans: d) Both a and b
61. Which of these methods is used to determine the length of a string in Java?
Option a) length()
Option b) size()
Option c) getLength()
Option d) getSize()
Ans: a) length()
65. In Java, which of the following is used to check whether two strings are equal?
Option a) equals()
Option b) ==
Option c) compareTo()
Option d) isEqual()
Ans: a) equals()
66. Which of the following is the parent class of all classes in Java?
Option a) Object
Option b) Class
Option c) Java
Option d) Main
Ans: a) Object
68. Which of the following interfaces is implemented by the List class in Java?
Option a) Set
Option b) Collection
Option c) Iterator
Option d) Queue
Ans: b) Collection