You are on page 1of 25

JAVA UNIT-1

Match the following Applicatio ns


They are programs that do not need a brow ser for execution.

Applets

They is Programs that run off a Web page.

Servlets

This program extends the functionality of Web servers.

Packages

They are collections of classes that can be shared by other Java programs

Question2 ----------- is a highly optimized set of instructions designed to be executed by the Java run-time system, which is called the ------------a. Bytecode, Java Virtual Machine b. Data Code, Java machine c. Source code, Microsystems d. Bytecode ,Microsystems. Question3 Java is designed for the distributed environment of the Internet, because it handles _________ protocols a. UDP b. TCP/I P c. FTP d. TEL Question4 Which of the following is not a java buzzwords? 1. Simple 2. Servlets 3. portable 4. Object-oriented 5. Applets 6. Multithreaded a. 4 and 6 only b. 1and 3 only c. 5 and 6 only d. 2 and 5 only Question5 ___________ is the ability of an Java application to perform multiple tasks at the same time. a. Multiprogram ming b. Multithreadi ng c. Multiprocessin g d. Multitasking

UNIT-2
A compiler converts the Java program into an intermediate language representation called ____________ a. byteco de b. byte c. byteclas s d. bytejava Two kinds of data types in java are __________and ___________ a. Primitive,standard b. Primitive,Abstar act c. abstract,derived d. constants, variables Question4 Which of the following is not a java data type? 1. byte 2. register 3. long 4. nibble 5. int 6. char a. 4 and 5 only b. 1and 3 only c. 5 and 6 only d. 2 and 4 only Question5 _____________ Operator is used to create an object. a. clas s b. ne w c. prin t d. mai n

UNIT-3
2 Which of the following is not a Looping statement ____________ a. FOR b. Switc h c. while d. DoWhile Question3 _____________ is a multi way branch statement a. Switc h b. contin ue c. break d. Label

UNIT-4
A class can be declared as _______ if you do not want the class to be subclassed. Using the __________keyword we can abstract a class interface from its implementation a. protected ,interface b. final,interface c. public,friend d. final,protected Question2 A class that is inherited is called a superclass ____________ a. supercla ss b. Subclass c. subsetclas s d. Relativecl ass Question3 An _________ determines which features of a class may be used by other classes a. specifier b. inheritance c. implementation d. Access specifier 5 The _______ keyword is used to derive a class from a superclass. The _________ keyword is used to declare classes that define common properties and behavior of other classes a. Public ,friend b. abstract ,extends , c. extends , abstract d. friend ,Public

UNIT-5
Find the keyword which is not used to implement exception a. try b. catch c. finally d. acces s Question2 Identify the situations in which an null exception is NOT thrown 1. Using an object without allocating memory for it. 2. Calling the methods of a null object. 3. Accessing or modifying the attributes of a null object. 4. Attempt to access an array element beyond the index of the array a. 1 b. 3 c. 4 d. 2 Question3 State true or false? a. Running out of memory is an unexpected situation during program execution b. The try statement can be nested c. A try block must have at least one catch block that follow it immediately d. Three classes are derived from Throwable class a. a-T,b-T,c-F,d-F b. a-T,b-T,c-F,d-T c. a-F,b-T,c-T,d-F d. a-T,b-T,c-T,dF Question4 The class at the top of the exception classes hierarchy is called ____________ a. Common b. Throwabl e. c. NULL d. Catch Question5 The term exception denotes an ________ event .Java handles exceptions the ______________ way. a. exceptional ,objectoriented b. traditional, object-oriented c. exceptional, procedural d. friend ,Public

UNIT-6
Match the following void write (int n)
Writes the specified byte of data to the output stream.

void write (byte [] b )

Writes an array of bytes to the output stream.

void write (byte [] b, int off, int len )

Writes a segment of an array to the output streams.

void flush ()

Force w rites w henever the data accumulates in the output stream.

Question2 A __________ is a sequence of bytes traveling from a source to a destination over a communication path. a. string b. strea m c. charact er d. integer Question3 The two major classes for byte streams are _______ and _______ a. Input,Output. b. byteStream,bitStream. c. InputStream,OutputStre am. d. stringStream,stingStream. Question4 The ________ and _________ classes are filter streams that allow the reading and Writing of Java primitive data types. a. InputStream, OutputStream b. DataInputStream, DataOutputStream c. Input,Output. d. byteStream,bitStream. Question5 The _________ class creates and maintains a buffer for an input stream a. Common BufferedInputStream b. BufferedStream c. InputStream d. BufferedInputStream

