Sie sind auf Seite 1von 33

Model Question Paper Subject Code: BC0047 Subject Name: Java Programming Credits : 4 Part A (One mark questions)

1. ___________ is the ability of an Java application to perform multiple tasks a t the same time. A) Multiprogramming B) Multithreading C) Multiprocessing D) Mul titasking 2. Java is designed for the distributed environment of the Internet, b ecause it handles _________ protocols A) UDP B) TCP/IP C) FTP D) TEL 3. Java is associated with _______ programming Language A) Oak B) Basic C) C D) Perl Marks: 140

4. Which Property does not hold good for Java. A) Object oriented B) Secure C) d ynamic D) Complex 5. A compiler converts the Java program into an intermediate l anguage representation called ____________ A)bytecode B)byte C)byteclass D)bytej ava 6. _____________ Operator is used to create an object. A) class B) new C) pr int D) main 7. Which of the following is NOT a Java Keyword? A) Abstract B) Nati ve C) Package D) Synchronize

8. Java platform consists of JVM and a package of readymade software components this package is known as ___________. A) Java API B) JVM API C) JM API D) API 9. Which of the following is not a Looping statement ____________ A)FOR B)Switch C )while D)Do-While 10. _____________ is a multi way branch statement A) Switch B) continue C) break D) Label 11. Choose the proper operator precedence when evalu ating an Expression? 1. Comparisons 2. Logical operations 3. Increment 4. Arithm etic operations

A) 1-2-4-3 B) 4-3-1-2 C) 2-1-4-3 D) 3-4-1-2 12. The ______ statement is used ins ide the switch to terminate a Statement sequence A) break B) Jump C) exit D) got o 13. A class that is inherited is called a superclass ____________ A) superclas s B) Subclass C) subsetclass D) Relativeclass 14. An _________ determines which features of a class may be used by other classes A) specifier B) inheritance C) implementation D) Access specifier 15. Which property of Java allows the creatio n of hierarchical classifications? A) Interface

B) Inheritance C) Robust D) Distributed 16. Which of the following is WRONG stat ement with respect to rules for overriding Methods? A) The method name and the o rder of arguments should be identical to that of the super class method. B) The return type of both the methods must be the different. C) The overriding method cannot be less accessible than the method it overrides. D) An overriding method cannot raise more exceptions than those raised by the super class. 17. The class at the top of the exception classes hierarchy is called ____________ A) Common B) Throwable. C) NULL D) Catch 18. Find the keyword which is not used to impleme nt exception A) try B) catch C) finally D) access 19. Which of the following is not a Exceptions in Java. A) Arithmetic Exception B) Nullpointer Exception C) Ar rayoutofBounds Exception

D) Logical Exception 20. Which of the following Definitions hold good for Exception? A) Abnormal even t that occurs during program execution and disrupts the normal flow of Instructi on. B) The unexpected situations that may occur during program execution C) The term exception denotes an exception event. D) All the above 21. The _________ cl ass creates and maintains a buffer for an input stream A) Common BufferedInputSt ream B) BufferedStream C) InputStream D) BufferedInputStream 22.A __________ is a sequence of bytes traveling from a source to a destination over a communicatio n path. A) string B) stream C) character D) integer

23. Which of the following statement is the explanation of the int read () metho d A) Reads a byte of data from the input stream B) Reads bytes of data from the input stream and stores them in the array C) Reads the number of bytes specified by the third argument from the input stream and stores. D) Returns the number o f bytes available for reading from the input stream 24. Which method is used to read a byte as an 8-bit signed value? A) Boolean readbyte() B) byte read() C) re adbyte() D) byte readByte() 25. A ___________ is java program that can be embedd ed in a Web page A) Applets B) browser C) package D) None of these 26. A applet tag is written in body tag of ___________ A) HTMM B) HTTP C) HTML D) Applet 27. All applets must be declared as ________. A) Protected

B) Public C) Private D) Static 28.________ method is called the first time an applet is loaded into the memory of a computer A) init method() B) start method() C) stop method() D) destroy met hod() 29.___________ is a set of computer programs that controls the creation, m aintenance, and the use of the database of an organization and its end users A) DBMS B) MS C) BMS D) BDMS 30. _______ provides a database-programming interface for Java programs A) ODBC B) JDBC C) DBMS D) DAT

31. Which of the following is NOT a part of JDBC URL? A) <protocol> B) <subproto col> C) <subname> D) <name> 32. _________package Contains classes that help in connecting to a database A) s ql.java B) mysql.java C) java.sql D) java.mysql 33. RMI stands for A) Remote Met hod Invocation B) Remote method invention C) Remote Memory Interface D) Reduced Method Instructions 34. CORBA stands for A) Common Operation Request Broker Arch itecture B) Common Object Request Bean Architecture C) Common Object Request Bro ker Architecture D) Component Object Request Broker Architecture 35. Which of th e following statements holds good for JavaBeans?

