SMU - Java Programming-Model Question Paper
SMU - Java Programming-Model Question Paper
B) Multithreading
C) Multiprocessing
D) Multitasking
2. Java is designed for the distributed environment of the Internet, because it handles
_________ protocols
A) UDP
B) TCP/IP
C) FTP
D) TEL
A) Oak
B) Basic
C) C
D) Perl
4. Which Property does not hold good for Java.
A) Object oriented
B) Secure
C) dynamic
D) Complex
5. A compiler converts the Java program into an intermediate language representation called
____________
A)bytecode
B)byte
C)byteclass
D)bytejava
B) new
C) print
D) main
A) Abstract
B) Native
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
A)FOR
B)Switch
C)while
D)Do-While
B) continue
C) break
D) Label
1. Comparisons
2. Logical operations
3. Increment
4. Arithmetic 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 inside the switch to terminate a Statement sequence
A) break
B) Jump
C) exit
D) goto
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
A) Interface
B) Inheritance
C) Robust
D) Distributed
16. Which of the following is WRONG statement with respect to rules for overriding Methods?
A) The method name and the order 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
B) catch
C) finally
D) access
A) Arithmetic Exception
B) Nullpointer Exception
C) ArrayoutofBounds Exception
D) Logical Exception
A) Abnormal event that occurs during program execution and disrupts the normal flow of
Instruction.
21. The _________ class creates and maintains a buffer for an input stream
A) Common BufferedInputStream
B) BufferedStream
C) InputStream
D) BufferedInputStream
A) string
B) stream
C) character
D) integer
23. Which of the following statement is the explanation of the int read () method
A) Boolean readbyte()
B) byte read()
C) readbyte()
D) byte readByte()
A) Applets
B) browser
C) package
D) None of these
A) HTMM
B) HTTP
C) HTML
D) Applet
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 method()
29.___________ 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) DBMS
B) MS
C) BMS
D) BDMS
A) ODBC
B) JDBC
C) DBMS
D) DAT
31. Which of the following is NOT a part of JDBC URL?
A) <protocol>
B) <subprotocol>
C) <subname>
D) <name>
A) sql.java
B) mysql.java
C) java.sql
D) java.mysql
C) Java Bean is software component architecture of Java designed to use only in one
Particular environment
A) Java IDL
B) Java OMG
C) Java TCP
D) Java ORB
A) CGI
B) GCI
C) API
D) PIC
38.____________ contains the class libraries that which are needed to create servlets
A) SDK
B) JSDK
C) JDK
D) JAR
39. Choose the CORRECT statement.
B) A servlet is a small pluggable extension to a server that enhances the server’s functionality
D) When you use servlet to create dynamic content for a web page or otherwise extend the
D) Bytecode ,Microsystems.
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
A) Primitive,standard
B) Primitive,Abstaract
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
47.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
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) protected ,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
A) 1
B) 3
C) 4
D) 2
51. The two major classes for byte streams are _______ 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) DataInputStream, 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) repaint(),Paint()
C) update () , paint ()
D) Paint(),repaint()
54. Which of the following 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 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 ()
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 invocation of a
A) Interface,TCP
B) Exception,TCP
C) Exception,UDP
D) Interface,UDP
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
B) 2-1-4-5-3
C) 2-1-3-4-5
D) 1-2-4-5-3
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 i. They are programs that do not need a browser for execution.
b. Applets ii They are collections of classes that can be shared by other
Java programs
c. Servlets iii. This program extends the functionality of Web servers.
d. Packages iv. They is Programs that run off a Web page.
1. The data members and methods of a class are defined inside the class body
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;
6. {
7. width w;
8. height = h;
9. depth = d;
10. }
14. }
15. }
21. System.out.println(s);
22. }
23. }
A) 5, 7, 16, 18
B) 8, 9, 19, 20
C) 12,13,16,20
D) 5, 8, 13, 19
class A {
int i;
private int j;
i = x;
j = y;
class B extends A {
int total;
void sum() {
total = i + j; }
class Access {
subOb.setij(10, 12);
subOb.sum();
}}
A) Syntax error
B) Since i is public
c. A try block must have at least one catch block that follow it immediately
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
Method Explanation
A void write (int n) i Writes the specified byte of data to the output stream.
B void write (byte [] b ) ii Writes a segment of an array to the output streams.
C void write (byte [] b, int off, int len ) iii Writes an array of bytes to the output stream.
D void flush () iv Force writes whenever the data 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
1. The DataInputStream and DataOutputStream classes are filter streams that allow 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 BufferedInputStream class creates and maintains a buffer for an input stream.
A)1-T,2-F,3-F,4-F
B) 1-T,2-T,3-F,4-F
C) 1-T,2-T,3-T,4-F
D) 1-F,2-T,3-T,4-T
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
C) To send simple the queries to the database and execute the same using
excecutequery () method.
Method.
B) 4,6,8
C) 2,5,8
D) 2,4,6
3=servlet’s service () method processes the request and returns output to client
2=servlet’s service () method processes the request and returns output to client
3=server unloads the servlet after calling its destroy() method
3=servlet’s service () method processes the request and returns output to client
Answer Keys
Part - A Part - B Part - C
Q. No. Ans. Key Q. No. Ans. Key Q. No. Ans. Key Q. No. Ans. Key
1 B 21 D 41 A 61 B
2 B 22 B 42 D 62 B
3 A 23 A 43 B 63 D
4 D 24 D 44 D 64 D
5 A 25 A 45 A 65 A
6 B 26 C 46 A 66 A
7 D 27 B 47 C 67 D
8 A 28 A 48 B 68 D
9 B 29 A 49 A 69 D
10 A 30 B 50 C 70 D
11 D 31 D 51 C 71 D
12 A 32 C 52 B 72 D
13 A 33 A 53 C 73 C
14 D 34 C 54 B 74 C
15 B 35 A 55 D 75 C
16 B 36 A 56 C
17 B 37 A 57 B
18 D 38 B 58 C
19 D 39 C 59 B
20 D 40 C 60 A