UNIT-7
1. Event handling is essential to GUI programming 2. Java programs written to run on world wide web are called as applets 3. Applets cannot run on any browser that supports java 4. Typically GUI programs wait for the user to perform some action a. 1-T,2-T,3-F,4-F b. 1-T,2-F,3-F,4-F c. 1-T,2-T,3-F,4-T d. 1-T,2-T,3F,4-T Question2 A applet tag is written in body tag of ___________ a. HTM M b. HTTP c. HTM L d. Appl et Question3 A ___________ is java program that can be embedded in a Web page a. Applets b. browser c. package d. None of these Question4 The _______ method takes a Graphics class object as a parameter. The ________ method draws the graphics of the applet in the drawing area. a. paint (),update () b. repaint(),Paint() c. update () , paint () d. Paint(),repaint() Question5 Which of the following method does not belong to graphics class? a. Text b. pixel c. Lines d. Circle and ellipse.

UNIT-8
State True or False 1. The sql.java package contains classes that help in connecting to a database, send SQL statements to the database 2. The Stringset () method sets the query parameters of the Prepared Statement Object. a. 1-T,2-T b. 1-T,2-F c. 1-F,2F d. 1-F,2-T Question2 The Statement object allows you to execute simple queries. It has the following three methods executeQuery (), execute Update () ,execute () that can be used for the purpose of querying: Identify the functionality of the methods 1. The _________method executes an SQL INSERT or DELETE statement. 2. The _________ method executes a simple query and returns a single ResultSet object. 3. The _________ method executes an SQL statement that may return multiple results. a. 1-execute () ,2-executeQuery () ,3-executeUpdate () b. 1-executeUpdate (), 2-executeQuery () ,3execute () c. 1-executeQuery (),2-executeUpdate (),3-execute () d. 1-executeUpdate () ,2-execute () ,3-executeQuery () Question3 To establish a connection with a database, you need to register the ODBC-JDBC Driver by calling the __________ method from the Class class and then calling the ________ method from the DriverManager class. a. getConnection (),forName () b. for () , get () c. get (), for () , d. forName (), getConnection () Question4 _______ provides a database-programming interface for Java programs a. ODB C b. JDB C c. DBM S d. DAT Question5 ___________ is a set of computer programs that controls the creation, maintenance, and the use of the database of an organization and its end users a. DBM S b. MS c. BMS d. BDMS

UNIT-9
1. State True or False 1. A Remote Registry Server is a service that runs on a Clint and helps the objects on other hosts to remotely access its registered objects. 2. A local object that invokes a method of a remote object is referred to as a server object, and the remote object whose methods are invoked is referred to as a Client object. 3. A Skeleton is a local object on the client's machine that acts as a proxy for a remote object. 4. RMI exception is used to handle the errors that may occur during the invocation of a method. a. 1-T, 2-T, 3-T, 4-F b. 1-T, 2-T, 3-F, 4-F c. 1-T, 2-F, 3-F, 4-F d. 1-F, 2-F, 3-F, 4-F Question2 CORBA stands for a. Common Operation Request Broker Architecture b. Common Object Request Bean Architecture c. Common Object Request Broker Architecture d. Component Object Request Broker Architecture Question3 Find the WRONG statements from the List The BeanBox allows you to: 1. Drop beans onto a composition window. 2. Create directory for remote user 3. Resize and move beans around. 4. Connect a bean event source to an event handler method. 5. Efficiently construct applications 6. Save and restore sets of beans. 7. Make applets from beans. 8. Generate events that are sent to other objects 9. Get an introspection report on a bean. 10. Add new beans from JAR files. a. 1,3, 5 b. 4,6, 8 c. 2,5, 8 d. 2,4, 6 Question4 Pick the WRONG statement with respect to Selecting as bean in the composition window. a. The currently selected bean is marked with a black boundary. b. The right-hand Property Sheet window shows its properties and the "edit" menu provides access to its events, bound properties, etc. c. To select a bean you must click the mouse just outside of the bean in the boundary area where the blackand-white hashed boundary will appear. d. Some beans won't notice a click on the bean itself, and require you to click in the surrounding border area. Question5 Pick the WRONG statements with respect to running the bean Box. 1. To start the BeanBox first change to the beanbox directory and then type at the command prompt. 2. We need to have the JDK "bin" directory on your path and you should be using JDK 1.1 or later. 3. The BeanBox comes up as three separate windows 4. The left-hand window is the Toolbox palette displaying available beans that can be dropped onto the composition window. a. 1, 3 b. 2, 3 c. 1, 2 d. None of the above Question6 RMI stands for a. Remote Method Invocation b. Remote method invention