A) JavaBeans allows to efficiently constructing applications by Configuring and Connecting Components called Beans. B) Java beans are used to transfer data in d istributed Systems. C) Java Bean is software component architecture of Java desi gned to use only in one Particular environment D) None of the above. 36.._______ ___ is a Technology used in java programming for objects interacting on differen t platforms across a network. A) Java IDL B) Java OMG C) Java TCP D) Java ORB 37 . Servlets provide an efficient replacement for _______ scripts A) CGI B) GCI C) API D) PIC 38.____________ contains the class libraries that which are needed t o create servlets A) SDK B) JSDK C) JDK D) JAR

39. 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) JS P combines HTML and JDK tools 40. Choose the WRONG Statement A) Java is inherently suited for large client/ser ver applications. B) A servlet is a small pluggable extension to a server that e nhances 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 Fun ctionality of a web server.

Part B (Two mark questions) 41. ----------- is a highly optimized set of instructions designed to be execute d by the Java runtime system, which is called the -------------. A) Bytecode, Ja va Virtual Machine B) Data Code, Java machine C) Source code, Microsystems D) By tecode ,Microsystems. 42. Which of the following is not a java buzzwords? 1. Sim ple 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 43. Two kinds of data types in java are __________and ___________ A) Primitive,standard B) Primitive,A bstaract C) abstract,derived D) constants, variables

44. 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 45. The output of the following Program is A) The sum of Two number is: 30 B) The sum of Two number is: 20 C) The sum of Tw o number is: 10 D) The sum of Two number is: 40

46. What is the output of the following program? A) This program prints the value of i from 0 to 10 B) This program prints the va lue of i from 1 to 100 C) This program prints the value of i from 1 to 9 D) This program prints the value of i from 1 to 10 47.The _______ keyword is used to de rive 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 48. 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) pro tected ,interface B) final,interface C) public,friend D) final,protected

49.The term exception denotes an ________ event .Java handles exceptions the ___ ___________ way. A) exceptional ,object-oriented B) traditional, object-oriented C) exceptional, procedural D) friend ,Public 50. Identify the situations in whi ch 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 a ttributes of a null object. 4. Attempt to access an array element beyond the ind ex of the array A) 1 B) 3 C) 4 D) 2 51. The two major classes for byte streams a re _______ and _______ A) Input,Output. B) byteStream,bitStream. C) InputStream, OutputStream. D) stringStream,stingStream.

52. The ________ and _________ classes are filter streams that allow the reading and Writing of Java primitive data types. A) InputStream, OutputStream B) DataI nputStream, DataOutputStream C) Input,Output. D) byteStream,bitStream. 53. 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) r epaint(),Paint() C) update () , paint () D) Paint(),repaint() 54. Which of the f ollowing method does not belong to graphics class? A. Text B. pixel C. Lines D. Circle and ellipse. 55. To establish a connection with a database, you need to r egister the ODBC-JDBC Driver by calling the __________ method from the Class cla ss and then calling the ________ method from the DriverManager class. A) getConn ection (),forName () B) for () , get () C) get (), for () ,

D) forName (), getConnection () 56. State True or False 1. The sql.java package contains classes that help in connec ting to a database, send SQL statements to the database 2. The Stringset () meth od sets the query parameters of the Prepared Statement Object. A. 1-T,2-T B. 1-T,2-F C. 1-F,2-F D. 1-F,2-T 57. The __________ is used to handle the errors that may occur during the invoca tion of a Remote method. Remote Method Invocation uses _________Protocol A) Inte rface,TCP B) Exception,TCP C) Exception,UDP D) Interface,UDP 58. State True or F alse 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,2-F D. 1-F,2-T

59. 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 col lect 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. P ackage up the data to be presented in the web browser. A) 1-2-5-3-4 B) 2-1-4-5-3 C) 2-1-3-4-5 D) 1-2-4-5-3 60. State True or False 3. Maintenance is the greates t problem in 2-tier Architecture of web architecture. 4. The basic idea behind 3 -tier architecture is that to separate application logic from the user interface A. 1-T,2-T B. 1-T,2-F C. 1-F,2-F D. 1-F,2-T

Part C (Four mark questions) 61. Match the following a. Applications b. Applets i. They are programs that do not need a browser for execution. ii They are collections of classes that can be shared by other Java programs c. Servlets d. Packages iii. This program extends the functionality of Web servers. iv. They is Programs that run off a Web page. A) a-iv, b-ii, c-iii, d-i B) a-i, b-iv, c-iii, d-ii C) a-iii, b-i, c-ii ,d-iv D) a-i, b-iii, c-iv, d-ii 62. Match the following A) a-iv, b-ii, c-iii, d-i B) a-iv, b-i, c-iii, d-ii C) a-iii, b-i, c-ii, d-iv D) a-i, b-iii, c-iv, d-ii

63. State True or False 1. The data members and methods of a class are defined i nside the class body 2. The syntax used to declare a class variable is: <variabl e_name> <data_type> 3. An access Specifier defines where a method can be accesse d A) 1-T, 2-T, 3-F B) 1-F, 2-T, 3-F C) 1-T, 2-T, 3-T D) 1-T, 2-F, 3-T