c. Remote Memory Interface d. Reduced Method Instructions Question7 State True or False 1. Java IDL is based on the COBOL 2. The stub and the skeleton communicate through Application layer. a. 1-T,2-T b. 1-T,2-F c. 1-F,2F d. 1-F,2-T Question8 The __________ is used to handle the errors that may occur during the invocation of a Remote method. Remote Method Invocation uses _________Protocol a. Interface,TCP b. Exception,T CP c. Exception,UD P d. Interface,UDP Question9 Which of the following statements holds good for JavaBeans? a. Java beans are used to transfer data in distributed Systems. b. JavaBeans allows to efficiently constructing applications by Configuring and Connecting Components called Beans. c. Java Bean is software component architecture of Java designed to use only in one Particular environment d. None of the above. Question10 __________ is a Technology used in java programming for objects interacting on different platforms across a network. a. Java TCP b. Java OMG c. Java IDL d. Java ORB

UNIT-10
Arrange the following steps to complete a request and response in a typical web application 1. Send a request to the web server. 2. Web application will collect data from the user. (First tier) 3. Send it back to the browser for display. (First tier) 4. Run the requested server program. (Second and third tier) 5. Package up the data to be presented in the web browser. a. 1-2-5-3-4 b. 2-1-4-53 c. 2-1-3-4-5 d. 1-2-4-5-3 Question2 Choose the CORRECT statement. a. To write JSP code you require a browser. b. To test the JSPs you need a server engine. c. JSPs looks like HTML script d. JSP combines HTML and JDK tools Question3 Choose the WRONG Statement a. Java is inherently suited for large client/server applications. b. A servlet is a small pluggable extension to a server that enhances the server's functionality c. Java does not support networking. d. When you use servlet to create dynamic content for a web page or otherwise extend the Functionality of a web server. Question4 Servlets provide an efficient replacement for _______ scripts a. CG I b. GCI c. API d. PIC Question5 State True or False 1. Maintenance is the greatest problem in 2-tier Architecture of web architecture. 2. The basic idea behind 3-tier architecture is that to separate application logic from the user interface a. 1-T,2-F b. 1-F,2-F c. 1-T,2T d. 1-F,2-T Question6 State True or False 1.3-tier architecture gives the flexibility to the design of the application as well as ease of Maintenance. 2.In a 2-tier architecture the application logic can be modified without affecting the user Interface and database a. 1-T,2F b. 1-F,2-F c. 1-T,2-T d. 1-F,2-T 8 Which of the following is NOT a step to test JSP? a. Copy the HelloWorld.jsp to note pad b. Now start the Java Web Server's web service. c. Open your browser window. d. In the address bar type in an address, where IP address of your machine. Question9

____________ contains the class libraries that which are needed to create servlets a. SDK b. JSD K c. JDK d. JAR

1 mark
1. & , || , | ,&& is a kind of a. Arithmetic operator b. Logical operator c. Comparison operator d. None of the Above Question2. + , - , * , / is a kind of a. Arithmetic operator b. Logical operator c. Comparison operator d. None of the Above Question3. = = , ! = , < , > is a kind of a. Arithmetic operator b. Logical operator c. Comparison operator d. None of the Above Question4. A class called password authenticates user login .you don't want anybody to change the functionality of the class by extending it.To prevent inheritance , use the_________modifier. a. Access b. Restrict c. Final d. Static Question5. A ___________ block must have at least one catch block that follow it immediately. a. Finally b. Finalize c. Final d. Try Question6. append() method is defined in a. string class b. StringBuffer class c. Work in both d. None of the above Question7. Array is a collection of _________ a. different data type b. same data type c. It has no effect of data type d. Both a and b

Question8. Array occupy ___________ Space in memory. a. Contiguous b. Distinct c. Same d. Depend upon memory Question9. contact() method is defined in a. string class b. StringBuffer class c. Work in both d. None of the above Question10. CORBA stands for:a. Common Object Request Broker Architechure b. Common Object Response Broker Architechure c. Class Object Request Broker Architechure d. Class Object Response Broker Architechure Question11. heart _________ human being. a. A kind of b. Is a c. Part of d. Has a Question12. human being ________ heart. a. A kind of b. Is a c. Part of d. Has a Question13. If any specifier is not defined before class then class is by default a. Public b. Private c. Protected d. Default Question14. if one applet is made under file name MyApplet.java then to execute this file tool used is a. javac b. java c. appletviewer d. appletinvoke Question15. if( condition) is true when condition is a. Boolean true b. Non-zero

c. Zero d. One Question16. In The following which keyword is not used to handle error. a. Try b. Catch c. Finally d. Finalize Question17. In the following which one is exit control loop a. for() b. while() c. do-while() d. if-else() Question18. In the following which one is not a kind of relation ship in java a. A Kind-Of relation ship b. A Is-A relation ship c. A From-A relation ship d. A Has-A relation ship. Question19. In The following which one is not concept of OOPS a. Abstraction b. Polymorphism c. Incapsulation d. Inheritance e. None Of The Above Question20. In the following which one is not part of loop in Java a. for() b. while() c. do-while() d. if-else() Question21. In the following which one is not part of the access specifier a. Public b. Private c. Protected d. Default Question22. In The following which one is not part of the numeric data type a. Byte b. Short c. Int

d. Boolean Question23. In the terminology of java the class that is inherit is called a. Base class b. Super class c. Sub class d. Parent class Question24. It writes an integer to the output stream. a. Void writeChar(int n) b. Void writeLong(long n) c. Void writeInt(int n) d. ByteArrayInputStream(byte [] b) Question25. Java is an ___________ a. Object Oriented Language b. Procedure Oriented Language c. Subject Oriented Language d. Both A and B Question26. Java is ________ a. Interpreted b. Compiled c. Both d. None Question27. Java use _________ class to communicate with system. a. Object b. System c. Thread d. None of the above Question28. Java was developed in lead of a. Patrick Naughton b. James Gosling c. Alfred Vaun hoff d. Mike Sheridan Question29. Java was initially known as ____________ a. Mike b. Sheridan c. Oak d. James Question30. RMI stands for

a. Response mode Invication b. Request Mode Invocation c. Remote Method Invocation d. Request method invocation Question31. Serializable interface is in the___________ package. a. Java.lang.*; b. Java.swing.*; c. Java.awt.*; d. Java.io.* Question32. Simple ,Secure , Portable ,Robust , Object Oriented_______is Known as __________of Java a. Pillers b. Buzz Words c. KeyWords d. Identifiers Question33. The class that does the inheriting is called a. Base class b. Super class c. Sub class d. Parent class Question34. The most important reason for ______________ to make program extensible. a. Globalization b. Generialization c. Localization d. Personalization Question35. The role of compiler is to________ a. Check the syntax of the code. b. Converts the files into it's byte code. c. Both d. None Question36. The stub and Skeleton communicates through a ______________ a. Client/server reference layer b. Remote reference layer c. Server reference layer d. Client reference layer Question37. The total allocated capacity can be found through the _________ a. Length() b. Buffer

c. Capacity() d. Size() Question38. The variable method and inner classes that are declared _____________ Are accessable to the subclasses of the class in which they are declared. a. Public b. Private c. Protected d. Default Question39. The ____________ is the proxy of the client machine object that is located on the remote host. a. Stub b. Skeleton c. Remote d. None Question40. The ____________ method returns a value that contains all of the modifier flags for this event. a. isAltdown() b. isMetaDown() c. getModifiers() d. isShiftDown() Question41. The ____________ Statement in java is multiway branch statement a. break b. continue c. switch d. if() Question42. the _____________ Method can be used to obtain a reference to the item that generated that even a. getModifiers() b. isShiftDown() c. getItem() d. IsControlDown() Question43. The ______________ object allows you to execute simple queries. a. Connection b. Statement c. ResultSet d. Update Question44. This exception is thrown when an application attempts to use null where an object is required. a. Arithmatic Exception b. ArrayIndexOutOfBound Exception c. NullPointerException d. None of the Above

Question45. This package is the smallest package in java a. java.awt.*; b. java.applet.*; c. java.awing.*; d. java.lang.;*; Question46. to avoid naming conflict __________ Is used. a. Class b. Abstract class c. Package d. Identifier Question47. to create new package the keyword which is used is a. createPackage b. newpackage c. package d. none of the above Question48. Using the keyword __________ you can fully abstract a class interface from it's implementation . a. Inherit b. Interface c. Extend d. Import Question49. Using the keyword ___________ , you can fully abstract a class interface from its implementation . a. Inherit b. Extend c. Interface d. import Question50. When ever a subclass need to refer to its immediate superclass .It can do so by use of the keyword a. this b. super c. parent d. extend Question51. Which one is more efficient switch or nested if() a. Switch b. Nested if() c. Both behave same d. None of the Above