64. What is the output of the following program? A) ABCDEF ABCDEF B) ABCDEF ABC C) ABC DEF D) ABCDEF CDE

65. Which statements in the program will result in syntax error? 1. class Box { 2. double width; 3. double height; 4. double depth; 5. Box(double w double h dou ble d) 6. { 7. width w; 8. height = h; 9. depth = d; 10. } 11. public String toS tring() { 12. return "Dimensions are " + width + " by " + 13. depth + " by " + h eight + "."; 14. } 15. } 16. class toStringDemo() { 17. public static void main( String args[ ]) { 18. Box b = new Box(10; 12; 14); 19. String s = "Box b: " + b; // concatenate Box object

20. System.out.println(b); // convert Box to string 21. System.out.println(s); 2 2. } 23. } A) 5, 7, 16, 18 B) 8, 9, 19, 20 C) 12,13,16,20 D) 5, 8, 13, 19 66. Find the rela tionship? A) 1= Is-A, 2 = A-Kind-of ,3 = Is-A B) 1= Is-A, 2 = Is-A, 3 = A-Kind-of C) 1= AKind-of, 2 = A-Kind-of , 3 = Is-A D) 1= Is-A, 2 = Is-A, 3 = Is-A

67. This program will results in Error during Compilation because class A { int i; private int j; void setij(int x, int y) { i = x; j = y; } } class B extends A { int total; void sum() { total = i + j; } } class Access { public static void main(String args[]) { B subOb = new B(); subOb.setij(10, 12); subOb.sum(); Syste m.out.println("Total is " + subOb.total); }}

A) Syntax error B) Since i is public C) Since Class B cannot extends A D) Since j is declared as private 68. State true or false? a. Running out of memory is an unexpected situation during program execution b. The try statement can be neste d 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,d-F 69. Match the following Method A B C D void write (int n) void write (byte [] b ) void write (byte [] b, int off, int len ) void flush () i ii iii iv Explanation Writes the specified b yte of data to the output stream. Writes a segment of an array to the output str eams. Writes an array of bytes to the output stream. Force writes whenever the d ata accumulates in the output stream. A) a-iv, b-ii, c-iii, d-i B) a-iv, b-i, c-iii, d-ii

C) a-iii, b-i, c-ii, d-iv D) a-i, b-iii, c-ii, d-iv 70. State True or False 1. The DataInputStream and DataOutputStream classes are filter streams that allo w the reading and writing of user defined data types 2. The DataInputStream class provides the capability to read primitive data types from an input stream 3. The BufferedInp utStream class creates and maintains a buffer for an input stream. 4. BufferedOu tputStream represents filter streams. A)1-T,2-F,3-F,4-F B) 1-T,2-T,3-F,4-F C) 1T,2-T,3-T,4-F D) 1-F,2-T,3-T,4-T 71. State True or false 1. Event handling is es sential 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,3-F,4-T 72. Match the following i. ActionEvent object a. generated when scrollbars and o ther elements are used ii. iii. iv. AdjustEvent object ContainerEvent object Foc usEvent object b. generated when a component is activated c. generated when comp onents are added d. generated when a component receives Focus for input A) i-d, ii-c, iii-a, iv-b B) i-d, ii-b, iii-a, iv-c C) i-b, ii-c, iii-a, iv-d D) i-b, ii -a, iii-c, iv-d 73. What is the objective of the program mentioned below?

A) To initialize Connection object using getconnection () method and to send sim ple queries to the database and process the result set. B) To create statement o bject using createStatement() method and to send simple Queries to the database using executequery () Method. C) To send simple the queries to the database and execute the same using excecutequery () method. D) To load JDBC-ODBC driver and create statement object using executequery () Method. 74. Find the WRONG stateme nts from the List The BeanBox allows you to: 1. Drop beans onto a composition wi ndow.

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 applica tions 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 75. The following flow chart represents Servlet life cycle. Fill the blocks in t he chart

A) 1=servlet s service () method processes the request and returns output to client 2=server unloads the servlet after calling its destroy() method 3=sever calls th e init () method of each servlet instance B)1=sever calls the init () method of each servlet instance 2=server unloads the servlet after calling its destroy() method 3=servlet s service () method processes the request and returns output to client C) 1=sever calls the init () method of each servlet instance 2=servlet method processes the request and returns output to client s service ()

3=server unloads the servlet after calling its destroy() method D) 1=server unloads the servlet after calling its destroy() method 2=sever calls the init () method of each servlet instance 3=servlet s service () method processes the request and returns output to client

Answer Keys Part - A Q. No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Ans. Key B B A D A B D A B A D A A D B B B D D D Q. No. 21 22 23 24 25 26 27 28 29 30 31 32 3 3 34 35 36 37 38 39 40 Ans. Key D B A D A C B A A B D C A C A A A B C C Q. No. 4 1 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Part - B Ans. Key A D B D A A C B A C C B C B D C B C B A Q. No. 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 Part - C Ans. Key B B D D A A D D D D D D C C C

Das könnte Ihnen auch gefallen