2 mark
1. A ___________ statement causes control to be transferred directly to the conditional expression that controls the loop. a. Break b. Continue c. Switch d. If-else() Question2. All applets must be declared __________ a. Public b. Private c. Protected d. Default Question3. Class at the top of the exception classes hierarchy is called a. Exception b. Throwable c. Error d. None of the above Question4. Human being ______________ Mammal. a. A kind of b. Is a c. Part of d. Has a Question5. In overriding of methods the return type of both the methods must be a. Different b. Same c. No effect d. None of the above Question6. In The following which one is not defined by the Applet class. a. init() b. service() c. paint() d. destroy() Question7. In the following which one is not part of the applet life cycle a. init() b. service() c. stop() d. destroy()

Question8. It Force writes whenever the data accumulates in the output stream. a. void write(int n) b. void write(byte [ ] b) c. void write(byte [ ] b , int off, int len) d. void flush() Question9. It reads a Unicode character a. boolean readBoolean() b. byte readByte() c. char readChar() d. int readInt() Question10. It Reads bytes of data from the input stream and stores in the array. a. int read() b. int read( byte [] b) c. int read(byte [] b , int off , int len) d. int available() Question11. It reads one byte and returns true if that byte is nonzero , false if it is zero. a. boolean readBoolean() b. byte readByte() c. char readChar() d. int readInt() Question12. It reads the byte as an 8 bit signed bit. a. boolean readBoolean() b. byte readByte() c. char readChar() d. int readInt() Question13. It sets the pointer to a particular location inside the files a. void seek( long pos) b. long getFilePointer() c. long putFilePointer d. void seek() Question14. It writes specified byte of data to the output stream. a. void write(int n) b. void write(byte [ ] b) c. void write(byte [ ] b , int off, int len) d. void flush() Question15. It Writes the segment of an array to the output stream. a. void write(int n)

b. void write(byte [ ] b) c. void write(byte [ ] b , int off, int len) d. void flush() Question16. Java converts .java file into its ____________ a. .obj b. .bak c. .class d. .object Question17. Ramesh _____________ Mammal. a. A kind of b. Is a c. Part of d. Has a Question18. Sometime it is necessary to process certain statement irrespective of whether an exception is raised or not. The_______block is used for this purpose a. Final b. Finally c. Finalize d. Throws Question19. StringBuffer allocates room for _______________ Additional characters when no special buffer length is required . a. 4 b. 8 c. 16 d. 32 Question20. The BeanBox comes up with the three separate window.The lefthand window shows the a. PropertySheet b. ToolBox palette c. BeanBox Question21. The size of double in Java is _________ a. 64 bits b. 16 bits c. 8 bits d. 32 bits Question22. the start() method is called immediately after the ______________ method. a. init() b. service() c. stop()

d. destroy() Question23. The ____________ Method executes an SQL INSERT , UPDATE , or DELETE statement. a. executeQuery() b. executeUpdate() c. execute() d. executeStatement() Question24. The _____________ Method compares a specific region inside the string with another specific region in another string. a. regionMatches(); b. regionCompres(); c. StringMatches(); d. StringCompares(); Question25. The ______________ class is the filter stream that allow the reading of the java primptive data type. a. Buffered InputStream b. Buffered Output Stream c. Data Input Stream d. Data Output Stream Question26. The ______________ method is called every time the applet looses the focus. a. init() b. service() c. stop() d. destroy() Question27. The _______________ Method returns a reference to the component that was added to or removed from the container a. getContainer() b. getChild() c. getAdjustmentType() d. getAdjustable() Question28. The ________________ method of the connection object takes an SQL statement as a parameter. a. executeQuery() b. executeUpdate() c. PreparedStatement() d. executeStatement() Question29. The _________________ class are used to convert data between the byte and Unicode character streams . a. Buffered Input Stream b. Buffered Output Stream c. Data Input Stream

d. InputStreamReader Question30. There are ____________ Types of Window events. a. 4 b. 5 c. 6 d. 7 Question31. There are _____________ Types of mouse events. a. 4 b. 5 c. 6 d. 7 Question32. To build distributed application The technology used is a. RMI b. Beans c. Servlets d. Swing Question33. To compile Hello.java which one is the correct syntax a. java Hello.java b. javac Hello.java c. javac Hello d. java Hello Question34. To establish a connection with a database , you need to register the ODBC-JDBC Driver by calling the __________ method. a. getConnection() b. Class.forName() c. establishConnection() d. execute() Question35. To handle streams in java the package used is a. java.lang.*; b. java.util.*; c. java.io.*; d. java.awt.*; Question36. To Run Hello.java which one is the correct syntax a. java Hello.java b. javac Hello.java c. javac Hello d. java Hello Question37. trim() is used to

a. remove the special symbol b. to add special symbol c. remove white space d. add white space Question38. _____________is at the top of the event class hierarchy . a. Container event b. Focus event c. Window event d. EventObject

You might also like