Complete WT
Complete WT
Complete WT
WEB TECHNOLOGY
Web Technology
Course Outcome ( CO)
At the end of course , the student will be
able to understand
CO 1 Explain web development Strategies and Protocols governing Web..
CO 5 Building enterprise level applications and manipulate web databases using JDBC
Unit Topic
Introduction: Introduction and Web Development Strategies, History of Web and Internet,
Protocols Governing Web, Writing Web Projects, Connecting to Internet, Introduction to
I Internet services and tools, Introduction to client-server computing. Core Java: Introduction,
Operator, Data type, Variable, Arrays, Methods & Classes, Inheritance, Package and Interface,
Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event
handling, Introduction to AWT, AWT controls, Layout managers
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type
II definition, XML: DTD, XML schemes, Object Models, presenting and using XML, Using
XML Processors: DOM and SAX, Dynamic HTML
Scripting: Java scriAJAXpt: Introduction, documents, forms, statements, functions, objects;
introduction to Networking : Internet Addressing, InetAddress, Factory Methods, Instance
III Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle,
V Handling HTTP get Requests, Handling HTTP post Requests, Redirecting Requests to Other
Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page
Example, Implicit Objects, Scripting, Standard Actions, Directives, Custom Tag Libraries.
1 University Academy
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Solved MCQ
Topic Page
2 University Academy
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
WEB TECHNOLOGY 2020-21
6 University Academy
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
WEB TECHNOLOGY 2020-21
14 University Academy
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
WEB TECHNOLOGY 2020-21
18 University Academy
WEB TECHNOLOGY 2020-21
19 University Academy
WEB TECHNOLOGY 2020-21
20 University Academy
WEB TECHNOLOGY 2020-21
21 University Academy
WEB TECHNOLOGY 2020-21
22 University Academy
WEB TECHNOLOGY 2020-21
23 University Academy
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
WEB TECHNOLOGY 2020-21
25 University Academy
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
WEB TECHNOLOGY 2020-21
28 University Academy
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21
38 University Academy
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
WEB TECHNOLOGY 2020-21
45 University Academy
WEB TECHNOLOGY 2020-21
46 University Academy
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
WEB TECHNOLOGY 2020-21
49 University Academy
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
WEB TECHNOLOGY 2020-21
51 University Academy
WEB TECHNOLOGY 2020-21
52 University Academy
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
WEB TECHNOLOGY 2020-21
54 University Academy
WEB TECHNOLOGY 2020-21
55 University Academy
WEB TECHNOLOGY 2020-21
56 University Academy
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
WEB TECHNOLOGY 2020-21
59 University Academy
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
Unit 1st Web Technology (KCS-602)
Multi Choice Questions (MCQ)
Q1. The communication protocol used by the Internet to transfer hypertext
documents is ___
(A) Hyper Text Internet Protocol
(B) Hyper Text Transfer Protocol
(C) Internet protocol
(D) File Transfer Protocol
Ans: B
Q2. The _____ attribute is used to specify the value to be stored in the
variable if an option is selected.
(A) SIZE
(B) VALUE
(C) CHECKED
(D) TYPE
Ans: B
Q3. Transferring your HTML code from one machine to server is known as
___
(A) Indexing
(B) Hosting
(C) Serving
(D) Sorting
Ans: B
Q8. Which program is used by web clients to view the web pages?
(A) Web browser
(B) Protocol
(C) Web server
(D) Search Engine
Ans: A
Q9. What is the name of the location address of the hypertext documents?
(A) Uniform Resource Locator
(B) Web server
(C) File
(D) Web address
Ans: A
Q13. Who send the requisition for web pages to the web servers?
(A) Node
(B) System
(C) Web clients
(D) Web customer
Ans: C
Q14. Name any one text editor program.
(A) HTML
(B) FrontPage
(C) Notepad
(D) MS Paint
Ans: C
Q15. Implement the Listener interface and overrides its methods is required to perform in
event handling.
A. True
B. False
Ans: A
Q16. When we invoke repaint() for a java.awt.Component object, the AWT invokes the
method:
A. draw()
B. show()
C. update()
D. paint()
Ans: D
Q19. Which of these packages contains all the classes and methods required for even
handling in Java?
A. java.applet
B. java.awt
C. java.awt.event
D. java.event
Ans: C
Q25. FileNotFoundException
A. Is a subclass/extends IOException
B. Is a Compile time exception
C. Found in java.io package
D. All
Ans D
Q26. IOException
A. Found in java.io package
B. Is a Compile time exception
C. Is a subclass/extends Exception
D. All
Ans D
Q30. In Servlet Terminology what provides runtime environment for JavaEE (j2ee)
applications. It performs many operations that are given below:
Q33. Applets cannot make network connection exception to the server host from which it
originated.
a. True
b. False
ANSWER: True
Q36. Internet access by transmitting digital data over the wires of a local telephone network is
provided by _______
a) leased line
b) digital subscriber line
c) digital signal line
d) digital leased line
Answer: b
Q38. Which one of the following is not an application layer protocol used in internet?
a) remote procedure call
b) internet relay chat
c) resource reservation protocol
d) local procedure call
Answer: c
Q39. Which one of the following is not used in media access control?
a) ethernet
b) digital subscriber line
c) fiber distributed data interface
d) packet switching
Answer: d
Q40. The process of transferring files from a computer on the Internet to your computer is
called
A.Uploading
B.Forwarding
C.FTP
D.Downloading
Answer :D. Downloading
Q41. The facilities available in the internet are
(i) electronic mail
(ii) remote login
(iii)file transfer
(iv)word processing
a. i, ii
b. i, ii, iii
c. i, ii, iv
d. ii, iii and iv
Ans: b
Q47. What will happen if two thread of the same priority are called to be processed
simultaneously?
a) Anyone will be executed first lexographically
b) Both of them will be executed simultaneously
c) None of them will be executed
d) It is dependent on the operating system
Answer: d
Q50. What is the name of the thread in the following Java Program?
class multithreaded_programing
{
public static void main(String args[])
{
Thread t = Thread.currentThread();
System.out.println(t);
}
}
a) main
b) Thread
c) System
d) None of the mentioned
Answer: a
Unit 2nd Web Technology (KCS-602)
Multi Choice Questions (MCQ)
Q1. The advantages of XML over HTML are
(i) It allows processing of data stored in web-pages
(ii) It uses meaningful tags which aids in understanding the nature of a document
(iii)Is simpler than HTML
(iv)It separates presentation and structure of document
a. (i),(ii) and (iii)
b. (i),(ii) and(iv)
c. (ii),(iii) and (iv)
d. (i),(iii) and (iv)
Ans: b
Q2. A …….. include the protocol the browser uses to access the file, server to domain name, the
relative path and the file name.
A. complete URL
B. incomplete URL
C. site URL
D. Web URL
Ans: A. complete URL
Q6. Your web browser may be able to play some types of files directly. Whenever your web browser
encounters a file it cannot play.
A. It does not execute the file
B. It displays an error message
C. It copies the files to your computer and runs the helper application.
D. None of the above
Ans: C. It copies the files to your computer and runs the helper application.
Q7. Which of the following tags do not require a terminator.
A. <U>
B. <BR>
C. <B>
D. None of the above
Ans: B. <BR>
Q9. The TCP/IP is an implied suite of protocols that has been made standard by
A. UN Secretary of Defense
B. International Standard Organization(ISO)
C. The Internet Engineering Task Force
D. None of the above
Ans: A. UN Secretary of Defense
Q12. What do you think is not correct in regard to the E-mail system?
A. Using encryption you could electronically deliver confidential documents saving time and money
B. Limited only to Local Area Network
C. Cost of sending messages across the world is same as that of sending across the city.
D. If the recipient is not around, the message is delivered to his mailbox.
Ans: B. Limited only to Local Area Network
Q13. The tag to give visual division between sections of the page, and which causes the browser
to draw an embossed line is
A. <HL>
B. <HR>
C. <UR>
D. None of the above
Ans: B. <HR>
Q14. The ……attribute specifies the relationship between the linked and current document.
A. rel
B. size
C. type
D. face
Ans: A. rel
Q15. The web relies on the following mechanisms to make its resource readily available
A. A uniform naming scheme
B. Protocols
C. Hypertext
D. All of the above
Ans: D. All of the above
Q16. What is the correct HTML for making a text input field?
A. <input type=”textfield”/>
B. <textinput type=”text”>
C. <textfield>
D. <input type=”text”/>
Ans: D. <input type=”text”/>
Q17. The XML format has a simpler set of …………………… than HTML.
A) loader rule
B) parsing rules
C) generator rule
D) logical rule
Ans: B) parsing rules
Q23. In XML the attribute value must always be quoted with ……………..
A) double quotes
B) single quotes
C) both a and b
D) name of attributes
Ans: A) double quotes
Q24. Elements from the HTML namespace are displayed as they would in …………………..
A) DHTML
B) XML
C) HTML
D) DXML
Ans: C) HTML
Q25. An ……………….. block can be to embed a CSS style sheet within an XML document.
A) <bk:Book>
B) <Element Type>
C) <HTML:STYLE>
D) <XML:STYLE>
Ans: C) <HTML:STYLE>
Q27. The symbol that identifies the “href” attribute as the name of a NAME anchor rather
than an address or file name is
A. “&”
B. “$”
C. “#”
D. “!”
Ans: C. “#”
Q28. The ………. tag defines the relationship between a document and an external resource.
A. <src>
B. <href>
C. <anchor>
D. <link>
Ans: D. <link>
Q29. The value of display property ………………….. create a block for the list box and an
inline box for items.
A) list-item
B) run-in
C) inline-block
D) block
Ans: A) list-item
Q30. State whether the following statements about CSS property are True or False.
i) The default value for “empty-cells” property is hidden.
ii) The default value for “float” property is none.
A) i-True, ii-True
B) i-False, ii-True
C) i-True, ii-False
D) i-False, ii-False
Ans: B) i-False, ii-True
Q31. Which of the following is/are the named values of the font-weight property.
i) normal ii) bold iii) none iv) lighter
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
Ans: C) i, ii and iv only
Q32. ………………….. property defines the minimum number of lines of a paragraph that
must be left at the bottom of a page.
A) Outline
B) Orphans
C) Overflow
D) Padding
Ans: B) Orphans
Q33. State whether the following statements are True or False for orphans property in CSS.
i) The default value is 2 if unspecified.
ii) Negative values may not be used in this property.
iii) It is really meaningful for print output.
A) True, True, False
B) False, True, False
C) False, True, True
D) True, True, True
Ans: D) True, True, True
Q34. ………………. property is similar to the align attribute available with (X)HTML block-
level tags such as <P>.
A) text-align
B) text-direction
C) text-layout
D) text-indent
Ans: A) text-align
Q35. The …………………. property is often used with the element and its associated pseudo-
classes to turn off link underlining or set different looks for hover or visited states.
A) text-align
B) text-decoration
C) text-layout
D) text-indent
Ans: B) text-decoration
Q36. Which of the following is/are the values of text-decoration properties.
i) blink ii) inherit iii) strike-through iv) over-line
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
Ans: C) i, ii and iv only
Q37. The default value of the text-indent property, which specifies the indent in the first line of
a block-level element is …………..
A) 0
B) 1
C) 2
D) 3
Ans: A) 0
Q38. The value of ………………… is used to override any inherited text-transform values.
A) default
B) none
C) inherit
D) override
Ans: B) none
Q39. The ……………….. value of white-space property collapses multiple white space
characters into single spaces and automatically wraps lines.
A) normal
B) auto
C) pre
D) wrap
Ans: A) normal
Q40. The ……………….. value of white-space property collapses white space, save new-lines,
which are preserved.
A) normal
B) pre
C) pre-line
D) pre-swrap
Ans: C) pre-line
Q41. The value of white-space property ………………… breaks newlines that would cause text
to break out of an element’s box.
A) normal
B) pre
C) pre-line
D) pre-wrap
Ans: D) pre-wrap
Q43. The ………………… property defines a laying or stacking context for positioned
elements.
A) X-index
B) Y-index
C) Z-index
D) index
Ans: C) Z-index
Q44. The ……………….. value used in Z-index property tries to determine the Z-placement of
an element automatically by its markup position in the document.
A) default
B) auto
C) inherit
D) auto-markup
Ans: B) auto
Q45. Which of the following provides options to parse XML, XPath and XSLT using Java
Collections Framework and provides support for DOM, SAX and JAXP?
A - XPath Parser
B - DOM4J Parser
C - JDOM Parser
D - StAX Parser
Ans: B
Q46. Which of the following is true about SAX parsing?
A - SAX parser reads an XML document from top to bottom, recognizing the tokens that make up
a well-formed XML document.
B - SAX parser reports the application program the nature of tokens that the parser has
encountered as they occur
C - The application program provides an 'event' handler that must be registered with the parser.
D - All of the above.
Ans: D
Q47. Consider a system which is memory & speed constraint. The application is to process
XML documents, sort the contents and mail them to a higher configuration machine for
transformation. Which is the best approach?
A. Use platform native language to process the docuements
B. Use DOM based approach.
C. Using SAX based approach is the best.
D. DOM and SAX must be used in this context.
Answer : b
A. <italic>
B. <it>
C. <i>
D. <il>
Ans: C
A. Curly
B. Round
C. Squart
D. Angle
Ans: D
Q51. How do you display a border like this: The top border = 10 pixels, The bottom
border = 5 pixels, The left border = 20 pixels and The right border = 1pixel?
A. border-width:10px 1px 5px 20px;
B. border-width:5px 20px 10px 1px;
C. border-width:10px 20px 5px 1px;
D. border-width:10px 5px 20px 1px;
Ans: A
Unit 3rd Web Technology (KCS-602)
Multi Choice Questions (MCQ)
A. Undefined
B. Number
C. Boolean
D. Float
Ans : D
2. Which company developed JavaScript?
A. Netscape
B. Bell Labs
C. Sun Microsystems
D. IBM
Ans : A
3. Inside which HTML element do we put the JavaScript?
A. <script>
B. <head>
C. <meta>
D. <style>
Ans : A
A. alert-box("Letsfindcourse");
B. confirm("Letsfindcourse");
C. msgbox("Letsfindcourse");
D. alert("Letsfindcourse");
Ans : D
A. Letsfindcourse 30
B. 30
C. Letsfindcourse30
D. Exception
Ans : C
A. Alert
B. Prompt
C. Confirm
D. All of the above
Ans : D
11. What is the full form of AJAX?
A. Asynchronous JavaScript and XML
B. Asynchronous JavaScript amount XML
C. Asynchronous JavaScript and HTML
D. None of these
Ans : A
25. The URLConnection class can be used to read and write data to the
specified resource referred by the URL?
A) True
B) False
Ans: A
27. In InetAddress class which method it returns the host name of the IP
Address?
A) public String getHostName()
B) public String getHostAddress()
C) public static InetAddress getLocalHost()
D) None of the above
Ans: A
32. Which of these methods is used to know the full URL of an URL
object?
a) fullHost()
b) getHost()
c) ExternalForm()
d) toExternalForm()
Ans: D
import java.net.*;
class networking
{
public static void main(String[] args) throws MalformedURLException
{
URL obj = new URL("https://www.sanfoundry.com/javamcq");
System.out.print(obj.getProtocol());
}
}
a) http
b) https
c) www
d) com
Ans: A
34. Which of these transfer protocol must be used so that URL can be
accessed by URLConnection class object?
a) http
b) https
c) Any Protocol can be used
d) None of the mentioned
Ans: A
35. Which class is message that can be sent or received. If you send
multiple packet, it may arrive in any order,Moreover, packet delivery is not
guaranteed?
A) DatagramPacket
B) DatagramSocket
C) Both A & B
D) None of the above
Ans: A
36. Which method of URL class represents a URL and has complete set of
methods to manipulate URL in Java?
A) java.net.URL
B) java.net.URLConnection
C) Both A & B
D) None of the above
Ans: A
38. The DatagramSocket and DatagramPacket classes are not used for
connection-less socket programming.
A) True
B) False
Ans: B
39. Which of these class must be used to send a datatgram packets over a
connection?
A. InetAdress
B. DatagramPacket
C. DatagramSocket
D. All of the mentioned
Ans: D
Ans: A
41. Which of these methods of httpd class is used to read data from the
stream?
A. getDta()
B. GetResponse()
C. getStream()
D. getRawRequest()
Ans: D
45. Which are the several reasons for using generator patterns?
a) Product Creation Control
b) Product Configuration Control
c) Client and Product Decoupling
d) All of the mentioned
Ans: D
47. In Java, local variables are stored in __ memory and instance variables
are stored in ___ memory.
A) Stack, Stack
B) Heap, Heap
C) Stack, Heap
D) Heap, Stack
Ans: C
a. Object-Oriented
b. Object-Based
c. Assembly-language
d. High-level
Ans: B
49. Which of the following is the correct output for the following JavaScript
code:
varx=5,y=1
var obj ={ x:10}
with(obj)
{
alert(y)
}
Ans: A
50. Which of the following is the correct output for the following JavaScript
code:
Int x=8;
if(x>9)
{
document.write(9);
}
else
{
document.write(x);
}
a. 9
b. 0
c. 8
d. Undefined
Ans: C
Unit 4th Web Technology (KCS-602)
Multi Choice Questions (MCQ)
1. Which services are provided to EJB components by the EJB container?
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
ANSWER: All mentioned above
2. Which case of a session bean obtains the UserTransaction object via the
EJBContext using the getUserTransaction() method in EJB transaction
management?
a. Bean-managed transactions
b. Container-managed transactions
c. Both A & B
d. None of the above
ANSWER: Bean-managed transactions
4. A message driven bean is like statefull session bean that encapsulates the business
logic and doesn't maintain state.
a. True
b. False
ANSWER: False
6. JMS is mainly used to send and receive message from one application to another.
a. True
b. False
ANSWER: True
7. Which session bean maintain their state between client invocations but are not
required to maintain their state across server crashes or shutdowns?
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
ANSWER: Naming support
9. EJB is a specification for J2EE server, not a product; Java beans may be a
graphical component in IDE.
a. True
b. False
ANSWER: True
10. A session bean represents a multiple clients inside the Application Server.
a. True
b. False
ANSWER: False
11. Which component does the Entity bean represent the persistent data stored in the
database?
a. Server-side component
b. Client-side component
c. server and client side component
d. None of the above
ANSWER: Server-side component
12. EJB is a specification for J2EE server, not a product; Java beans may be a
graphical component in IDE.
a. True
b. False
ANSWER: True
13. The life cycle of session bean is not maintained by the application server (EJB
Container).
a. True
b. False
ANSWER: False
14. What represents a persistent global data from the database?
a. Entity Bean
b. Session Bean
c. Both A & B
d. None of the above
ANSWER: Entity Bean
15. Which component does the Entity bean represents the persistent data stored in
the database?
a. Server-side component
b. Client-side component
c. server and client side component
d. None of the above
ANSWER: Server-side component
19. Which type of instances retain no data or conversational state for a specific
client?
a. Message-Driven Bean
b. Session Bean
c. Entity Bean
d. None of the above
ANSWER: Message-Driven Bean
20. Which session bean does the conversational state between multiple method calls
is not maintained by the container?
A. 1
B. 2
C. 3
D. 4
Ans : C (There are 3 types of session bean: Stateless Session Bean, Stateful Session
Bean and Singleton Session Bean)
(a) Atomicity
(b) Consistency
(c) Isolation
(d) Distributed
(e) Durability.
Ans : D
30. Which of the following method is used to perform DML statements in JDBC?
a) executeResult()
b) executeQuery()
c) executeUpdate()
d) execute()
Answer: c
31. Which of the following method is static and synchronized in JDBC API?
a) getConnection()
b) prepareCall()
c) executeUpdate()
d) executeQuery()
Answer: A
36. How does JDBC handle the data types of Java and database?
A - The JDBC driver converts the Java data type to the appropriate JDBC type
before sending it to the database.
B - It uses a default mapping for most data types.
C - Both of the above.
D - None of the above.
Answer : C
37. The JDBC API has always supported persistent storage of objects defined in the
Java programming language through the methods getObject and setObject.
a. True
b. False
ANSWER: True
38. Which JDBC type represents a "single precision" floating point number that
supports seven digits of mantissa?
a. REAL
b. DOUBLE
c. FLOAT
d. INTEGER
ANSWER: REAL
A. Connection.getConnection(url)
B. Driver.getConnection(url)
C. DriverManager.getConnection(url)
D. new Connection(url)
Ans: C
A. Driver
B. Connection
C. Statement
D. ResultSet
Ans: A
43. Which resources have their close() method called when this code runs?
A. One
B. Two
C. Three
D. Four
Ans: D
46. ________ is an open source DBMS product that runs on UNIX, Linux and
Windows.
A. MySQL
B. JSP/SQL
C. JDBC/SQL
D. Sun ACCESS
Ans: A
A. Type 1
B. Type 2
C. Type 3
D. Type 4
Ans: A
48. JDBC stands for:
a. setBatch()
b. deleteBatch()
c. removeBatch()
d. addBatch()
Ans: D
A : TRANSACTION_NONE
B : TRANSACTION_READ_COMMITTED
C : TRANSACTION_REPEATABLE_READ
D : TRANSACTION_NONREPEATABLE_READ
Ans: D
Unit 5th Web Technology (KCS-602)
Multi Choice Questions (MCQ)
1. When init() method of servlet gets called?
Answer : A
2. What is javax.servlet.http.HttpServlet?
A - interface
B - abstract class
C - concreate class
D - None of the above
Answer : B
3. Which object of HttpSession can be used to view and manipulate information about a
session?
a. session identifier
b. creation time
c. last accessed time
d. All mentioned above
ANSWER: All mentioned above
6. Which methods are used to bind the objects on HttpSession instance and get the
objects?
a. setAttribute
b. getAttribute
c. Both A & B
d. None of the above
ANSWER: Both A & B
7. Which type of ServletEngine is a server that includes built-in support for servlets?
a. Add-on ServletEngine
b. Embedded ServletEngine
c. Standalone ServletEngine
d. None of the above
ANSWER: Standalone ServletEngine
9. Which cookie it is valid for single session only and it is removed each time when the
user closes the browser?
a. Persistent cookie
b. Non-persistent cookie
c. All the above
d. None of the above
ANSWER: Non-persistent cookie
10. Sessions is a part of the SessionTracking and it is for maintaining the client state at
server side.
a. True
b. False
ANSWER: True
11. Web server is used for loading the init() method of servlet.
a. True
b. False
ANSWER: True
13. Which method is used to send the same request and response objects to another
servlet in RequestDispacher ?
a. forward()
b. sendRedirect()
c. Both A & B
d. None of the above
ANSWER: forward()
14. Which packages represent interfaces and classes for servlet API?
a. javax.servlet
b. javax.servlet.http
c. Both A & B
d. None of the above
ANSWER: Both A & B
15. Which class can handle any type of request so that it is protocol-independent?
a. GenericServlet
b. HttpServlet
c. Both A & B
d. None of the above
ANSWER: GenericServlet
17. Which object is created by the web container at time of deploying the project?
a. ServletConfig
b. ServletContext
c. Both A & B
d. None of the above
ANSWER: ServletContext
19. Which method in session tracking is used in a bit of information that is sent by a web
server to a browser and which can later be read back from that browser?
a. HttpSession
b. URL rewriting
c. Cookies
d. Hidden form fields
ANSWER: Cookies
20. Which of the following code is used to get an attribute in a HTTP Session object in
servlets?
a) session.getAttribute(String name)
b) session.alterAttribute(String name)
c) session.updateAttribute(String name)
d) session.setAttribute(String name)
Answer: a
26. Which of the following is true about Cleanup phase in JSP life cycle?
a. The destruction phase of the JSP life cycle represents when a JSP is being removed from
use by a container.
b. The jspDestroy() method is the JSP equivalent of the destroy method for servlets.
c. Both of the above.
d. None of the above.
Answer : C
Answer : A
29. Which attribute specifies a JSP page that should process any exceptions thrown but
not caught in the current page?
a. The ErrorPage Attribute
b. The IsErrorPage Attribute
c. Both A & B
d. None of the above
ANSWER: A
30. JavaServer Pages often serve the same purpose as programs implemented using the
Common Gateway Interface (CGI)
a. True
b. False
ANSWER: True
31. Which action tags are used in JSP for developing web application with Java Bean?
a. jsp:useBean
b. jsp:setProperty
c. jsp:getProperty
d. Both B & C
ANSWER: Both B & C
32. Which is the Microsoft solution for providing dynamic Web content?
a. ASP
b. JSP
c. Both A & B
d. None of the above
ANSWER: ASP
34. Which JSP Action tags is used to include the content of another resource, it may be
jsp, html or servlet?
a. jsp:include
b. jsp:forward
c. jsp:plugin
d. jsp:papam
ANSWER: jsp:include
35. In JSP page directive which attribute defines the MIME(Multipurpose Internet Mail
Extension) type of the HTTP response?
a. import
b. Content Type
c. Extends
d. Info
ANSWER: Content Type
36. A JSP page consists of which tags?
a. HTML tags
b. JSP tags
c. Both A & B
d. None of the above
ANSWER: Both A & B
38. Which of the following are the life cycle method of jsp?
A. jspInit()
B. jspService()
C. jspDestroy()
D. All of the above
ANSWER: D
4. SAX and DOM are very different Where SAX models the parser, DOM models the XML ___.
Ans: Document
5. The main purpose of ___ is to add interactivity to the browser and Web pages.
Ans: JavaScript
10. ___ is an API that can be used by web scripting languages like JavaScript, VBScript, etc.
Ans: HTTP requests
11. HTTP requests provide a mechanism for transferring the data either in text or XML format between the web client
and the webserver. (True/False)
Ans: True
13. XMLHttpRequest object property ___ is used to returns a reference to the constructor of an object.
Ans: Constructor
14. XMLHttpRequest object method abort is used to cancels the current HTTP request. (True/False)
Ans: True
15. ___ is used to sets or retrieves the event handler for asynchronous requests.
Ans: Onreadystatechange
16. The argument in send method is ignored if the request method is ___.
Ans: GET or HEAD.
19. The ___ attribute is used to return the text response entity-body.
Ans: responseText
22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True
24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True
26. DHTML allows the page author to ___ in their document, independently moving each element from any starting
point to any ending point.
Ans: Animate text and image
27. ___ is a formal specification for arranging and styling items in web pages.
Ans: CSS
28. Variations in web browser implementations, such as ___ and Worldwide Web, made consistent site appearance
difficult.
Ans: ViolaWWW
31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest
35. Like HTML, XML elements can contain other XML element. (True/False)
Ans: True
36. In the ___ method a node list containing all of a node's child nodes.
Ans: ChildNodes()
37. ___ method takes a single parameter: the node to insert, and inserts that node after the last child node.
Ans: AppendChild()
38. ___ method takes two parameters: the attribute name and value. If the attribute already exists, it replaces it with
the new value. If it doesn't exist, it creates it.
Ans: SetAttribute()
39. The process of fetching data from an XML files to be filled in an HTML table, using ___ and ___.
Ans: DSO and Javascript
41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()
44. PHP scripts are always enclosed in between ___ PHP tags.
Ans: Two
45. We must save our PHP file with a___ extension, instead of the standard .html extension.
Ans: .PHP
46. In a ___ array, each element in the main array can also be an array.
Ans: Multidimensional
47. PHP variables must start with a letter or underscore "_". (true/false)
Ans: True
48. The ___ function is used to collect values from a form sent with method="post".
Ans: POST
49. The ___ function is used to collect values from a form sent with method="get".
Ans: GET
52. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
53. ___ function which will change the value of our second field.
Ans: setOutput()
55. Database allows web applications to store information in a systematic way, and retrieve that information later
through the use of the structured query. (True/False)
Ans: True
56. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest
57. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
58. ___ function which will change the value of our second field.
Ans: SetOutput()
59. Ajax, PHP, and Database make a great combination for producing Web-based eCommerce applications.
(True/false)
Ans: True
60. ___ is used to request the interface for Update or Insert of the records.
Ans: AjaxFunctionUpdateInseart()
63. If a second call is made to mysql_connect() with the same arguments, no new connection will be established.
(True/false)
Ans: True
64. MySQL supports over ___ making it ideal for the education industry in which a wide variety of platforms are
used.
Ans: 20 platforms
65. MySQL works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA etc.
(True/false)
Ans: True
66. MySQL supports large databases, up to 50 million rows or more in a table. The default file size limit for a table
is___.
Ans: 4 GB
67. ASP stands for___
Ans: Active Server Page
68. ASP is Web pages that contain server-side scripts in addition to the usual mixture of text and HTML
tags.(True/false)
Ans: server-side script
69. ___ variables are used to store information about ALL users in one specific application.
Ans: Application
71. In ASP we declare a variable with the use of the ___ keyword.
Ans: DIM
72. If the ASP appears on the page or the ___, something has gone wrong.
Ans: Source of the page
73. The ___ checks if a condition is true before each time that the code inside the loop is repeated.
Ans: While loop
74. In ___ condition is tested at the bottom instead of at the top of the loop.
Ans: Do loop
75. Response object is used to send information to the user i.e. to the browser. (true/false)
Ans: true
WEB TECHNOLOGY
Web Technology
Course Outcome ( CO)
At the end of course , the student will be
able to understand
CO 1 Explain web development Strategies and Protocols governing Web..
CO 5 Building enterprise level applications and manipulate web databases using JDBC
Unit Topic
Introduction: Introduction and Web Development Strategies, History of Web and Internet,
Protocols Governing Web, Writing Web Projects, Connecting to Internet, Introduction to
I Internet services and tools, Introduction to client-server computing. Core Java: Introduction,
Operator, Data type, Variable, Arrays, Methods & Classes, Inheritance, Package and Interface,
Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event
handling, Introduction to AWT, AWT controls, Layout managers
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type
II definition, XML: DTD, XML schemes, Object Models, presenting and using XML, Using
XML Processors: DOM and SAX, Dynamic HTML
Scripting: Java scriAJAXpt: Introduction, documents, forms, statements, functions, objects;
introduction to Networking : Internet Addressing, InetAddress, Factory Methods, Instance
III Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle,
V Handling HTTP get Requests, Handling HTTP post Requests, Redirecting Requests to Other
Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page
Example, Implicit Objects, Scripting, Standard Actions, Directives, Custom Tag Libraries.
1 University Academy
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Solved MCQ
Topic Page
2 University Academy
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
WEB TECHNOLOGY 2020-21
6 University Academy
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
WEB TECHNOLOGY 2020-21
14 University Academy
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
WEB TECHNOLOGY 2020-21
18 University Academy
WEB TECHNOLOGY 2020-21
19 University Academy
WEB TECHNOLOGY 2020-21
20 University Academy
WEB TECHNOLOGY 2020-21
21 University Academy
WEB TECHNOLOGY 2020-21
22 University Academy
WEB TECHNOLOGY 2020-21
23 University Academy
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
WEB TECHNOLOGY 2020-21
25 University Academy
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
WEB TECHNOLOGY 2020-21
28 University Academy
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21
38 University Academy
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
WEB TECHNOLOGY 2020-21
45 University Academy
WEB TECHNOLOGY 2020-21
46 University Academy
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
WEB TECHNOLOGY 2020-21
49 University Academy
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
WEB TECHNOLOGY 2020-21
51 University Academy
WEB TECHNOLOGY 2020-21
52 University Academy
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
WEB TECHNOLOGY 2020-21
54 University Academy
WEB TECHNOLOGY 2020-21
55 University Academy
WEB TECHNOLOGY 2020-21
56 University Academy
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
WEB TECHNOLOGY 2020-21
59 University Academy
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
→Telegram Channel
→Telegram Group
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Web Technology
Course Outcome ( CO)
At the end of course , the student will be
able to understand
CO 1 Explain web development Strategies and Protocols governing Web..
CO 5 Building enterprise level applications and manipulate web databases using JDBC
Unit Topic
Introduction: Introduction and Web Development Strategies, History of Web and Internet,
Protocols Governing Web, Writing Web Projects, Connecting to Internet, Introduction to
I Internet services and tools, Introduction to client-server computing. Core Java: Introduction,
Operator, Data type, Variable, Arrays, Methods & Classes, Inheritance, Package and Interface,
Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event
handling, Introduction to AWT, AWT controls, Layout managers
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type
II definition, XML: DTD, XML schemes, Object Models, presenting and using XML, Using
XML Processors: DOM and SAX, Dynamic HTML
Scripting: Java scriAJAXpt: Introduction, documents, forms, statements, functions, objects;
introduction to Networking : Internet Addressing, InetAddress, Factory Methods, Instance
III Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle,
V Handling HTTP get Requests, Handling HTTP post Requests, Redirecting Requests to Other
Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page
Example, Implicit Objects, Scripting, Standard Actions, Directives, Custom Tag Libraries.
1 University Academy
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Solved MCQ
Topic Page
2 University Academy
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
WEB TECHNOLOGY 2020-21
6 University Academy
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
WEB TECHNOLOGY 2020-21
14 University Academy
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
WEB TECHNOLOGY 2020-21
18 University Academy
WEB TECHNOLOGY 2020-21
19 University Academy
WEB TECHNOLOGY 2020-21
20 University Academy
WEB TECHNOLOGY 2020-21
21 University Academy
WEB TECHNOLOGY 2020-21
22 University Academy
WEB TECHNOLOGY 2020-21
23 University Academy
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
WEB TECHNOLOGY 2020-21
25 University Academy
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
WEB TECHNOLOGY 2020-21
28 University Academy
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21
38 University Academy
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
WEB TECHNOLOGY 2020-21
45 University Academy
WEB TECHNOLOGY 2020-21
46 University Academy
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
WEB TECHNOLOGY 2020-21
49 University Academy
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
WEB TECHNOLOGY 2020-21
51 University Academy
WEB TECHNOLOGY 2020-21
52 University Academy
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
WEB TECHNOLOGY 2020-21
54 University Academy
WEB TECHNOLOGY 2020-21
55 University Academy
WEB TECHNOLOGY 2020-21
56 University Academy
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
WEB TECHNOLOGY 2020-21
59 University Academy
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
→Telegram Channel
→Telegram Group
→Telegram Channel
→Telegram Group
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Web Technology
Course Outcome ( CO)
At the end of course , the student will be
able to understand
CO 1 Explain web development Strategies and Protocols governing Web..
CO 5 Building enterprise level applications and manipulate web databases using JDBC
Unit Topic
Introduction: Introduction and Web Development Strategies, History of Web and Internet,
Protocols Governing Web, Writing Web Projects, Connecting to Internet, Introduction to
I Internet services and tools, Introduction to client-server computing. Core Java: Introduction,
Operator, Data type, Variable, Arrays, Methods & Classes, Inheritance, Package and Interface,
Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event
handling, Introduction to AWT, AWT controls, Layout managers
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type
II definition, XML: DTD, XML schemes, Object Models, presenting and using XML, Using
XML Processors: DOM and SAX, Dynamic HTML
Scripting: Java scriAJAXpt: Introduction, documents, forms, statements, functions, objects;
introduction to Networking : Internet Addressing, InetAddress, Factory Methods, Instance
III Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle,
V Handling HTTP get Requests, Handling HTTP post Requests, Redirecting Requests to Other
Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page
Example, Implicit Objects, Scripting, Standard Actions, Directives, Custom Tag Libraries.
1 University Academy
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Solved MCQ
Topic Page
2 University Academy
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
WEB TECHNOLOGY 2020-21
6 University Academy
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
WEB TECHNOLOGY 2020-21
14 University Academy
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
WEB TECHNOLOGY 2020-21
18 University Academy
WEB TECHNOLOGY 2020-21
19 University Academy
WEB TECHNOLOGY 2020-21
20 University Academy
WEB TECHNOLOGY 2020-21
21 University Academy
WEB TECHNOLOGY 2020-21
22 University Academy
WEB TECHNOLOGY 2020-21
23 University Academy
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
WEB TECHNOLOGY 2020-21
25 University Academy
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
WEB TECHNOLOGY 2020-21
28 University Academy
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21
38 University Academy
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
WEB TECHNOLOGY 2020-21
45 University Academy
WEB TECHNOLOGY 2020-21
46 University Academy
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
WEB TECHNOLOGY 2020-21
49 University Academy
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
WEB TECHNOLOGY 2020-21
51 University Academy
WEB TECHNOLOGY 2020-21
52 University Academy
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
WEB TECHNOLOGY 2020-21
54 University Academy
WEB TECHNOLOGY 2020-21
55 University Academy
WEB TECHNOLOGY 2020-21
56 University Academy
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
WEB TECHNOLOGY 2020-21
59 University Academy
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
→Telegram Channel
→Telegram Group
www.aktutor.in
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
6 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
14 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
18 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
19 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
20 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
21 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
22 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
23 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
25 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
28 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
38 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
45 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
46 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
49 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
51 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
52 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
54 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
55 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
56 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
59 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
1. Which of the following options is correct with regard to
HTML?
Coursary Open
5. What would be the colours of the RGB where the
hexadecimal values are #FF0000, #00FF00 and #0000FF
respectively?
<html>
<head> <title>JavaScript</title> </head>
<body bgcolor=”#0000ff”>
<script language=”JavaScript”>
<!– document.write(“<h1> hello world </h1>”); //–>
</script>
</body>
</html>
(a) The body of the web page will not contain any text
(b) The body of the web page will contain the text “<h1> hello
world </h1>”
(c) The body of the web page will contain the text “hello
world” as an H1 heading
(d) The background color of the web page will be green
(e) document.write(“<h1> hello world </h1 >”); is a comment.
<html>
<head><title>JavaScript</title></head>
<body>
<script language=”JavaScript”>
var a=80
var b=(a==80 ? “pass” :”fail”);
document.write(b)
</script>
</body>
</html>
(a) pass
(b) fail
(c) null
(d) 80
(e) Error at line 6.
<html>
<head><title>JavaScript question</title></head>
<body>
<script language=”JavaScript”>
book = new Array(1,2,3,4,5,6,7,8);
document.write(book[1]);
book[10]=10;
document.write(book[10]);
</script>
</body>
</html>
Once the above web page is loaded what will its body
contain?
(a) 210
(b) 110
(c) 110
(d) 210
(e) Error at line 7.
<html>
<head><title>JavaScript</title></head>
<body>
<script language=”JavaScript”>
document.write((125/5)%12);
</script>
</body>
</html>
What would be the output of the above script?
(a) 0
(b) 1
(c) 2.083
(d) 3
(e) 25%12.
(a) Display()
(b) Prompt()
(c) Alert()
(d) GetInput()
(e) Confirm().
17. The function returns a Boolean value that indicates
whether a specified expression can be evaluated as a
number; in ASP is
(a) IsNumeric()
(b) IsNumber()
(c) IsNotNumeric()
(d) IsNotNumber()
(e) IsNumberOrNot().
(a) green
(b) blue
(c) black
(d) red
(e) White.
20. Which property does one use to align text to the right
side of a block-level element in Cascading Style Sheets?
(a) horizontal-align
(b) align
(c) block-align
(d) justify
(e) text-align.
(a) setLayout()
(b) Layout()
(c) setContainerLayout()
(d) ContainerLayout()
(e) setConLayout().
(a) setSize()
(b) setBounds()
(c) setPosition()
(d) setPositionSize()
(e) setSizePosition().
(a) getCanvas()
(b) getGraphics()
(c) paint()
(d) getPaint()
(e) accessGraphics().
(a) getDate()
(b) Date()
(c) Now()
(d) getCurrentDate()
(e) CurrentDate().
29. In ASP the function which returns an expression
formatted as a date or time is:
(a) FormatDateOrTime()
(b) FormatDateAndTime()
(c) FormatTimeDate()
(d) FormatDateTime()
(e) FormatDT()
D. none of these
Answer:
A.document object model
31. ________ java script is also called server side java script
A. java script
C. nevigator
D. live wire
Answer:
D.live wire
B. 2
C. 3
D. 4
Answer:
A.1
B. false
C. both a and b
D. none of these ..
Answer:
A.true
B. html
C. href
D. none of these
Answer:
A.bandwidth
B. rgba
C. hsla
D. all of these
Answer:
D.all of these
B. 3
C. 120
D. 7
Answer:
A.140
B. br
C. <pre>
D. <marquee>
Answer:
A. <p>
B. <br>
C. <pre>
D. <marquee>
Answer:
B.<br>
B. br
C. <pre>
D. <marquee>
Answer:
C.<pre>
B. <br>
C. <pre>
D. <marquee>
Answer:
D.<marquee>
B. br
C. <pre>
D. <marquee>
Answer:
D.<marquee>
B. br
C. <pre>
D. <marquee>
Answer:
A.<ol>
B. br
C. <pre>
D. <marquee>
Answer:
A.<ul>
B. br
C. <pre>
D. <marquee>
Answer:
A.<!—->
B. br
C. <pre>
D. <marquee>
Answer:
A.<i>
B. br
C. <pre>
D. <marquee>
Answer:
A.<big>
B. br
C. <pre>
D. <marquee>
Answer:
A.<def>
B. br
C. <pre>
D. <marquee>
Answer:
A.<cite>
B. logical
C. center tag
D. a and b b both
Answer:
D.a and b b both
B. <center>
C. <pre>
D. <marquee>
Answer:
B.<center>
B. false
C. both a and b
D. none of these.
Answer:
A.true
52. ________ the space between is the space between content of
the cell and cell wall .
A. <p>
B. <center>
C. cell spacing
D. <marquee>
Answer:
C.cell spacing
B. <center>
C. cell spacing
D. <marquee>
Answer:
A.border
B. <th>
C. <frameset>
D. <a>
Answer:
A.<tr>
55. __________tag is used to create the table heading of the
table
A. <tr>
B. <th>
C. <frameset>
D. <a>
Answer:
B.<th>
56. To make a cell span more than one column, it is called use
the _______attribute
A. <tr>
B. colspan
C. <frameset>
D. rowspan
Answer:
B.colspan
57. To make a cell span more than one row, it is called use the
_______ attribute.
A. <tr>
B. colspan
C. <frameset>
D. rowspan
Answer:
D.rowspan
C. <frame>
D. rowspan
Answer:
C.<frame>
B. columun
C. frame
D. rowspan
Answer:
C.frame
B. colspan
C. <frameset>
D. rowspan
Answer:
C.<frameset>
B. ftp
C. physical
D. hyperlink
Answer:
A.tcp/ip
B. ftp
C. physical
D. hyperlink
Answer:
A.tcp/ip
B. ftp
C. physical
D. hyperlink
Answer:
B.ftp
B. ftp
C. physical
D. hyperlink
Answer:
A.<head>
B. <body>
C. physical
D. hyperlink
Answer:
B.<body>
B. ftp
C. physical
D. hyperlink
Answer:
C.physical
67. The LINKS starts at the ((Source)) anchor and points to the
((Destination)) anchor. TheseLINKIS are called as ___________
A. <head>
B. <body>
C. physical
D. hyperlink
Answer:
D.hyperlink
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<a>
B. checkbox
C. <textarea>
D. <text>
Answer:
B.checkbox
70. _________it is used to give the show the input box with
multiple rows and column.
A. <a>
B. checkbox
C. <textarea>
D. <text>
Answer:
C.<textarea>
71. __________- accept the any text in intput box..
A. <a>
B. checkbox
C. <textarea>
D. <text>
Answer:
D.<text>
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<submit>
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<password>
C. double
D. long
Answer:
C.double
B. iso-latin-1
C. unicode
Answer:
C.unicode
B. 0 & 1
D. true
Answer:
A.true & false
B. 2
C. 3
D. 4
Answer:
A.1
78. Which right shift operator preserves the sign of the value?
A. <<
B. >>
C. <<=
D. >>=
Answer:
B.>>
B. boolean
C. characters
D. double
Answer:
B.boolean
C. boolean
Answer:
C.boolean
81. Which of these jump statements can skip processing the
remainder of thecode in its body for a particular iteration?
A. break
B. return
C. exit
D. continue
Answer:
D.continue
B. if-else
C. switch
D. do-while
Answer:
D.do-while
B. break
C. continue
D. return
Answer:
A.exit()
B. alloc
C. new
D. new malloc
Answer:
C.new
Answer:
D.int x[] = int [5] new
B. switch
C. if & switch
Answer:
A.if
B. customize
C. class
D. id rule
Answer:
A.background
B. customize
C. class
D. id rule
Answer:
B.customize
B. customize
C. class
D. id rule
Answer:
D.id rule
B. customize
C. class
D. id rule
Answer:
C.class
B. selector
C. declaration
D. text color
Answer:
A.property name
B. selector
C. declaration
D. text color
Answer:
B.selector
B. selector
C. declaration
D. text color
Answer:
C.declaration
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<reset>
B. html
C. <textarea>
D. <text>
Answer:
A.css
B. serve
C. cache
D. client
Answer:
B.serve
B. server
C. empty
D. head tag
Answer:
A.web browser
B. server
C. empty
D. head tag
Answer:
C.empty
99. The HTML tag to left align the content inside a table cell is
<td align = “left”>.
A. true
B. false
C. both a and b
D. none of these
Answer:
A.true
B. server
C. empty
D. head tag
Answer:
D.head tag
101. Tags and text that are not directly displayed on the page
are written in___________section.
A. web browser
B. title
C. empty
D. head
Answer:
D.head
102. Some tags enclose the text. Those tags are known as
___________
A. single tag
B. paired tag
C. empty
D. head
Answer:
A.single tag
B. paired tag
C. strikeout
D. head
Answer:
C.strikeout
104. The <del> tag is used to display ________ text form a
document
A. single tag
B. paired tag
C. strikeout
D. deleted
Answer:
D.deleted
B. paired tag
C. strikeout
D. deleted
Answer:
A.title tag
Function and String in PHP
B. -32768 to 32767
C. -2147483648 to 2147483647
Answer:
B.-32768 to 32767
C. -2147483648 to 2147483647
Answer:
A.-128 to 127
B. long
C. byte
D. float
Answer:
A.int
B. 0 to 256
C. 0 to 32767
D. 0 to 65535
Answer:
D.0 to 65535
B. iso-latin-1
C. unicode
Answer:
C.unicode
B. boolean b2 = ‘false’;
C. boolean b3 = false;
D. boolean b4 = ‘true’
Answer:
C.boolean b3 = false;
B. alloc
C. new
D. new malloc
Answer:
C.new
B. column
Answer:
A.row
B. boolean
C. characters
Answer:
D.both numeric & characters
Answer:
C.both integers and floating – point numbers
117. Which operator is used to invert all the digits in a binary
representation ofa number?
A. ~
B. <<<
C. >>>
D. ^
Answer:
A.~
B. 32
C. 33
D. 31
Answer:
D.31
C. &
D. &&
Answer:
D.&&
C. *
D. >>
Answer:
A.()
Answer:
D.addition operator, +, and subtraction operator have equal
precedence
B. switch
C. if & switch
Answer:
B.switch
B. for()
C. continue
D. break
Answer:
A.if()
B. goto
C. continue
D. return
Answer:
D.return
B. bandwidth
C. webpage
D. dream viewer
Answer:
B.bandwidth
B. bandwidth
C. webpage
D. dream viewer
Answer:
C.webpage
B. bandwidth
C. webpage
D. dream viewer
Answer:
A.http
B. false
C. both a & b
D. none of these
Answer:
A.true
129. Following are the types of CSS , which one is not type of
CSS.
A. inline css:
C. external css:
D. none of these.
Answer:
D.none of these.
B. <span>
C. <img>
D. <tt>
Answer:
B.<span>
B. <span>
C. <img>
D. <tt>
Answer:
A.<map>
B. <span>
C. <img>
D. <tt>
Answer:
A.<map>
133. The _____________element is often used as a container for
other HTML elements tostyle them with CSS or to perform
certain tasks with JavaScript.
A. <map>
B. <div>
C. <img>
D. <tt>
Answer:
B.<div>
B. <span>
C. <img>
D. <tt>
Answer:
D.<tt>
B. <em>
C. <u>
D. <strong >
Answer:
A.<small>
136. ______tag Indicates that the text should be displayed
underlined. Not all browserssupport this tag.
A. <small>
B. <em>
C. <u>
D. <strong >
Answer:
C.<u>
B. <em>
C. <u>
D. <strong >
Answer:
B.<em>
B. <em>
C. <u>
D. <strong >
Answer:
D.<strong >
139. _________tag Used to offset text that the user should enter.
Often displayed in aCourier font or a similar font that allots
the same width to each character.
A. <small>
B. <em>
C. <kbd >
D. <strong >
Answer:
C.<kbd >
B. <em>
C. <kbd >
D. <strong >
Answer:
A.<var>
B. <cite>
C. <kbd >
D. <strong >
Answer:
B.<cite>
B. <tr>
C. <kbd >
D. <strong >
Answer:
B.<tr>
B. <tr>
C. <td >
D. <th >
Answer:
A.<table>
D. none of these
Answer:
A.cascading style sheets
C. navigation
D. dream viewer
Answer:
C.navigation
B. bandwidth
C. webpage
D. dream viewer
Answer:
D.dream viewer
B. java script
C. angular js
D. none of these
Answer:
A.php
B. java script
C. angular js
D. none of these
Answer:
A.php
B. java script c
C. angular js
D. none of these
Answer:
A.php
B. .js
C. .ajs
D. none of these
Answer:
A..php
B. java script
C. angular js
D. none of these
Answer:
A.echo
B. small
C. short
D. none of these
Answer:
A.wide
B. integer
Answer:
D.all of the above .
B. implicitly
C. both a and b
D. none of these
Answer:
A.explicitly
C. string operators
Answer:
D.all of the above
B. ++
C. ==
D. ?
Answer:
A.=
B. if condition
C. foreach
D. while
Answer:
A.switch
B. for loop
C. foreach
Answer:
D.all the these.
B. procedure
C. block
D. loop
Answer:
A.function
------>>[MOST IMPORTANT]<<------
UNIT-1
1-A piece of icon or image on a web page associated with another webpage is called ______
a) url
b) hyperlink
c) plugin
d) extension
Ans- b) hyperlink
4- On which one of the following dates World Wide Web was invented?
a)1972
b)1989
c)1986
d)1930
Ans- b)1989
6- Internet is a.
a) local computer network
b) a world wide network of computers
c) an interconnected network of computers
d) a world wide interconnected network of computers which use a common protocol to
communicate with one another
Ans- d) a world wide interconnected network of computers which use a common protocol to
communicate with one another
a) i, ii
b) i, ii, iii
c) i, ii, iv
d) ii, iii and iv
12-Computer that requests the resources or data from other computer is called as ________
computer.
a)Client
b)Server
Ans- a) Client
13- _________ is set of rules, that is used to communicate applications to each other.
a) HTML
b) Website
c) Protocol
d) XML
Ans- c) Protocol
Ans- c) TCP/IP
http://www.c4learn.com
a) c4learn
b) www
c) http
d) .com
Ans- c) http
Ans- b) POP3
17- Which one of the following protocol is used to receive mail messages?
a) SMTP
b) POP
c) IMAP
d) All of the above
Ans- b) SMTP
Ans- a) Source
22- The FTP protocol allows the user to __________ files over the internet.
a) Upload
b) Download
c) Both Upload and download
d) none of these
23- A typical __________ program obtains a remote reference to one or more remote objects
on a server and then invokes methods on them.
a) Server
b) Client
c) Thread
d) Concurrent
Ans- b) Client
25- In the Client-Server architecture, the component that processes the request and sends the
response is
(a) Client
(b) Server
(c) Protocol
(d) Network
Ans- b) Server
27- which of the following is correct order for web development strategies?
i) Register with ISP
ii) Design and Specification
iii) Launch
iv) Produced Desired Result
v) Strategy
vi) Testing and Maintenance
28- DNS is used to resolve host names to IP addresses and find services.
a) True
b) False
Ans- a) True
Ans- c) Intranet: Private, Extranet: Private and also allowed authorized partners
Ans- a) The use of Internet protocols with limited access to company data by the company's
customers and suppliers.
32- Simple plain HTML is used to create following type of website ____________.
a)Completely Dynamic Website
b) Completely Flash Website
c) Completely Static Website
d)None of these
33- A __________ is the simplest form of website, in which the site’s content is delivered without
the use of server side processing.
a) Dynamic Website
b) Social Networking Website
c) Static Website
d) E-Commerce Website
Ans- b) secured
35- Which protocol is used for browsing website
a)TCP
b) HTTP
c) FTP
d) TFTP
Ans- b) HTTP
Ans- d) HTTP
37- Which of the following statements is true
a) The web designer shouldn’t just be concerned about the looks but also about user interface
b) Usability is very important in web design
c) a and b
d) None of the above
Ans- c ( a & b)
38- The __________ method when used in the method field, leaves entity body empty.
a) POST
b) SEND
c) GET
d) PUT
ANS- c) GET
Explanation: There are two methods which help to request a response from a server. Those are GET
and POST. In GET method, the client requests data from server. In POST method the client submits
data to be processed to the server.
39- Internet is
a) Dynamic system
b) Complex system
c) Decentralized system
d) All of the above
42- Which component is used to compile, debug and execute java program?
a) JVM
b) JDK
c) JIT
d) JRE
Ans- b) JDK
43- Which component is responsible for converting bytecode into machine specific code?
a) JVM
b) JDK
c) JIT
d) JRE
Ans- a) JVM
Ans- a) JRE
46- Which of the below is invalid identifier with the main method?
a) public
b) static
c) private
d) final
Ans- c) private
Ans- b) .java
Ans- a) .class
Ans- d) Compilation
52- Which concept of Java is achieved by combining methods and attribute into a class?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction
Ans- a) Encapsulation
56- What is the stored in the object obj in following lines of Java code?
box obj;
Ans- b) NULL
Ans- c) new
60- What is the return type of a method that does not return any value?
a) int
b) float
c) void
d) double
Ans- c) void
Ans- b) abstract
Ans- d) extends
64- Which of the following is used for implementing inheritance through an interface?
a) inherited
b) using
c) extends
d) implements
Ans- d) implements
67- Using which of the following, multiple inheritance in Java can be implemented?
a) Interfaces
b) Multithreading
c) Protected methods
d) Private methods
Ans- a) Interfaces
Ans- d) java.lang.Object
Ans- b) False
Ans- c) package
71- Which of these access specifiers can be used for a class so that its members can be accessed by
a different class in the different package?
a) Public
b) Protected
c) Private
d) No Modifier
Ans- a)Public
72- Which of the following is the correct way of importing an entire package ‘pkg’?
a) import pkg.
b) Import pkg.
c) import pkg.*
d) Import pkg.*
Ans- a) interface
Ans- a) Public
75- Which of the following is the correct way of implementing an interface A by class B?
a) class B extends A{}
b) class B implements A{}
c) class B imports A{}
d) None of the mentioned
Ans- c) thrown
79- Which of these keywords must be used to handle the exception thrown by try block in some
rational manner?
a) try
b) finally
c) throw
d) catch
Ans- d) catch
Ans- b) run()
Ans- b) start()
Ans- b) It’s a process in which two or more parts of same process run simultaneously
84- Which of these is used to perform all input & output operations in Java?
a) streams
b) Variables
c) classes
d) Methods
Ans- a) streams
85- Which of these classes are used by Byte streams for input and output operation?
a) InputStream
b) InputOutputStream
c) Reader
d) All of the mentioned
Ans- a) InputStream
Ans- d) ByteArrayInputStream
Ans- c) HTML
89- Which method is automatically called after the browser calls the init method?
a) start
b) stop
c) destroy
d) paint
Ans- a) Start
90- ___________ method is defined in Graphics class, it is used to output a string in an applet.
a) display()
b) Print()
c) drawString()
d) transient()
Ans- c) drawString()
91- The ………………… method called the first time an applet is loaded into the memory of a computer.
a) init( )
b) start( )
c) stop( )
d) destroy( )
Ans- a) init( )
92- Which of the following applet tags is legal to embed an applet class named Test into a webpage?
b) <applet>
code=Test.class width=200 height=100>
</applet>
d) <applet
param=Test.class width=200 height=100>
</applet>
Ans- c) <applet code=Test.class width=200 height=100>
</applet>
93- What is an event in delegation event model used by Java programming language?
a) An event is an object that describes a state change in a source
b) An event is an object that describes a state change in processing
c) An event is an object that describes any change by the user and system
d) An event is a class used for defining object, to create events
95- Which of these operators can be used to concatenate two or more String objects?
a) +
b) +=
c) &
d) ||
Ans- a) +
96- Which of this method of class String is used to obtain a length of String object?
a) get()
b) Sizeof()
c) lengthof()
d) length()
Ans- d) length()
97- Which of the following is the default Layout Manager for an Applet?
a)FlowLayout
b)BorderLayout
c)GridLayout
d)CardLayout
Ans- a) FlowLayout
Ans- b) java.awt
99- In which memory a String is stored, when we create a string using new operator?
a)Stack
b)String memory
c)Heap memory
d)Random storage space
Answer: b
Explanation: HTML is Hyper Text Markup Language which is used to create web pages and
applications. The id attribute is most used to point to a style in a style sheet, and by JavaScript (via
the HTML DOM) to manipulate the element with the specific id. Class is a name given to HTML
elements which can be used by CSS and JavaScript for styling the web pages. A self-contained
content is called attribute.
2. The _____________ attribute specifies an inline style associated with an element, which
determines the rendering of the affected element.
a) dir
b) style
c) class
d) article
Answer: b
Explanation: Style attribute specifies an inline style for an element. The style attribute will override
any style set globally, e.g. styles specified in the style tag or in an external style sheet. A
self-contained content is called attribute. Class is a name given to HTML elements which can be used
by CSS and JavaScript for styling the web pages. List of directory files is given by dir tag which is
not supported in HTML5.
3. Which attribute is used to provide an advisory text about an element or its contents?
a) tooltip
b) dir
c) title
d) head
Answer: c
Explanation: The extra information about an element is specified by title tag. The information is most
often shown as a tooltip text when the mouse moves over the element. List of directory files is given
by dir tag which is not supported in HTML5. Tooltip or else infotip is a graphical user interface of an
element. Container of metadata is called head.
4. The __________ attribute sets the text direction as related to the lang attribute.
a) lang
b) sub
c) dir
d) ds
Answer: c
Explanation: The dir attribute specifies the text direction of the element’s content. List of directory
files is given by dir tag which is not supported in HTML5. The language of an element’s content is
given by lang attribute. The subscript text is defined by sub attribute.
5. The accesskey attribute specifies a keyboard navigation accelerator for the element.
a) True
b) False
Answer: a
Explanation: The accesskey attribute specifies a shortcut key to activate/focus an element. It specifies
a keyboard navigation accelerator for the element. We can use accesskey attribute in forms or links.
6.Which of the following is the attribute that is used to set a global identifier for a microdata item?
a) key
b) id
c) itemclass
d) itemid
Answer: d
Explanation: The unique id for an element in html is specified by id attribute. Itemmid allows a
vocabulary to define a global identifier for a microdata item, for example an ISBN number on a
book. Use itemid on the same element as the item’s itemscope and itemtype attributes.
Answer: b
Explanation: <dd> element is used to contain definition. The definition list is created by using <dl>
element. Inside <dl> element we can have pairs of <dd> and <dt> elements. <dt> contains the term
being defined. <ul> is unordered list. A description list is specified by <dl> tag. <dt> tag is a term in
description list.
Answer: c
Explanation: list-style-property is used for defining the style of list item marker. Its value can be
square, circle, disc or none. For setting list item marker to be bullet we use the value disc. It is the
default value. For setting list item marker to a circle we used the circle, for setting it to be square we
set the value square. If we set the value none, list items will not be marked.
Answer: b
Explanation: If we want to display the list horizontally we can use display:inline or float:left. It will
create a menu. E.g. ul {list-style-type: none; padding:0; overflow:hidden; } li {float:left} li g{
display: block; color:red; padding: 20px;}. <dd> element is used to contain definition. <dt> tag is a
term in description list.
Answer: b
Explanation: For the creation of multicolumn directory lists dir element was designed. For designing
a single column menu list menu element was designed. They have the same structure as ul. It is just a
different rendering. In practice, it works exactly as a ul list. <ol> represents a ordered list where as
<ul> is unordered list. List of commands is defined by <menu> tag.
Answer: d
Explanation: The content property includes Strings, URIs, Normal, None, Image, Counter and many
more. When we are using these characters it is essential to encode them as their escaped HEX
equivalents. These characters will work i.e. will only be visible in Mozilla/Netscape or in Opera.
Answer: b
Explanation: td stands for table data, we can represent each cell of the table by using <td>, at the end
we used </td> tag. But some browsers by default draw the lines around table. <tr> is used to indicate
start of every row i.e. it stands for table row. The header information is present in <th> tag. <thead>
tag contains the group of header.
Answer: d
Explanation: <th> element is used for representing heading of column or a row. It works same as
<td> element. If shell has no content we can use <th> element also there. We can use scope attribute
for specifying the heading is for row or column. Usually content of <th> is represented in bold.
<thead> tag contains the group of header. <tr> is used to indicate start of every row i.e. it stands for
table row.
Answer: a
Explanation: Headings of the table lies inside <thead> element. Footer lies inside the <tfoot>
element. The body of the table lies inside <tbody> element. <th> is used for giving heading to a row
or a column. Every element must have closing tag also i.e. </thead>, </tfoot>, </tbody>
16.Which of the following is not the element associated with HTML table layout?
a) size
b) spanning
c) alignment
d) color
Answer: d
Explanation: There are three elements in HTML table layout i.e. size, spanning and alignment.
Layout type can be achieved by setting Rows elements layout attribute to Fixed or Auto. Auto
attribute relies on browser compatibility whereas fixed layout relies on developer specification.
17. Which of the following element is not associated with a class attribute?
a) Row
b) <thead>
c) Column cell
d) Rows
Answer: b
Explanation: Column cell, Row, and Rows are the container elements. They have a class attribute
with the help of this we can apply special styling. Table alignment is also controlled style sheet
classes. Text-align and vertical-align are the style attributes that align the content of the table.
Answer: c
Explanation: Borders can’t be applied on <tr> elements. It can’t be applied on table structural
elements. For setting borders with <tr> element, border-collapse property should be set to collapse.
Syntax is
table {border-collapse: collapse;}
th, td{border-bottom: 2px dotted red; }
Answer: d
Explanation: We can specify column width in three ways i.e. Percentage, Fixed, Proportional. Fixed
width is given in pixels. Percentage specification is the percentage of horizontal space availability in
the table. The proportional specification is the portions of fixed horizontal space required for the
table.
Answer: c
Explanation: align attribute is the alignment of data and for justification of text in the cell. It can take
the values left, right, justify, center, char. Justify is for double justifying the text, char is for aligning
text around a particular character.
Answer: a
Explanation: valign attribute is for specifying the vertical position of the data in a cell. It can take the
values middle, top, baseline, bottom, Top is for the top of the cell’s data, middle is for the centered
data, bottom is for the bottom of the cell, first text line occurs on the baseline which is common to all
the cells.
22.Which among the following is the correct way in HTML to insert an image?
(a) <img url=“https://bit.ly/2FicgIx”>Geeksforgeeks</img>
(b) <img href=“https://bit.ly/2FicgIx” alt= “Geeksforgeeks”></img>
Answer: (c)
23. Which of the following gives a text description of the image if it is not available?
a) alt
b) title
c) src
d) height
Answer: a
Explanation: The alt attributes gives a text description of the image if the image is not available at a
time. Syntax is
src attribute defines the address of the image, title attribute provides some additional information
about the image. Height attribute is used to adjust the height of an image as per need.
a) <figure>
b) <src>
c) <alt>
d) <title>
Answer: a
Explanation: An alt attributes gives a text description of the image if the image is not available at a
time. An address of image is defined by src attribute. HTML5 has introduced new element named
<figure>. It contains image and its caption and hence both are associated with each other. We can
also have more than one image inside <figure> element and they share the same caption. Syntax is
a) character set
b) links
c) scripts
d) color
Answer: d
Explanation: Metadata define character set, title of the document, links, styles, scripts and other meta
information. E.g. <!doctype html> <html> <title> The Code </title> <meta charset= “UTF-8”>
</head> <body>.
a) <p>
b) <pre>
c) <hr>
d) <ins>
Answer: b
Explanation: <p> defines paragraph/text. Preformatted test is defined by <pre> element. The text
written inside this element will be displayed in fixed-width font. It also preserves line breaks and
spaces. E.g.
This is the first line. </pre>. A text which has been inserted into a document is defined by a <ins>..
27.Relative URLs are used to ____________
Answer: a
Explanation: Relative URLs are used for linking other pages within the same site. These are the
shorthand version of absolute URLs. It does not need a domain name. These URLs are helpful when
building a site on a computer because we can create links between pages without having set up for
hosting or domain name.
28. Which one of the following is not the value of the target attribute?
a) _blank
b) _top
c) _self
d) _empty
Answer: d
Explanation: Where to open linked document is specified by target attribute. It can have the values
_blank, _top, _parent, _self, framename. _blank opens linked document is a new tab or window. The
linked document is opened in the parent frame by _parent. Linked document is opened in a named
frame by framename. Linked document is opened in the same window by _self.
29.What is the path for an image located in same folder as the current page?
Answer: a
Explanation: The path <img src= “pic.jpg”> indicates that pic.jpg is located in same folder as
current page. The path <img src= “images/pic.jpg”> indicates that pic.jpg is located in current
folder. The path <img src= “/images/pic.jpg”> is located in images folder at root of current web.
The path <img src= “../pic.jpg”> indicates that pic.jpg is located in folder one level up from
current folder.
a) href
b) id
c) target
d) <a>
Answer: b
Explanation: id attribute is used for defining bookmarks in a page. For linking to the bookmark we
use href attribute. Target attribute is used to define where to open a linked document. <a> element is
used to define a link.
a) Selector
b) Attribute
c) Value
d) Tag
Answer: a
Explanation: HTML element h1 is used in CSS for styling then it is also called a selector. Attributes
are the special words which control the element’s behaviour. To show the start and end of HTML
element, tag is used.
a) Selector
b) Rule
c) Declaration
d) Value
Answer: c
Explanation: In CSS, color:red is the declaration for an element saying that the given element has to
apply a red color. Color is one of CSS property.
34. Which selector is used to specify a rule to bind a particular unique element?
a) id
b) class
c) tag
Answer: a
Explanation: For binding a particular unique element, id selectors are used. While for group of
elements, class selector can be used.
a) <script>
b) <style>
c) <css>
d) <!DOCTYPE html>
Answer: b
Explanation: <style> </style> tag is used to embed CSS in HTML page, while <script> </script> is
used to embed JS in HTML. <!DOCTYPE html> is HTML5 declaration.
36.Which of the following value is supposed to be a slightly bolder weight that standard bold in font
attribute?
a) empasize
b) light
c) lighter
d) dark
Answer: d
37.Which of the following property allows contextual adjustment of inter-glyph spacing, i.e. the
spaces between the characters in text?
a) font-style
b) font-family
c) font-kerning
d) font-variant
Answer: c
38.Which of the following value specifies whether the user agent is allowed to synthesize bold or
oblique font faces when a font family lacks bold or italic faces?
a) font-weight
b) font-synthesis
c) font-kerning
d) font-variant
Answer: b
39.Which of the following selects a normal, or small-caps face from a font family?
a) font-weight
b) font-synthesis
c) font-kerning
d) font-variant
Answer: d
40.Which of the following Allows you to expand or condense the widths for a normal, condensed, or
expanded font face?
a) font-style
b) font-stretch
c) font-expand
d) none of the mentioned
Answer: d
Answer: d
Explanation: In this case, we should see the browser continue to parse the value of color as “red
textdecoration:
underline” before it sees a closing semicolon. The font-style property that follows would then be
used. Because the color property has an illegal value, it should be ignored.
h1 {color: "green";}
c) error occors
d) nothings happen
Answer: d
Explanation: Output of above code snippet won’t happen as the declaration syntax is wrong. The
correct declaration is : h1 { color: green; } which will yeild an output. In CSS, we don’t write
value in double quotes.
44. With, which tag you write the style rules directly within the document found
a) <script>
b) <php>
c) <style>
d) <css>
Answer: c
Explanation: In <style></style> tag we write the style rules directly within the document in the
head section of the document. <script></script> tag is used to add javascript in the document.
45.For Inline Style, we don’t need to reapply style information throughout the document and
outside documents.
a) True
b) False
Answer: b
Explanation: In inline style, properties are confined with a particular element to which it is applied. It
won’t be applied to other element of the same type. We need to reapply style information throughout
the document whenever it is necessary.
46.For External Style Sheets in some cases when @import is used, the browser may cause a
rendering “flash” under slow loading conditions.
a) True
b) False
Answer: a
Explanation: External Style Sheets in some cases when @import is used the browser may cause a
rendering “flash” under slow loading conditions.
a) px
b) em
c) pt
d) mm
Answer: b
48.Which of the following element is used for linking a External Files to the html page?
a) <script>
b) <style>
c) <link>
Answer: c
49.Which of the following color has this value #ff0000?
a) blue
b) green
c) red
d) yellow
Answer: c
50.Which of the following attribute specifies the URL of the linked resource?
a) src
b) link
c) rel
d) href
Answer: d
Explanation: href attribute specifies the URL of the linked resource. A URL might be absolute or
relative.
A. It is used to describe and validate the structure and the content of XML data.
A. XZD
B. XAS
C. XSD
D. XFD
Ans : C
a) Node
b) Attributes
c) Elements
d) Arrays
Answer: a
Explanation: The HTML DOM model is constructed as a tree of Objects. In the HTML DOM
(Document Object Model), everything is a node:
b) Queue
c) Hierarchy
d) Stack
Answer: c
Explanation: The HTML DOM model is constructed as a tree of Objects. The objects are
organized in the hierarchy format in the HTML DOM.
a) Legacy DOM
b) W3C DOM
c) IE4 DOM
Answer: d
Explanation: IE4 document object model was introduced in Version 4 of Microsoft’s Internet
Explorer browser. IE 5 and later versions include support for most basic W3C DOM features. All
of the above mentioned are types of HTML DOM.
a) Window Object
b) Document Object
c) Form Object
Explanation: The DOM is arranged in the form of tree with every node as an object. Window
object is the top of the hierarchy. It is the outmost element of the object hierarchy.
Answer: b
Explanation: The Legacy DOM: This is the model which was introduced in early versions of
JavaScript language. It is well supported by all browsers but allows access only to certain key
portions of documents, such as forms, form elements, and images.
58.What is the reason for avoiding the attributes property in the HTML DOM?
a) Found unnecessary
d) Considered irrelevant
Answer: b
Explanation: When a web page is loaded, the browser creates a Document Object Model of the
page. The reason for avoiding the attributes property in the HTML DOM is because Attributes
don’t have attributes.
59.A computer that translates …………………… of another computer into an …………… and vice
versa, upon request is known as DNS server.
a) 120
b) 130
c) 140
d) 90
Answer: c
Explanation: In HTML one can use a color name to specify a color e.g. Tomato, Orange,
DodgerBlue, MediumSeaGreen, Gray, SlateBlue, Violet, LightGray etc. For colored fonts, we used
text-decoration property to set the color of the text.
a) font-style: normal
b) font-style: italic
c) font-style: oblique
d) font-style: capitalize
Answer: d
Explanation: Text-transform: capitalize, capitalizes the first letter of each word whereas font-style
set font as normal, italic, oblique. We use text-transform: uppercase and text-transform: lowercase
to change the text from lowercase to uppercase and from uppercase to lowercase respectively.
62.What should be set with text-align property so that every line has equal width like in magazines
and newspapers?
a) text-align: justify
b) text-align: none
c) text-align: bottom
d) text-align: top
Answer: a
Explanation: By setting text-align property to “justify”, each line is stretched so that every line has
equal width, left and right margins are straight like in magazines and newspapers. Text-align:
center, text-align: right, text-align: left is also used for aligning the text at center, right and left
respectively.
a) <strong>
b) <em>
c) <b>
d) <blockquote>
Answer: b
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <b></b>
makes text bolder. A section which is quoted from another source is specified by <blockquote>.
<em> element indicates emphasis, browser will show the contents of <em> element in italic.
64.Which works similar to <b> element?
a) <strong>
b) <em>
c) <i>
d) <blockquote>
Answer: a
Explanation: The words written inside <strong> can be said with strong emphasis. Browser shows
contents written inside <strong> element in bold.
a) <em>
b) <q>
c) <abbr>
d) <blockquote>
Answer: c
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element
in italic. We used <q> element for shorter quote. Browser put quote around <q> element. A section
which is quoted from another source is specified by <blockquote>. For using, abbreviation or
acronym <abbr> element is helpful. A title element is to be used with abbr.
<p>The <abbr title=”Doctor”>Dr.</abbr> is on the way.</p>
b) contains IP address
d) contains url
View Answer
Answer: a
Explanation: The contact details for author of a page is specified by <address> attribute. The
content is often displayed in italics,
e.g.
<address>
<a href="mailto:[email protected]">Example</a>
</address>
Output:
Example
a) <ins>
b) <del>
c) <em>
d) <strong>
View Answer
Answer: b
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <em>
element indicates emphasis, browser will show the contents of <em> element in italic. <ins>
element shows the content that has been inserted, usually it has underline. <del> element shows
text that has been deleted from, usually it has a line through the content.
Answer: a
Explanation: For bidirectional override of current text direction, we used <bdo> element, e.g. <bdo
dir=”rtl”>Text is right to left</bdo>. This element was already there before HTML5. It is
supported by all the browsers.
a) <tiny>
b) <min>
c) <small>
d) <em>
Answer: c
Explanation: min is an attribute for input method for inserting minimum value. smaller text is
define by <small>element. <em> is used for emphasis usually it is display in italics.
70.Metadata store information about the web page that is not necessarily visible to end users.
a) True
b) False
Answer: a
Explanation: Metadata is “data [information] that provides information about other data. Meta tags
store information about the web page—known as metadata that is not necessarily visible to end
users (unless you reveal the page source code).
71. Which is the property of a Window object that holds the name of the frame?
a) name
b) title
c) description
d) style
Answer: a
Explanation: The name property of a Window object holds the name of the frame if it has one.
This property is writable, and scripts can set it as desired. An iframe creates a nested browsing
context represented by a Window object of its own.
a. <a href=”xxx@yyy”>
b. <mail href=”xxx@yyy”>
c. <mail>xxx@yyy</mail>
d. <a href=”mailto:xxx@yyy”>
Answer: d
a) body tag
b) html tag
c) head tag
d) title tag
View Answer
Answer: c
Explanation: Metadata is information about data. The meta tag provides metadata/meta
information about the HTML document. Metadata will not be displayed on the page. Metadata is
present in head. The body tag defines document’s body. A title tag is an HTML element which
specifies the title of a web page.
Answer: c
Explanation: A charset attribute is new in HTML5. The charset is used to provide the character
support. The charset attribute specifies the character encoding which is in an external script file.
a) scheme
b) content
c) http-equiv
d) name
Answer: a
Explanation: The scheme attribute is supported in HTML but not in HTML5. Rest of attributes
like “content”, “http-equiv” and “name” are supported in both HTML as well as HTML5. The
scheme element is deprecated from HTML5.
76. ___________ prevents search engines from following links inside the page.
a) noarchive
b) nofollow
c) noindex
d) novalue
Answer: b
Explanation: NOFOLLOW attribute instruct search engines that a hyperlink should not influence
the link target’s ranking in search engine. NOINDEX prevents page from being indexed. To
prevent a page from being cracked, NOARCHIEVE tag can be used.
77.__________ prevents search engines from showing a cached link for the page.
a) nobot
b) nofollow
c) noarchive
d) nosearch
Answer: c
Explanation: The “noarchive” meta tag is used to tell browsers not to store cached link for the
page. A “nofollow” attribute instruct search engines that a hyperlink should not influence the link
target’s ranking in search engine. The “noindex” prevents page from being indexed.
b) physical layer
c) network layer
d) transport layer
Answer: b
Explanation: There are seven layers namely Physical layer, data Link layer, network Layer,
transport layer, session layer, presentation layer, and application layer. The physical layer is the
first layer, it is used for transmitting electrical signal across the network. Examples are USB,
Bluetooth or Ethernet.
a) presentation layer
b) network layer
c) application layer
Answer: b
Explanation: Network layer is the third layer, it deals with routing across complicated networks,
Internet Protocol (IP) is very commonly used at this level. It is capable of traveling across multiple
networks. It can also travel through intermediate devices like routers.
80.Which one is not the feature of HTTP protocol?
a) media independent
b) connectionless
c) responsive
d) stateless
Answer: c
Explanation: There are basically three main features of HTTP protocol i.e HTTP is media
independent, HTTP is connectionless and it is stateless also. Browser initiates HTTP request, and
then client disconnects from the server.
a) Request-header
b) Response-header
c) General-header
d) Entity-header
Answer: d
Explanation: A HTTP header which does not relate to the content of message is a response-header.
A request-header is used to provide information about request or response. Entity-header field
defines meta information about the body. If the body is not present resource is identified by
request. The general syntax for all the header fields is msg-header=field-name “:” [field-value].
General-header field is for both response and request.
a) Head
b) Get
c) Remove
d) Put
Answer: c
Explanation: There are various request methods on the resource identified by Request-URI. Get,
post, head, delete, trace, connect, put and options are some of the methods. For retrieving
information from the server we use Get method.
83.Which symbol is used when HTTP request does not apply to the particular source?
a) ‘&’
b) ‘*’
c) ‘#’
d) ‘@’
Answer: b
Explanation: When HTTP request does not apply to particular resource ‘*’ is used. It is applied to
the server itself. This is only allowed when the used method is not necessarily applied to the
resource. E.g. OPTIONS * HTTP/1.1
a) Expect
b) Host
c) Delete
d) If-None-Match
Answer: c
Explanation: For passing additional information about request we use request-header fields. These
are also requested modifiers. There are several request-header fields like Accept-Encoding,
Expect, Accept-Charset, Accept-Language, Form, Host, Authorization, If-Match,
Proxy-Authorization, Range, User-Agent, TE, Referer, If-Unmodified-Since, If-Range.
a) Location
b) Server
c) ETag
d) Referer
Answer: d
Explanation: For passing additional information about the response that can’t be placed in
Status-Line, we use response-header fields. Some of the fields are Age, Accept-Ranges, Location,
ETag, WWW-Authenticate, Vary, Server, Retry-After.
a) Communication
b) Standard
c) Metropolitan communication
d) Bandwidth
Answer: a
Explanation: A protocol is a set of rules that governs the communications between computers on a
network. These rules include guidelines that regulate the characteristics of a network including
access method, allowed physical topologies, types of cabling, and speed of data transfer.
87.Which tag is used with JavaScript?
a) <canvas>
b) <table>
c) <article>
d) <footer>
Answer: a
Explanation: <canvas> tag is basically used for graphics via scripting i.e. usually with Java Script
(scripting language, basically used to create animations). Other tags like <table>, <article>,
<footer> can be used simply with HTML.
a) <!doctype html>
b) <doctype html!>
c) <doctype html>
d) </doctype html>
Answer: a
Explanation: The correct syntax of HTML5 doctype is <!doctype html>, doctype is the very first
thing to write in HTML5. <!doctype html> or <!DOCTYPE HTML> both are same because
‘doctype’ keyword is not case sensitive.
89.What if one does not use the doctype in the starting of HTML document?
Answer: a
Explanation: If the browser finds <!doctype html> in the starting of an HTML document it sets the
document in standard mode but if one does not use a doctype, the browser goes to quirky mode. In
this mode, certain content will not be displayed as per one wrote that. So it is always
recommended to write a doctype at the very start of the HTML document.
a) <input>
b) <audio>
c) <embed>
d) <bdo>
Answer: d
Explanation: <bdo>, <rp>, <rt>, <ruby> are some tags which support Non-English language.
<input> is for web forms and <audio>, <embed> are the tags for audio and plug-ins.
a) <strike>
b) <center>
c) <small>
d) <big>
Answer: c
Explanation: Although HTML5 adds new elements, it also kicked out some old elements like
<big>, <center>, <font>, <tt>, <strike>. HTML5 adapted many elements also <small> is one
among these. The <small> element represents “small print”.
a) day
b) week
c) month
d) time
Answer: a
Explanation: Day is not defined in the pre-defined attribute list of input tag. Week attribute defines
week and year when used as attribute in input tag. Month specifies month and year when it is
accessed in input tag. The time attribute displays current time in html.
93.The new __________ element is supposed to represent some form of extra details, such as a
tooltip or revealed region that may be shown to a user.
a) progress
b) meter
c) details
d) menu
Answer: c
Explanation: A scalar measurement within a range or fractional value is defined by meter tag. A
list/menu of coommands is displayed by menu tag in html. The details tag specifies additional
details that the user can view or hide on demand. The details tag can be used to create an
interactive widget that the user can open and close. Any sort of content can be put inside the
<details> tag. Progress of a task is done by progress element.
94.The __________ element may contain not just links but also other interactive items, including the
newly introduced command element.
a) progress
b) meter
c) details
d) menu
View Answer
Answer: d
Explanation: A scalar measurement within a range or fractional value is defined by meter tag. The
menu tag defines a list/menu of commands. The menu tag is used for context menus, toolbars and
for listing form controls and commands. The details tag specifies additional details that the user
can view or hide on demand. The details tag can be used to create an interactive widget that the
user can open and close. Any sort of content can be put inside the <details> tag. Progress of a task
is done by progress element.
95.The __________ attribute effectively renders the iframe as an inline include, which allows the
parent document’s CSS to affect the contents of the iframe.
a) allow-forms
b) seamless
c) embed
d) allow-scripts
Answer: b
Explanation: Embed attribute attach external content at a specified point in document. The
seamless attribute is a boolean attribute. When present, it specifies that the iframe should look like
it is a part of the containing document (no borders or scrollbars). Allow-forms re-enables from
submission. Scripts are re-enabled by allow-scripts.
96. __________ allows the iframe to pull in content from elsewhere in the same domain.
a) allow-same-origin
b) allow-forms
c) allow-scripts
d) allow-pointer-lock
Answer: a
a) <form>
b) <optgroup>
c) <output>
d) <option>
Answer: b
Explanation: HTML form element is used in its <form> tag having its own structure which is used
by users for various tasks. If you have a long list of options, groups of related options are easier to
handle for a user. Result of calculation (script) is represented by output tag. A drop down list of
items is defined by <option> tag in HTML.
98. Which element specifies a list of pre-defined options for an input element?
a) <datalist>
b) <keygen>
c) <output>
d) <password>
Answer: a
Explanation: The datalist tag is used to provide an “autocomplete” feature on input elements.
Users will see a drop-down list of pre-defined options as they input data. Password defines
password field in HTML. It is attribute for input-type. The <keygen> element references from data
after form has submitted. Result of calculation (script) is represented by output tag.
i. <B>Go boldly</B>
a) iv
b) i
d) both iv and i
Answer: c
Explanation: Traditional HTML is case insensitive and thus we can write tag/element name either
in lowercase or uppercase or both which will be ignored by browser by default.
b) False
Answer: b
Explanation: Traditionally XHTML is case sensitive while HTML is case insensitive. In HTML
these are ignored by default by browsers.
Unit-3 MCQ(JavaScript, AJAX, Networking)
B - JavaScript has object-oriented capabilities that allows you to build interactivity into otherwise
static HTML pages.
C - The general-purpose core of the language has been embedded in Netscape, Internet Explorer,
and other web browsers.
Q 2 - Which of the following function of String object returns the primitive value of the specified
object.
A - toLocaleUpperCase()
B - toUpperCase()
C - toString()
D - valueOf()
Q 3 - Which of the following function of Array object creates a new array with all of the elements of
this array for which the provided filtering function returns true?
A - concat()
B - every()
C - filter()
D - some()
Q 4 - Which of the following function of Array object removes the first element from an array and
returns that element?
A - reverse()
B - shift()
C - slice()
D - some()
Q5. When a user views a page containing a JavaScript program, which machine actually executes the
script?
A. The </script>
B. The <script>
A. Validating a form
A. System.out.println("Hello World")
C. document.write("Hello World")
D. response.write("Hello World")
A. <js>
B. <scripting>
C. <script>
D. <javascript>
Q10. What is the correct syntax for referring to an external script called " abc.js"?
Q12. If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within
the paragraph?
A. "New Text"?
B. para1.value="New Text";
D. para1.nodeValue="New Text";
Q13. avaScript entities start with _______ and end with _________.
A. Semicolon, colon
B. Semicolon, Ampersand
C. Ampersand, colon
D. Ampersand, semicolon
Q15. What is the correct JavaScript syntax to change the content of the HTML element below?
A. alert("Hello World");
B. msg("Hello World");
C. msgBox("Hello World");
D. alertBox("Hello World");
A. function myFunction()
B. function = myFunction()
C. function:myFunction()
D. NONE
Q18. How do you round the number 7.25, to the nearest integer?
A. Math.round(7.25)
B. round(7.25)
C. rnd(7.25)
D. Math.rnd(7.25)
Q19. What is the correct JavaScript syntax for opening a new window called "w2" ?
A. w2 = window.open("http://www.w3schools.com");
B. w2 = window.new("http://www.w3schools.com");
Q20. Which event occurs when the user clicks on an HTML element?
A. onclick
B. onmouseover
C. onmouseclick
D. onchange
A. .javascript
B. .jvs
C. .js
D. .jsc
Q23. Select all the correct option(s). State the correct place of JS Code inside HTML -
A. All of these
B. Inside Head
C. Inside Body
D. Inside Single JavaScript File
Q24. JS code included inside head section is loaded before loading page.
A. True
B. False
Q25. _____ attribute is used to specify the character encoding used in an external script file.
A. charset
B. character
C. None of These
D. Type
A. IE
B. Mozilla Firefox
C. Netscape
D. Google Chrome
A. float
B. var
C. boolean
D. undefined
A. Netscape
B. Bell Labs
C. Sun Microsystems
D. IBM
A. Alert
B. Prompt
C. Confirm
var a = 1;
document.write(a--);
document.write(a);
A. 00
B. 01
C. 11
D. 10
A. 2
B. 1 plus 1 is 2
C. 1 plus 1 is 11
D. 1 plus 1 is 1 + 1
Q33. What if you use parseInt() to convert a string containing decimal value?
A. Throws Error
A. Throws Error
B. object
C. Displays Nothing
D. Current Date
Q35. The _______ method of an Array object adds and/or removes elements from an array.
A. Reverse
B. Shift
C. Slice
D. Splice
B. It provides a means of exchanging structured data between the Web server and client.
C. It provides the ability to asynchronously exchange data between Web browsers and a Web server.
D. It provides the ability to mark up and style the display of Web-page text.
A. True
B. False
C. more dynamic
A. Dependent on JavaScript
B. Security issues
C. Debugging is difficult
D. All of the above
A. JavaScript
B. XMLHttpRequest
C. Document Object Model
D. Flash
A. 2003
B. 2005
C. 2004
D. 2006
Q46. AJAX made popular by
A. Microsoft
B. IBM
C. Sun Microsystem
D. Google
A. POST, GET
B. GET, POST
C. Both A & B
Q48. The ___ property defines a function to be executed when the readyState changes.
A. onreadystatechange
B. onreadystateup
C. onreadystatedown
A. Bandwidth utilization
B. More interactive
D. All of these
A. responseXML
B. responseText
C. responseString
Q51. Which of these package contains classes and interfaces for networking?
a) java.io
b) java.util
c) java.net
d) java.network
Q52. Which of these is a protocol for breaking and sending packets to an address across a network?
a) TCP/IP
b) DNS
c) Socket
d) Proxy Server
Q53. How many ports of TCP/IP are reserved for specific protocols?
a) 10
b) 1024
c) 2048
d) 512
a) DatagramPacket
b) URL
c) InetAddress
d) ContentHandle
import java.net.*;
class networking
System.out.print(obj1.getHostName());
a) cisco
b) cisco.com
c) www.cisco.com
Q57. Which of these class is used to create servers that listen for either local or remote
client programs?
a) httpServer
b) ServerSocket
c) MimeHeader
d) HttpResponse
Q58. Which of these is a standard for communicating multimedia content over email?
a) http
b) https
c) Mime
d) httpd
Q59. What will be the output of the following Java program?
import java.net.*;
class networking
{
public static void main(String[] args) throws MalformedURLException
{
URL obj = new URL("https://www.ABC.com/XYZ");
System.out.print(obj.toExternalForm());
}
}
a) sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) https://www.ABC.com/XYZ
Q60. What does URL stands for?
a) Uniform Resource Locator
b) Uniform Resource Latch
c) Universal Resource Locator
d) Universal Resource Latch
Q61. Which of these methods is used to know host of an URL?
a) host()
b) getHost()
c) GetHost()
d) gethost()
Q62. hich of these data member of HttpResponse class is used to store the response
from an http server?
a) status
b) address
c) statusResponse
d) statusCode
Q63. Which of these is a bundle of information passed between machines?
a) Mime
b) Cache
c) Datagrams
d) DatagramSocket
Q64. Which of these class is necessary to implement datagrams?
a) DatagramPacket
b) DatagramSocket
c) All of the mentioned
d) None of the mentioned
Q65. Which of these method of DatagramPacket is used to obtain the byte array of data
contained in a datagram?
a) getData()
b) getBytes()
c) getArray()
d) recieveBytes()
Q66. Which of these method of DatagramPacket is used to find the port number?
a) port()
b) getPort()
c) findPort()
d) recievePort()
Q67. Which of these class must be used to send a datagram packets over a
connection?
a) InetAdress
b) DatagramPacket
c) DatagramSocket
d) All of the mentioned
Q68. Which API gets the SocketAddress (usually IP address + port number) of the
remote host that this packet is being sent to or is coming from.
a) getSocketAddress()
b) getAddress()
c) address()
d) none of the mentioned
Q69. Which constructor of DatagramSocket class is used to creates a datagram socket
and binds it with the given Port Number?
a. DatagramSocket(int port)
b. DatagramSocket(int port, InetAddress address)
c. DatagramSocket()
d. None of the above
Q70. The DatagramSocket and DatagramPacket classes are not used for connection-
less socket programming.
a. True
b. False
Q71. What does the java.net.InetAddress class represent?
a. Socket
b. IP Address
c. Protocol
d. MAC Address
Q72. Which class is used to create servers that listen for either local client or remote
client programs?
A) ServerSockets
B) httpServer
C) httpResponse
D) None of the above
Q73. The client in socket programming must know which informations?
A) IPaddress of Server
B) Port number
C) Both A & B
D) None of the above
Q74. Datagram is basically an information but there is no guarantee of its content, arrival
or arrival time.
A) True
B) False
Q75. The DatagramSocket and DatagramPacket classes are not used for connection-
less socket programming.
A) True
B) False
Q76. Which of these is a protocol for breaking and sending packets to an address
across a network?
a) TCIP/IP
b) DNS
c) Socket
d) Proxy Server
Q 77. Which of these class is used to create servers that listen for either local or remote
client programs?
a) httpServer
b) ServerSockets
c) MimeHeader
d) HttpResponse
Q78. A port number in java has…size.
A. 8-bit
B. 16-bit
C. 24-bit
D. 48-bit
Q79. Datagram Socket class in Java is used to create Sockets in
A. UDP client
B. UDP server
C. A and B both
D. None
Q80. In Java implementation of TCP, a client uses…….. a server uses……….
A. ClientSocket object; ServerSocket object
B. Socket object; ServerSocket objec
C. Socket object; ServerSocket object and Socket object
D. None of the choices are correct.
1 D
2 D
3 C
4 B
5 A
6 A
7 C
8 C
9 C
10 C
11 B
12 B
13 D
14 D
15 A
16 A
17 A
18 A
19 A
20 A
21 C
22 D
23 A
24 A
25 A
26 C
27 A
28 A
29 D
30 D
31 D
32 C
33 B
34 D
35 D
36 A
37 D
38 C
39 B
40 A
41 A
42 D
43 D
44 D
45 B
46 D
47 A
48 A
49 D
50 A
51 C
52 A
53 B
54 D
55 C
56 B
57 B
58 C
59 D
60 A
61 B
62 D
63 C
64 C
65 A
66 B
67 D
68 A
69 B
70 B
71 B
72 A
73 C
74 A
75 B
76 A
77 B
78 B
79 C
80 C
JDBC Drivers MCQ
Question 1
Select the packages in which JDBC classes are defined?
jdbc and javax.jdbc
rdb and javax.rdb
jdbc and java.jdbc.sql
java.sql and javax.sql
Question 2
Question 3
Question 5
Which of the following driver is the fastest one?
JDBC-ODBC Bridge Driver
Native API Partly Java Driver
Network Protocol Driver
JDBC Net Pure Java Driver
Question 6
Which of the following driver converts the JDBC calls into database-specific
calls?
JDBC-ODBC Bridge Driver (Type 1)
Native API-partly Java Driver (Type 2)
Net Protocol-pure Java Driver (Type 3)
Native Protocol-pure Java Driver (Type 4)
Question 7
Question 8
Question 9
Question 10
Question 11
Question 12
Question 13
Driver types are used to categorize the technology used to connect to database.
True
False
Question 14
Question 15
a. ParameterizedStatement
b. PreparedStatement
c. CallableStatement and Parameterized Statement
d. All kinds of Statements
a. Statement
b. PreparedStatement
c. QueryStatement
d. CallableStatement
Explanation:
a. CallableStatement
b. Statement
c. CalledStatement
d. PreparedStatement
A. db,
B. db:
C. jdbc,
D. jdbc:
Explanation: All JDBC URLs begin with the protocol jdbc followed by a colon
as a delimiter.
A. Connection.getConnection(url)
B. Driver.getConnection(url)
C. DriverManager.getConnection(url)
D. new Connection(url)
12- Which of the following is efficient than a statement due to the pre-
compilation of SQL?
A - Statement
B - PreparedStatement
C - CallableStatement
D - None of the above.
13-What is JDBC?
a. JDBC is a java based protocol.
b. JDBC is a standard Java API for database-independent
connectivity between the Java programming language and a
wide range of databases.
c. JDBC is a specification to tell how to connect to a database.
d. Joint Driver for Basic Connection
14-Which type of driver converts JDBC calls into the network protocol
used by the database management system directly?
Type 1 driver
Type 2 driver
Type 3 driver
Type 4 driver
statement
connection
query
both A and B
17-Which type of driver provides JDBC access via one or more ODBC drivers?
Type 1 driver
Type 2 driver
Type 3 driver
Type 4 driver
18-Which of the following methods are needed for loading a database driver in
JDBC?
registerDriver()
Class.forName()
Both A and B
getConnection()
19-Which driver is efficient and always preferable for using JDBC applications?
Type – 4
Type – 3
Type – 2
Type – 1
20-Are prepared statements actually compiled?
Yes, they compiled
No, they are bound by the JDBC driver
21-Which of the following describes the correct sequence of the steps involved
in making a connection with a database.
1. Loading the driver
2. Process the results.
3. Making the connection with the database
4. Executing the SQL statements
1,3,4,2
1,2,3,4
2,1,3,4
4,1,2,3
22- In type-1 driver database is _______ and platform is _______.
dependent, dependent
independent, dependent
dependent, independent
independent, independent
23- Driver types are used to categorize the technology used to connect to
database.
True
False
24- JDBC stands for:
Java Database Component
Java Database Connectivity
Java Database Control
None
25- Which of the following driver converts the JDBC calls into database-
specific calls?
JDBC-ODBC Bridge Driver (Type 1)
Native API-partly Java Driver (Type 2)
Net Protocol-pure Java Driver (Type 3)
Native Protocol-pure Java Driver (Type 4)
UNIT 4 WebTech
114 MCQs
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
Answer : D
2) Which case of a session bean obtains the UserTransaction object via the EJBContext using the
getUserTransaction() method in EJB transaction management?
a. Bean-managed transactions
b. Container-managed transactions
c. Both A & B
d. None of the above
3) EJB QL is a Query Language provided for navigation across a network of enterprise beans and
dependent objects defined by means of container managed persistence.
a. True
b. False
4) A message driven bean is like statefull session bean that encapsulates the business logic and
doesn't maintain state.
a. True
b. False
ANSWER: False
6) JMS is mainly used to send and receive message from one application to another.
a. True
b. False
ANSWER: True
7) Which session bean maintain their state between client invocations but are not required to
maintain their state across server crashes or shutdowns?
8) Which EJB container must provide an implementation of Java Naming and Directory Interface
(JNDI) API to provide naming services for EJB clients and components?
- Published on 21 Jul 15
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
ANSWER: Naming support
9) EJB is a specification for J2EE server, not a product; Java beans may be a graphical component
in IDE.
a. True
b. False
ANSWER: True
10) A session bean represents a multiple clients inside the Application Server.
a. True
b. False
ANSWER: False
11) Which component does the Entity bean represent the persistent data stored in the database?
- Published on 20 Jul 15
a. Server-side component
b. Client-side component
12) EJB is a specification for J2EE server, not a product; Java beans may be a graphical
component in IDE.
- Published on 20 Jul 15
a. True
b. False
ANSWER: True
a. True
b. False
ANSWER: True
15) The life cycle of session bean is not maintained by the application server (EJB Container).
- Published on 17 Jul 15
a. True
b. False
ANSWER: False
a. Entity Bean
b. Session Bean
c. Both A & B
17) Which component does the Entity bean represents the persistent data stored in the database?
- Published on 15 Jul 15
a. Server-side component
b. Client-side component
a. True
b. False
ANSWER: True
a. Security
b. Transaction Management
c. Both A & B
a. EJB
b. RMI
c. Both A & B
ANSWER: EJB
a. 2
b. 3
c. 4
d. 5
ANSWER: 3
22) Which type of instances retain no data or conversational state for a specific client?
- Published on 13 Jul 15
a. Message-Driven Bean
b. Session Bean
c. Entity Bean
b. Transaction Management
c. Both A & B
24) Which session bean does the conversational state between multiple method calls is not
maintained by the container?
- Published on 10 Jul 15
a. True
b. False
ANSWER: False
26) Which services are provided to EJB components by the EJB container?
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
A - This type of bean stores data of a particular user for a single session.
B - This is a type of enterprise bean which is invoked by EJB container when it receives a
message from queue or topic.
Answer: B
Explanation
A message driven bean is a type of enterprise bean which is invoked by EJB container when it
receives a message from queue or topic. Message driven bean is a stateless bean and is used to do task
asynchronously.
A - EJB Container normally creates a pool of few stateless bean's objects and use these
objects to process client's request.
B - Because of pool, instance variable values are not guaranteed to be same across
lookups/method calls.
Answer: C
Explanation
EJB Container normally creates a pool of few stateless bean's objects and use these objects to process
client's request. Because of pool, instance variable values are not guaranteed to be same across
lookups/method calls.
Answer : B
Explaination
mappedName attribute in @javax.ejb.Stateless annotation is used to specify the JNDI name of the
session bean.
29) Which of the following is correct about name attribute in @javax.ejb.EJB annotation?
A - It is used to specify name which will be used to locate the referenced bean in
environment.
name attribute in @javax.ejb.EJB annotation is used to specify name which will be used to locate the
referenced bean in environment.
30) Which of the following annotation is used to specify Local interface(s) of a session bean?
A - @javax.ejb.Stateless
B - @javax.ejb.Stateful
C - @javax.ejb.Local
D - @javax.ejb.EJB
Answer : C
Explaination
31) Which of the following is correct about @PostActivate annotation for a callback method?
B - Method is invoked when a bean is removed from the bean pool or is destroyed.
Answer : C
Explaination
A - @EJB
B - @Resource
Answer : B
Explaination
A - byte[]
B - String
C - Serializable Object
Answer : D
Explaination
34) Which of the following is correct about a Success attrribute of Bean Managed Transactions
in EJB?
Answer : B
Explaination
35) Which of the following is true about exceptions handling by EJB Container?
A - When Application Exception occurs, ejb container intercepts the exception but returns the
same to the client as it is.
B - EJB Container does not roll back the transaction unless it is specified in code by
EJBContext.setRollBackOnly() method.
Answer : C
Explaination
When Application Exception occurs, ejb container intercepts the exception but returns the same to the
client as it is. It does not roll back the transaction unless it is specified in code by
EJBContext.setRollBackOnly() method.
Options
A : @Qualifier
B : @Type
C : @Constructor
D : @Name
View Answer
Options
View Answer
39) What is the attribute of java bean to specify scope of bean to have single instance per Spring
IOC?
Options
A : prototype
B : singleton
C : request
D : session
View Answer
Options
A : destroy
B : destroy-method
C : destruction
D : destruction-method
41. Which of the following annotation is used to specify or inject a dependency as ejb instance
into another ejb?
A. javax.ejb.Stateless
B. javax.ejb.Stateful
C. javax.ejb.MessageDrivenBean
D. javax.ejb.EJB
View Answer
Workspace
Report
Discuss
Answer: Option D
Explanation:
A. transactional components
D. server-side components
View Answer
Workspace
Report
Discuss
Answer: Option B
Explanation:
A. Preserving of any state across method calls does not performed by Stateless session beans
B. Multiple users can access Stateful session beans at the same time
D. None
View Answer
Workspace
Report
Discuss
Answer & Explanation
Answer: Option A
Explanation:
44. Which EJB container must provide an implementation of Java Naming and Directory
Interface (JNDI) API to provide naming services for EJB clients and components?
A. Transaction support
B. Persistence support
C. Naming support
View Answer
Workspace
Report
Discuss
Answer: Option C
Explanation:
A. In both stateless and statefull session classes, the bean provider must write the method
public void remove()
B. The method << remove >> in the component interface can be accessed only by the remote
clients
C. The bean’s handle must be provided by the client, in order to ask the EJBHome for
removing a session bean
View Answer
Workspace
Report
Discuss
Answer: Option C
Explanation:
Answer : C
Explanation
Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled,
planned and executed.
47) In which of the following type of ResultSet, the cursor can only move forward in the result
set?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
C - ResultSet.TYPE_SCROLL_SENSITIVE
Answer : A
Explanation
ResultSet.TYPE_FORWARD_ONLY: The cursor can only move forward in the result set.
48) Which of the following type of JDBC driver, uses database native protocol?
Answer : D
Explanation
A - Statement
B - PreparedStatement
C - CallableStatement
D - QueryStatement
Answer : D
Explanation
A - PreparedStatement allows mapping different requests with same prepared statement but
different arguments to execute the same execution plan.
B - Prepared statements are more secure because they use bind variables, which can prevent
SQL injection attack.
Answer : C
Explanation
PreparedStatement allows mapping different requests with same prepared statement but different
arguments to execute the same execution plan. Prepared statements are more secure because they use
bind variables, which can prevent SQL injection attack.
51) How does JDBC handle the data types of Java and database?
A - The JDBC driver converts the Java data type to the appropriate JDBC type before sending
it to the database.
Answer : C
Explanation
The JDBC driver converts the Java data type to the appropriate JDBC type before sending it to the
database. It uses a default mapping for most data types. For example, a Java int is converted to an
SQL INTEGER.
54) Which of the following is correct about connection pooling?
A - Application server like WebLogic, WebSphere, jBoss and Tomcat provides the facilities
to configure connection pooling.
Answer : C
Explanation
If you use an application server like WebLogic, WebSphere, jBoss, Tomcat. , then your application
server provides the facilities to configure for connection pooling. If you are not using an application
server then components like Apache Commons DBCP Component can be used.
A - setFetchSize(int) defines the number of rows that will be read from the database when the
ResultSet needs more rows.
Answer : C
Explanation
setMaxRows(int) method of the ResultSet specifies how many rows a ResultSet can contain at a time.
setMaxRows(int) affects the client side JDBC object.
A - In typical database transactions, say one transaction reads and changes the value while the
second transaction reads the value before committing or rolling back by the first transaction.
This reading process is called as 'dirty read'.
B - There is always a chance that the first transaction might rollback the change which causes
the second transaction reads an invalid value.
Answer : C
Explanation
In typical database transactions, say one transaction reads and changes the value while the second
transaction reads the value before committing or rolling back by the first transaction. This reading
process is called as 'dirty read'. Because there is always a chance that the first transaction might
rollback the change which causes the second transaction reads an invalid value.
57) New drivers can be plugged-in to the JDBC API without changing the client code.
A - true
B - false
Answer : A
Explanation
New drivers can be plugged-in to the JDBC API without changing the client code.
Workspace
Answer: a
Explanation:
Driver: The database communications link, handling all communication with the database.
Statement: Encapsulates an SQL statement which is passed to the database to be parsed, compiled,
planned, and executed.
ResultSet: The ResultSet represents a set of rows retrieved due to query execution.
Workspace
Answer: d
Explanation: JDBC API is divided into two packages i.e. java.sql and javax.sql. We have to import
these packages to use classes and interfaces in our application.
A. Type 3 Driver
B. Type-2 Driver
C. Type-4 Driver
D. Type-1 Driver
Workspace
Answer: c
Explanation: The JDBC thin driver is a pure Java driver. It is also known as Type-4 Driver. It is
platform-independent so it does not require any additional Oracle software on the client-side. It
communicates with the server using SQL *Net to access Oracle Database.
2.7M
Workspace
Answer: b
Explanation: To create a database connection in Java, we must follow the sequence given below:
64) Which of the following method is used to perform DML statements in JDBC?
a) executeResult()
b) executeQuery()
c) executeUpdate()
d) execute()
Answer: c
Explanation: We use the executeUpdate() method for DML SQL queries that change data in the
database, such as INSERT, UPDATE, and DELETE which do not return a resultset.
65) How many transaction isolation levels provide the JDBC through the Connection interface?
a) 3
b) 4
c) 7
d) 2
Answer: b
66) Which of the following method is static and synchronized in JDBC API?
a) getConnection()
b) prepareCall()
c) executeUpdate()
d) executeQuery()
Answer: A
Explanation: A Java application using the JDBC API establishes a connection to a database by
obtaining a Connection object. The standard way to obtain a Connection object is to call the method
DriverManager.getConnection() method that accepts a String contains the database connection URL.
It is a static and synchronized method.
a) getConnection()
b) registerDriver()
c) forName()
d) Both b and c
Answer: d
By using the registerDriver() Method: To access the database through a Java application, we must
register the installed driver in our program. We can do this with the registerDriver() method that
belongs to the DriverManager class. The registerDriver() method takes as input a driver class, that is,
a class that implements the java.sql.Driver interface, as is the case with OracleDriver.
By using the Class.forName() Method: Alternatively, we can also use the forName() method of the
java.lang.Class to load the JDBC drivers directly. However, this method is valid only for JDK-
compliant Java virtual machines. It is invalid for Microsoft JVMs.
a) ParameterizedStatement
b) PreparedStatement
c) CallableStatement and Parameterized Statement
d) All kinds of Statements
Answer: b
a) Statement
b) PreparedStatement
c) QueryStatement
d) CallableStatement
Answer: c
Explanation:
Statement: Use this for general-purpose access to your database. It is useful when we are using static
SQL statements at runtime. The Statement interface cannot accept parameters.
PreparedStatement: It represents the pre-compiled SQL statements that can be executed multiple
times.
70) Identify the isolation level that prevents the dirty in the JDBC Connection class?
a) TRANSACTION_READABLE_READ
b) TRANSACTION_READ_COMMITTED
c) TRANSACTION_READ_UNCOMMITTED
d) TRANSACTION_NONE
Answer: b
Explanation: The isolation level TRANSACTION_READ_COMMITTED prevents the dirty read but
non-repeatable reads and phantom reads can occur.
Answer: b
Explanation: The way to allow two or more statements to be grouped into a transaction is to disable
the auto-commit mode. After the auto-commit mode is disabled, no SQL statements are committed
until we call the commit() method explicitly.
a) CallableStatement
b) Statement
c) CalledStatement
d) PreparedStatement
Answer: b
Explanation: The stored procedure is a database program that can be utilized to perform CRUD tasks
with the table. We can call these procedures by using the Statement Interface. It provides methods to
execute queries with the database.
73) What should be the correct order to close the database resource?What should be the correct
order to close the database resource?
Answer: d
Explanation: The golden rule to JDBC connections and statements is to close in the reverse order of
initiation or opening. In addition, the ResultSet is dependant on the execution of the Statement and the
Statement is dependant on the Connection instance. Hence, the closing should occur in that order
(ResultSet, Statement, and then Connection).
a) JDBC tracing
b) Exception handling
c) Both a and b
d) Only b
Answer: a
Explanation: The JDBC Driver supports both DriverManager and DataSource tracing as documented
in the JDBC 3.0 API specification. Trace information consists of JDBC API method entry and exit
points with the corresponding parameter and returns values. DriverManager.setLogWriter method to
send trace messages to a PrintWriter. The trace output contains a detailed listing of the JDBC activity.
75) Which JDBC driver can be used in servlet and applet both?
a) Type 3
b) Type 4
c) Type 3 and Type 2
d) Type 3 and Type 4
Answer: d
Explanation: Type 3 driver follows the three-tier approach which is used to access the databases. The
JDBC clients use standard network sockets to communicate with a middleware application server. In a
Type 4 driver, a pure Java-based driver that communicates directly with the vendor's database through
a socket connection.
a) Type 4
b) Type 3
c) Type 1
d) Type 2
Answer: c
Explanation: Type 1 driver is also known as the JDBC-ODBC bridge driver. It is a database driver
implementation that employs the ODBC driver to connect to the database. The driver converts JDBC
method calls into ODBC function calls.
Answer: d
Explanation: JDBC Net pure Java driver (Type 4) is the fastest driver because it converts the JDBC
calls into vendor-specific protocol calls and it directly interacts with the database.
a) TYPE_FORWARD_ONLY
b) CONCUR_WRITE_ONLY
c) TYPE_SCROLL_INSENSITIVE
d) TYPE_SCROLL_SENSITIVE
Answer: b
TYPE_FORWARD_ONLY: This is the default type and the cursor can only move forward in the
result set.
TYPE_SCROLL_INSENSITIVE: The cursor can move forward and backward, and the result set is
not sensitive to changes made by others to the database after the result set was created.
TYPE_SCROLL_SENSITIVE: The cursor can move forward and backward, and the result set is
sensitive to changes made by others to the database after the result set was created.
CONCUR_UPDATABLE: We can use the ResultSet update method to update the rows data.
Answer: a
Explanation: JDBC Savepoint helps us in creating checkpoints in a transaction and we can rollback to
that particular checkpoint.
80) How many stages are used by Java programmers while using JDBC in their programs?
a) 3
b) 2
c) 5
d) 6
Answer: d
Connecting to a database
Answer: a
Explanation: By creating an object to the driver class of the driver software, we can register the driver.
To register the JdbcOdbcDriver of the sun microsystems, we can create an object to the driver class
JdbcOdbcDriver, as follows:
a) 2
b) 3
c) 4
d) 5
Answer: c
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
3. By sending the driver class name directly to the forName() For example:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Class.forName(dname);
If you are using the above method to register the driver, we should have to specify the driver's name at
the time of running the program. The getProperty() method receives the driver name and stores the
driver name in dname.
We use the following command to provide the driver name at run time:
For example:
Answer: d
Explanation: Data Source Name (DSN) is a name given to the database to identify it in the Java
program. The DSN is linked with the actual location of the database.
84) Which statement is correct if we want to connect the Oracle database using the thin driver
provided by Oracle Corp.?
Answer: a
Explanation: We use the following statement to connect Oracle database using the thin driver.
a) Forward ResultSet
b) Scrollable ResultSet
c) Only a
d) Both a and b
Answer: d
Explanation: JDBC provides only two types of ResultSets: Forward and Scrollable ResultSet.
a) Variable
b) Object
c) Data type
d) Keyword
Answer: c
Explanation: SQL offers BLOB (Binary Large OBject) data type to store image files like .gif or .jpg
or jpeg into the database table.
87) Which data type is used to store files in the database table?
a) BLOB
b) CLOB
c) File
d) Both a and b
Answer: b
Explanation: To store a large volume of data such as text file into a table, we use CLOB (Character
Large OBject) data type of SQL.
Answer: a
89) Which of the following driver converts the JDBC calls into database-specific calls?
a) JDBC-ODBC Bridge Driver (Type 1)
b) Native API-partly Java Driver (Type 2)
c) Net Protocol-pure Java Driver (Type 3)
d) Native Protocol-pure Java Driver (Type 4)
Answer: b
Explanation: Type 2 driver converts JDBC calls into database-specific calls with the help of vendor
database library. It directly communicates with the database server.
a) Yes, but only if we call the method openCursor() on the ResultSet and if the driver and
database support this option.
b) Yes, but only if we indicate a concurrency strategy when executing the statement, and if the
driver and database support this option.
c) Yes, but only if the ResultSet is an object of class UpdateableResultSet and if the driver and
database support this option.
d) No, ResultSets are never updateable. We must explicitly execute a DML statement to change
the data in the underlying database.
Answer: b
Explanation: By default, a ResultSet object is not updatable and its cursor moves only in the forward
direction. If we want to create an updateable ResultSet object, either we can use
ResultSet.TYPE_SCROLL_INSENSITIVE or the ResultSet.TYPE_SCROLL_SENSITIVE type,
which moves the cursor forward and backward relative to the current position.
91) Which of the following interface provides the commit() and rollback() methods?
a) Statement Interface
b) ResultSet Interface
c) Connection Interface
d) RowSet Interface
Answer: c
Explanation: The connection interface provides the commit() and rollback() method. The commit()
method makes all changes made since the previous commit/rollback permanent and releases any
database locks currently held by this Connection object. The rollback() method undoes all changes
made in the current transaction and releases any database locks currently held by this Connection
object.
a) 2
b) 1
c) 3
d) Multiple
Answer: d
Explanation: Multiple statements can be created and used on the same connection, but only one
resultset at once can be created and used on the same statement.
93) JDBC API supports____________ and __________ architecture model for accessing the
database.
a) Two-tier
b) Three-tier
c) Both a and b
d) Only b
Answer: c
Explanation: The JDBC API supports both two-tier and three-tier processing models for database
access. In the two-tier model, a Java application talks directly to the data source. In the three-tier
model, commands are sent to a "middle tier" of services, which then sends the commands to the data
source.
i. A transaction is a set of one or more SQL statements that make up a logical unit of work.
ii. A transaction ends with either a commit or a rollback, depending on whether there are any
problems with data consistency or data concurrency.
iii. A lock is a mechanism that allows two transactions from manipulating the same data at the same
time.
iv. To avoid conflicts during a transaction, a DBMS uses locks, mechanisms for blocking access by
others to the data that is being accessed by the transaction.
1. Only i and ii
2. Only i and iii
3. Only i, ii, and iv
4. All the above
Answer: c
Explanation: The statements i, ii, and iv are true about transactions but iii is not because the lock
mechanism prohibits two transactions from manipulating the same data at the same time.
a) java.io.date
b) java.sql.date
c) java.util.date
d) java.util.dateTime
Answer: d
Explanation: java.util.date contains both date and time. Whereas, java.sql.date contains only date.
Answer: d
Explanation: Since the JDBC connection takes time to establish. Creating connection at the
application start-up and reusing at the time of requirement, helps performance of the application.
a) Slow performance
b) Encourages SQL injection
c) Prevents SQL injection
d) More memory usage
Answer: c
Explanation: PreparedStatement in Java improves performance and also prevents from SQL injection.
a) java.sql.TimeStamp
b) java.sql.Time
c) java.io.Time
d) java.io.TimeStamp
Answer: a
Explanation: java.sql.Time contains only time. Whereas, java.sql.TimeStamp contains both time and
date.
Answer: c
Explanation: setAutoCommit(false) does not commit transaction automatically after each query. That
saves a lot of time of the execution and hence improves performance.
a) Statement
b) PreparedStatement
c) CallableStatment
d) CalledStatement
Answer: c
Explanation: CallableStatement is used in JDBC to call stored procedure from Java program.
101) Which of the following is used to limit the number of rows returned?
a) setMaxRows(int i)
b) setMinRows(int i)
c) getMaxrows(int i)
d) getMinRows(int i)
Answer: a
Explanation: setMaxRows(int i) method is used to limit the number of rows that the database returns
from the query.
a) setBatch()
b) deleteBatch()
c) removeBatch()
d) addBatch()
Answer: d
Explanation: addBatch() is a method of JDBC batch process. It is faster in processing than executing
one statement at a time.
a) rollback()
b) rollforward()
c) deleteTransaction()
d) RemoveTransaction()
Answer: a
Explanation: rollback() method is used to rollback the transaction. It will rollback all the changes
made by the transaction.
a) TRANSACTION_NONE
b) TRANSACTION_READ_COMMITTED
c) TRANSACTION_REPEATABLE_READ
d) TRANSACTION_NONREPEATABLE_READ
Answer: d
Explanation: TRANSACTION_NONREPEATABLE_READ is not a JDBC connection isolation
level.
a) Doubleton
b) Singleton
c) Stateful
d) Stateless
Answer: a
Explanation: Stateful, Stateless and Singleton are session beans.
Answer: b
Explanation: java.io.Serializable is not a class. Instead it is an interface. Hence it cannot be extended.
a) /
b) \
c) –
d) //
Answer: a
Explanation: MANIFEST file uses classes using / file separator.
108) Which of the following is correct error when loading JAR file with duplicate name?
a) java.io.NullPointerException
b) java.lang.ClassNotFound
c) java.lang.ClassFormatError
d) java.lang.DuplicateClassError
Answer: c
Explanation: java.lang.ClassFormatError: Duplicate Name error is thrown when .class file in the JAR
contains a class whose class name is different from the expected name.
a) True
b) False
Answer: b
Explanation: JavaBeans do not add any security features to the Java platform.
a) Introspection
b) Events
c) Persistence
d) Serialization
Answer: d
Explanation: Serialization is not the feature of Java Beans. Introspection, Customization, Events,
Properties and Persistence are the features.
111) What is the attribute of java bean to specify scope of bean to have single instance per
Spring IOC?
a) prototype
b) singleton
c) request
d) session
Answer: b
Explanation: Singleton scope of bean specifies only one instance per spring IOC container. This is the
default scope.
a) init
b) init-method
c) initialization
d) initialization-method
Answer: b
Explanation: init-method is used to specify the initialization method.
a) destroy
b) destroy-method
c) destruction
d) destruction-method
Answer: b
Explanation: destroy-method is used to specify the destruction method.
a) @Qualifier
b) @Type
c) @Constructor
d) @Name
Answer: a
Explanation: Differet beans of the same class are identified by name.
Servlet
javax.servlet
javax.servlet.http
Both of the above.
None of the above.
class loading
init()
service()
destroy()
8- which lifecycle method make ready the servlet for garbage collection
init()
service()
destroy()
put()
9- What are Servlets?
Java Servlets are programs that run on a Web or Application server.
Java Servlets act as a middle layer between a request coming from a Web
browser or other HTTP client and databases or applications on the HTTP server.
Both of the above.
None of the above.
10- Which of the following is the correct order of servlet life cycle phase
methods?
init, service, destroy
initialize, service, destroy
init, execute, destroy
init, service, delete
11- When destroy method of servlet gets called?
The destroy method is called only once at the end of the life cycle of a
servlet.
The destroy method is called after the servlet has executed service method.
Both of the above
None of the above
12- Which are the session tracking techniques?
i. URL rewriting
ii. Using session object
iii.Using response object
iv. Using hidden fields
v. Using cookies
vi. Using servlet object
i, ii, iii, vi
i, ii, iv, v
i, vi, iii, v
i, ii, iii, v
13- What type of servlets use these methods doGet(), doPost(),doHead,
doDelete(), doTrace()?
Genereic Servlets
HttpServlets
All of the above
None of the above
14-Which cookie it is valid for single session only and it is removed each time
when the user closes the browser?
Persistent cookie
Non-persistent cookie
All the above
None of the above
15-Sessions is a part of the SessionTracking and it is for maintaining the client
state at server side.
True
False
16-Which method in session tracking is used in a bit of information that is sent
by a web server to a browser and which can later be read back from that
browser?
HttpSession
URL rewriting
Cookies
Hidden form fields
17-Which are the examples of Application Server?
Apache
Tomcat
JBoss
Weblogic
Both C & D
18- How many techniques are used in Session Tracking?
4
3
2
5
19-In HTTP Request method Get request is secured because data is exposed in
URL bar
True
False
20-Servlet technology is used to create web application
True
False
Web Technologies(Unit-5)
Servlet MCQ
Q 1 - When service() method of servlet gets called?
A - The service() method is called when the servlet is first created
B - The service() method is called whenever the servlet is invoked.
C - Both of the above.
D - None of the above.
Answer : B
Explaination
Each time the server receives a request for a servlet, the server spawns a new thread and calls
service() method.
Q 2 - Which of the following code is used to set content type of a page to be serviced using
servlet?
A - response.setContentType()
B - request.setContentType()
C - writer.setContentType()
D - None of the above.
Answer : A
Explaination
You call response.setContentType() method to set content type of a page to be serviced using
servlet.
Q 3 - Which of the following code is used to get cookies in servlet?
A - response.getCookies()
B - request.getCookies()
C - Cookies.getCookies()
D - None of the above.
Answer : B
Explaination
request.getCookies() returns an array containing all of the Cookie objects the client sent with
this request.
Q 4 - Which of the following code retrieves the MIME type of the body of the request?
A - new MimeType()
B - request.getContentType()
C - response.getContentType()
D - None of the above.
Answer : B
Explaination
request.getContentType() returns the MIME type of the body of the request, or null if the type is
not known.
Q 5 - Which of the following code encodes the specified URL for use in the sendRedirect
method?
A - response.encodeRedirectURL(url)
B - request.encodeRedirectURL(url)
C - Header.encodeRedirectURL(url)
D - None of the above.
Answer : A
Explaination
Answer : B
Explaination
response.addHeader(name,date) adds a response header with the given name and value.
Q 7 - Which of the following code can be used to set the content type for the body of the
response?
A - request.setContentType(type)
B - response.setContentType(type)
C - header.setContentType(type)
D - None of the above.
Answer : B
Explaination
response.setContentType(type) sets the content type for the body of the response.
Q 9 - Which of the following code is used to get an attribute in a HTTP Session object in
servlets?
A - session.getAttribute(name)
B - session.alterAttribute(name)
C - session.updateAttribute(name)
D - None of the above.
Answer : A
Explaination
session.getAttribute() returns the object bound with the specified name in this session, or null if
no object is bound under the name.
Q 10 - Which of the following code is used to set the session timeout in servlets?
A - session.setMaxInactiveInterval(interval)
B - response.setMaxInactiveInterval(interval)
C - request.setMaxInactiveInterval(interval)
D - None of the above.
Answer : A
Explaination
You can call public void setMaxInactiveInterval(int interval) method of session to set the
timeout for a session individually.
11.What is the difference between servlets and applets?
i. Servlets execute on Server; Applets execute on browser
ii. Servlets have no GUI; Applet has GUI
iii. Servlets creates static web pages; Applets creates dynamic web pages
iv. Servlets can handle only a single request; Applet can handle multiple requests
a) i, ii, iii are correct
b) i, ii are correct
c) i, iii are correct
d) i, ii, iii, iv are correct
Answer: b
Explanation: Servlets execute on Server and doesn’t have GUI. Applets execute on browser and
has GUI.
12 Which of the following code is used to get an attribute in a HTTP Session object in servlets?
a) session.getAttribute(String name)
b) session.alterAttribute(String name)
c) session.updateAttribute(String name)
d) session.setAttribute(String name)
Answer: a
Explanation: session has various methods for use.
13. When destroy() method of a filter is called?
a) The destroy() method is called only once at the end of the life cycle of a filter
b) The destroy() method is called after the filter has executed doFilter method
c) The destroy() method is called only once at the begining of the life cycle of a filter
d) The destroyer() method is called after the filter has executed
Answer: a
Explanation: destroy() is an end of life cycle method so it is called at the end of life cycle.
14. Which of the following is true about servlets?
a) Servlets execute within the address space of web server
b) Servlets are platform-independent because they are written in java
c) Servlets can use the full functionality of the Java class libraries
d) Servlets execute within the address space of web server, platform independent and uses the
functionality of java class libraries
Answer: d
Explanation: Servlets execute within the address space of a web server. Since it is written in java
it is platform independent. The full functionality is available through libraries.
Answer: b
Explanation: URL rewriting, using session object, using cookies, using hidden fields are session
tracking techniques.
16. The _______ specification defines an application programming interface for communication
between the server and the application program
a) Java Servlet
b) JDBC
c) Java Applet
d) Java Swing
Answer: a
Explanation: The java servlet specification defines an application programming interface for
communication between the server and the application program. The HttpServlet class in Java
implements the servlet API specification.
17. State true or false: Servlets are used to generate dynamic responses to HTTP requests.
a) True
b) False
Answer: a
Explanation: Servlets are used to generate dynamic responses to HTTP requests. The task of a
servlet is to process a request dynamically.
18. Which of these functions is not a part of the servlet lifecycle
a) Checking if an instance of servlet exists or not
b) Invoking the service method of the servlet
c) Shutting down the servlet
d) Pausing the servlet for a given period of time.
Answer: d
Explanation: Pausing the servlet for a given amount of time is not a part of the servlet lifecycle.
A servlet can be checked, invoked and destroyed but it cannot be paused.
19. Which of the following application servers do not provide built in support for servlets?
a) Tomcat server
b) Glassfish
c) JBoss
d) None of the mentioned
Answer: d
Explanation: All of the mentioned application servers provide built in support for servlets.
Glassfish and Tomcat are the most prominently used application servers.
Answer: b
Explanation: A servlet class extends the capabilities of servers that host applications which are
accessed by way of a request-response programming model.
21. What does MIME stand for?
a) Multipurpose Internet Messaging Extension
b) Multipurpose Internet Mail Extension
c) Multipurpose Internet Media Extension
d) Multipurpose Internet Mass Extension
Answer: b
Explanation: MIME is an acronym for Multi-purpose Internet Mail Extensions. It is used for
classifying file types over the Internet. It contains type/subtype e.g. application/msword.
22. What is the storage capacity of single cookie?
a) 2048 MB
b) 2048 bytes
c) 4095 bytes
d) 4095 MB
Answer: c
Explanation: Storage capacity of cookies is 4095 bytes/cookie.
Answer: d
Explanation: Applet and Servlet communicate through HTTP Tunneling.
Q.24 Which of the following statement is not correct about HTTP method ?
a. A POST request append data to the end of the URL.
b. A GET request append data to the end of the URL.
c. HTTP DELETE method request for the Server to delete the resource
d. HTTP OPTIONS request for communication options available on the request/response chain
Correct Answer : OPTION A, A POST request append data to the end of the URL
a. Web Container
b. Servlet Context
c. JVM
d. Server
Correct Answer : OPTION D, POST method sends data in the body of the request
30. Q. Deployment Descriptor(DD) is a _________ .
b. Text document
c. XML document that is used by Web Container to run servlets and JSPs.
d. Library file.
Correct Answer : OPTION C, XML document that is used by Web Container to run
servlets and JSPs.
31. Deployment Descriptor(DD) is used for initializing parameter. True or False?
a. True
b. False
a. service()
b. initialize()
c. init()
a. CONNECT method
b. COMPARE method
c. OPTIONS method
d. TRACE method
a. HttpServletRequest
b. HttpServletResponse
c. ServletConfig
d. ServletContext
a. sendURL()
b. redirectURL()
c. sendRedirect()
d. getRequestDispatcher()
a. BinaryInputStream s = request.getInputStream();
b. ServletInputStream s = request.getInputStream();
c. BinaryInputStream s = request.getBinaryStream();
d. ServletInputStream s = request.getInputStream();
A. getRequestDispatcher()
b. getDispatcher()
c. getRequest()
d. requestDispatcher()
d.None
a. getRequestMethod()
b. getHttpMethod()
c. getHttpRequestMethod()
d. getMethod()
a. ServletConfig
b. ServletInit
c. ServletContext
a. Servlet
b. ServletConfig
c. ServletContext
d. HttpServletContext
a. ServletConfig
b. ServletResponse
c. RequestDispatcher
d. HttpServletRequest
b. Any servlet can have access to HttpSession object through the getSession() method
c. A session will become invalid as soon as the user close all the browser window
a. request.getSession(false);
b. request.createSession();
c. request.getNewSession();
d. request.getSession();
a. getCookies()
b. getNewCookies();
c. cookies();
d. returnCookies();
a. getParameterValue()
b. getParameter()
c. getValue()
d. requestParameter()
a. if session already exist, it return the existing session else create a new session
d.none
a. getSessionId()
b. getUniqueId()
c. getUniqueSessionId()
d. getId()
b. Server
a. invalidateSession()
b. invalidate()
c. deleteSession()
d. delete()
a. getCreationTime()
b. getTime()
c. getStartingTime()
d. creationTime()
Ans:b,c,d
55.Which of the following interprets html code and renders webpages to user?
a.client
b.server
c.browser
Ans :C
56.What are the correct statement about server?
b.can be software
c.can be hardware
d.non of these
Ans:a,b,c
a.https
b.http
c.ftp
d.none of these
Ans:a,b
a.<action>
b.<form>
c.<input>
d.all of these
Ans:b
Ans:a,b,c
b.false
Ans:a
61.Which http method send by browser that asks the server to get the page only?
a.get
b.post
c.option
d.put
Ans:a
62.Which http method send by browser that gives the server what user data typed in the form?
a.put
b.post
c.get
d.none of these
Ans:b
a.We can't
b.Through url
c.Through payload
d.Non of these
Ans:b
64.When we are sending data in URL in get method, how to separate separate path and
parameter?
b.By &
c.By ?
d.All of these
Ans:c
65.When we are sending data in URL in get method, how to separate parameters?
a.,
b.;
c.?
d.&
Ans:d
Ans:c
a.application/java
b.image/bmp
c.text/html
d.text/css
e.text/plain
Ans:all
a.It tells the browser what type of data browser will send
b.It tells the browser what type of data browser will receive
c.It tells the server what type of data server will receive
d.It tells the server what type of data server will send
Ans:b
a.dynamic
b.static
d.none of these
Ans:b
b.tomcat
c.Lighttpd
d.nginx
e.glassfish
Ans:a,b,c,d
a.JBoss
b.JRun
c.WebLogic Server(BEA)
e.GlassFish
Ans:d
a.true
b.false
Ans:a
a.web-app
b.welcome-file-list
c.servlet
d.servlet-mappings
Ans:d
JSP MCQ
1) JSP stands for ___.
Ans :A
2) What is JSP?
A. Java Server Pages (JSP) is a server-side programming technology that enables the creation of
dynamic, platform-independent method for building Web-based applications.
B. Java Server Pages (JSP) is a client-side programming technology that enables the creation of
dynamic, platform-independent method for building Web-based applications.
C. Both A and B
Ans:A
3) Which of the following is the correct syntax to declare comments in JSP?
C. //..
Ans:A
A. include
B. page
C. export
D. useBean
Ans:C
5) Which technology do we mix our business logic with the presentation logic?
A. Servlet
B. JSP
C. Both A & B
Ans:A
6) Which JSP Action tags is used to include the content of another resource, it may be JSP, html
or Servlet?
A. <jsp:include >
B. <jsp:forward >
C. <jsp:plugin >
D. <jsp:papam >
Ans:A
A. HTML tags
B. JSP tags
C. Both A & B
Ans:C
A. javax.servlet.jsp
B. java.servlet
C. javax.servlet.jsp.tagext
D. Both A & C
Ans:D
Ans:A
A. True
B. False
Ans:A
Ans:D
A. platform independent
C. easily maintained
Ans:D
A. to catch any Throwable that occurs in its body and optionally exposes it.
Ans:A
A. Parsing of JSP
Ans D
C. It removes a variable from either a specified scope or the first scope where the variable is
found.
Ans:C
A. <%@ page…%>
B. <% page…%>
C. <!@ page…!>
Ans:A
17) Which syntax is used to defines the programming language (underlying language) being used
in the JSP?
Ans:A
Ans:B
19) A __ is used to insert the value of a scripting language expression, converted into a string,
into the data stream returned to the client.
A. JSP expression
B. ASP
C. PHP
Ans:A
A. useBean action first searches for an existing object utilizing the id and scope variables. If an
object is not found, it then tries to create the specified object.
Ans:C
Ans:A
A. javax.servlet.HttpContext
B. javax.servlet.ServletContext
C. javax.servlet.Context
D. javax.servlet.Application
Ans:B
23) Which tag should be used to pass information from JSP to included JSP?
Ans:B
A. Objects are accessible only from the pages which are processing the same request
B. Objects are accessible only from the pages which reside in same application
C. Objects are accessible only from the page in which they are created
D. Objects are accessible only from the pages which are in same session
Ans:D
A. True
B. False
Ans:A
26) Which one is the correct order of phases in JSP life cycle?
Ans:A
A. ServletRequest
B. HttpServletRequest
C. Request
D. HttpRequest
Ans :B
A. id, type
B. type, property
C. type,id
D. id, class
Ans:D
A. compilation
B. translation
C. Both A and B
D. syntax
Ans:D
30) Which of the scripting of JSP not putting content into service method of the converted
servlet?
A. Declarations
B. Expressions
C. Scriptlets
Ans:B
A - True
B - False
Answer : A
Explaination
JSP container creates _jspService() methods so it should not be overridden.
A - html
B - jsp
C - javaScript
D - css
Answer : B
Explaination
jsp is a server side technology.
A - True
B - False
Answer : B
Explaination
No, Jsp pages are not required to be mapped/configured in web.xml
A - True
B - False
Answer : B
Explaination
isErrorPage is required to be set true, it is false by default.
A - javax.servlet.ServletContext
B - javax.servlet.ServletConfig
C - javax.servlet.jsp.PageContext
D - javax.servlet.Application
Answer : C
Explaination
The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The
pageContext object is used to represent the entire JSP page.
A - true
B - false
Answer : A
Explaination
The default value of the attribute is true, meaning that expressions, ${...}, are evaluated as
dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated
but rather treated as static text.
A - The isELIgnored option gives you the ability to disable the evaluation of Expression
Language (EL) expressions.
Answer : C
Explaination
The isELIgnored option gives you the ability to disable the evaluation of Expression Language
(EL) expressions. The default value of the attribute is true, meaning that expressions, ${...}, are
evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are
not evaluated but rather treated as static text.
38)Which of the following is true about Initialization phase in JSP life cycle?
A - When a container loads a JSP it invokes the jspInit() method before servicing any requests.
39) Can you make use of a ServletOutputStream object from within a JSP page?
A - true
B - false
Answer : B
Explaination
No. You are supposed to make use of only a JSPWriter object (given to you in the form of the
implicit object out) for replying to clients.
C - It removes a variable from either a specified scope or the first scope where the variable is
found
Answer : C
Explaination
The <c:remove > tag removes a variable from either a specified scope or the first scope where
the variable is found (if no scope is specified).
41) Which of the following is true about JSP?
A.1 & 2
B.1 & 3
C.2 & 3
A.jspInit()
B._jspService()
C.jspDestroy()
Explanation
Correct Option :D.
43) Request processing of JSP is done by calling which method?
A.jspInit()
B._jspService()
C.jspDestroy()
D._jspRequest()
Explanation
Correct Option :B.
44) Which of the following method helps in jsp page initialization?
A.jspInit()
B._jspService()
C.jspDestroy()
D.init()
Explanation
Correct Option :A.
45) Which of the following is correct about JSP?
2. JSP translator is a part of the web server which is responsible for translating the JSP page into
Servlet.
A.only 1
B.only 2
C.Both 1 & 2
D.None
Explanation
Correct Option :C.
46) Which of the following folder in JSP project contains web.xml file?
A.META-INF
B.WEB-INF
C.context-root
D.Any of A & B
Explanation
Correct Option :B.
47) Arrange in correct sequence of JSP life cycle.
1. Instantiation
2. Request processing
3. Initialization
4. Classloading
6. Destroy
A.7-5-4-1-3-2-6
B.6-5-4-1-3-2-7
C.1-5-4-7-3-2-6
D.7-5-4-3-1-2-6
Explanation
Correct Option :A.
48) In JSP, java code can be written inside the jsp page using _____________
A.scriptlet tag
B.expression tag
C.declaration tag
Explanation
Correct Option :A.
49) Which of the following can be used as scripting elements in jsp?
A.scriptlet tag
B.expression tag
C.declaration tag
Explanation
Correct Option :D.
50) The code placed within _______ is written to the output stream of the response.
A.declaration tag
B.scriptlet tag
C.expression tag
Explanation
Correct Option :C.
51. <%= statement %>
This represents:
A.scriptlet tag
B.expression tag
C.declaration tag
D.taglib directive
Explanation
Correct Option :B.
52. Which of the following scripting elements can be used to declare methods and fields?
A.scriptlet tag
B.expression tag
C.declaration tag
Explanation
Correct Option :C.
53) How many implicit objects are there in jsp?
A.7
B.8
C.9
D.10
Explanation
Correct Option :C.
54) Which of the following are implicit objects in jsp?
A.request
B.config
C.application
Explanation
Correct Option :D.
55) Which of the following is not implicit object in jsp?
A.session
B.page
C.pageContext
D.cookies
Explanation
Correct Option :D.
56)_________ can be used to get request information such as parameter, header information,
remote address, server name, server port, content type, character encoding etc.
A.JSP request
B.JSP response
C.JSP config
D.JSP session
Explanation
Correct Option :A.
57)The ________ object is created by the web container for each jsp page.
A.application
B.config
C.exception
Explanation
Correct Option :B.
58)This object can be used to get initialization parameter from configuaration file (web.xml)
A.config
B.application
C.session
D.request
Explanation
Correct Option :B.
59)Which of the following is not a jsp directive element?
A.page directive
B.include directive
C.taglib directive
D.session directive
Explanation
Correct Option :D.
60)The pageContext object can be used to set or get or remove attributes from which of the
following scopes
A.request
B.session
C.application
Explanation
Correct Option :D.
61)Which of the following is not a jsp action tag?
A.jsp:forward
B.jsp:useBean
C.jsp:setProperty
D.jsp:setException
Explanation
Correct Option :D.
62)Which of the following is/are jsp action tags?
A.jsp:getProperty
B.jsp:plugin
C.jsp:fallback
Explanation
Correct Option :D.
63)______ action tag helps embeds another components such as applet.
A.jsp:plugin
B.jsp:config
C.jsp:setProperty
D.jsp:fallback
Explanation
Correct Option :A.
64) <%@ page ... %>
Above jsp element defines page-dependent attributes, such as:
A.scripting language
B.error page
C.buffering requirements
E.Only A & B
Explanation
Correct Option :D.
All of the above is the correct answer
Explanation
Correct Option :A.
Includes a file during the translation phase is the correct answer
66)<%@ taglib ... %>
above jsp element is used to:
A.Declare a tag library used in the page
Explanation
Correct Option :D.
All of the above is the correct answer
67)Which of the following jsp element makes a JavaBeans component available in a page?
A.jsp:useBean element
B.jsp:getProperty element
C.jsp:include element
D.jsp:plugin element
Explanation
Correct Option :A.
jsp:useBean is the correct answer
A.Includes the response from a servlet during the request processing phase
B.Includes the response from a JSP page during the request processing phase
E.Only A & B
Explanation
Correct Option :E.
Only A & B is the correct answer
69)jsp element is used to:
C.Adds a parameter value to a request handed off to another servlet or JSP page
D.Includes the response from a servlet or JSP page during the request processing phase
Explanation
Correct Option :A.
Forwards the processing of a request to a servlet or JSP page is the correct answer
70)Gets a property value from a JavaBeans component and adds it to the response in jsp
A.jsp:getProperty element
B.jsp:setProperty element
C.jsp:param element
D.jsp:includeProperty element
Explanation
Correct Option :A.
jsp:getProperty element is the correct answer
71)Generates HTML that contains the appropriate client browser-dependent elements (OBJECT
or EMBED) needed to execute an Applet with the Java Plugin software
A.jsp:forward element
B.jsp:plugin element
C.jsp:setProperty element
D.jsp:useBean element
Explanation
Correct Option :B.
jsp:plugin element element is the correct answer
72)<% ... %>
above jsp element is known as :
A.scriptlet
B.declaration
C.expression
D.beans
E.taglib
Explanation
Correct Option :A.
scriptlet is the correct answer
A.scriptlet
B.expression
C.declaration
D.beans
E.taglib
Explanation
Correct Option :C.
declaration is the correct answer
C.The JSP container is often implemented as a servlet configured to handle all requests for JSP
pages.
D.A JSP container is responsible for converting the JSP page into a servlet
Explanation
Correct Option :B.
A JSP page can be sent as-is to the browser is the correct answer
75)A servlet container and a JSP container are often combined into one package under the name:
A.Web services
B.Microservices
C.Interface
D.IOC container
E.Web container
Explanation
Correct Option :E.
web container is the correct answer
Explanation
Correct Option :C.
Page, Request, Session, Application is the correct answer
A.generatePdfFormat
B.generatePdf
C.contentType
D.typePDF
E.PdfContent
Explanation
Correct Option :C.
contentType is the correct answer
q2- JSP
1-All servlet classes are required to be mapped and configured in web.xml.
True
False
2-Which of the following method can be used to read a form parameter in JSP?
request.getParameter()
response.getParameter()
request.getValue()
response.getValue()
7-How many jsp implicit objects are there and these objects are created by the
web container that are available to all the jsp pages?
8
9
10
7
13-JSPs eventually are compiled into Java servlets, you can do as much with
JSPs as you can do with Java servlets.
True
False
14-Which technology do we mix our business logic with the presentation logic?
Servlet
JSP
Both A & B
None of the above
UNIT-1
1-A piece of icon or image on a web page associated with another webpage is called ______
a) url
b) hyperlink
c) plugin
d) extension
Ans- b) hyperlink
4- On which one of the following dates World Wide Web was invented?
a)1972
b)1989
c)1986
d)1930
Ans- b)1989
6- Internet is a.
a) local computer network
b) a world wide network of computers
c) an interconnected network of computers
d) a world wide interconnected network of computers which use a common protocol to
communicate with one another
Ans- d) a world wide interconnected network of computers which use a common protocol to
communicate with one another
a) i, ii
b) i, ii, iii
c) i, ii, iv
d) ii, iii and iv
12-Computer that requests the resources or data from other computer is called as ________
computer.
a)Client
b)Server
Ans- a) Client
13- _________ is set of rules, that is used to communicate applications to each other.
a) HTML
b) Website
c) Protocol
d) XML
Ans- c) Protocol
Ans- c) TCP/IP
http://www.c4learn.com
a) c4learn
b) www
c) http
d) .com
Ans- c) http
Ans- b) POP3
17- Which one of the following protocol is used to receive mail messages?
a) SMTP
b) POP
c) IMAP
d) All of the above
Ans- b) SMTP
Ans- a) Source
22- The FTP protocol allows the user to __________ files over the internet.
a) Upload
b) Download
c) Both Upload and download
d) none of these
23- A typical __________ program obtains a remote reference to one or more remote objects
on a server and then invokes methods on them.
a) Server
b) Client
c) Thread
d) Concurrent
Ans- b) Client
25- In the Client-Server architecture, the component that processes the request and sends the
response is
(a) Client
(b) Server
(c) Protocol
(d) Network
Ans- b) Server
27- which of the following is correct order for web development strategies?
i) Register with ISP
ii) Design and Specification
iii) Launch
iv) Produced Desired Result
v) Strategy
vi) Testing and Maintenance
28- DNS is used to resolve host names to IP addresses and find services.
a) True
b) False
Ans- a) True
Ans- c) Intranet: Private, Extranet: Private and also allowed authorized partners
Ans- a) The use of Internet protocols with limited access to company data by the company's
customers and suppliers.
32- Simple plain HTML is used to create following type of website ____________.
a)Completely Dynamic Website
b) Completely Flash Website
c) Completely Static Website
d)None of these
33- A __________ is the simplest form of website, in which the site’s content is delivered without
the use of server side processing.
a) Dynamic Website
b) Social Networking Website
c) Static Website
d) E-Commerce Website
Ans- b) secured
35- Which protocol is used for browsing website
a)TCP
b) HTTP
c) FTP
d) TFTP
Ans- b) HTTP
Ans- d) HTTP
37- Which of the following statements is true
a) The web designer shouldn’t just be concerned about the looks but also about user interface
b) Usability is very important in web design
c) a and b
d) None of the above
Ans- c ( a & b)
38- The __________ method when used in the method field, leaves entity body empty.
a) POST
b) SEND
c) GET
d) PUT
ANS- c) GET
Explanation: There are two methods which help to request a response from a server. Those are GET
and POST. In GET method, the client requests data from server. In POST method the client submits
data to be processed to the server.
39- Internet is
a) Dynamic system
b) Complex system
c) Decentralized system
d) All of the above
42- Which component is used to compile, debug and execute java program?
a) JVM
b) JDK
c) JIT
d) JRE
Ans- b) JDK
43- Which component is responsible for converting bytecode into machine specific code?
a) JVM
b) JDK
c) JIT
d) JRE
Ans- a) JVM
Ans- a) JRE
46- Which of the below is invalid identifier with the main method?
a) public
b) static
c) private
d) final
Ans- c) private
Ans- b) .java
Ans- a) .class
Ans- d) Compilation
52- Which concept of Java is achieved by combining methods and attribute into a class?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction
Ans- a) Encapsulation
56- What is the stored in the object obj in following lines of Java code?
box obj;
Ans- b) NULL
Ans- c) new
60- What is the return type of a method that does not return any value?
a) int
b) float
c) void
d) double
Ans- c) void
Ans- b) abstract
Ans- d) extends
64- Which of the following is used for implementing inheritance through an interface?
a) inherited
b) using
c) extends
d) implements
Ans- d) implements
67- Using which of the following, multiple inheritance in Java can be implemented?
a) Interfaces
b) Multithreading
c) Protected methods
d) Private methods
Ans- a) Interfaces
Ans- d) java.lang.Object
Ans- b) False
Ans- c) package
71- Which of these access specifiers can be used for a class so that its members can be accessed by
a different class in the different package?
a) Public
b) Protected
c) Private
d) No Modifier
Ans- a)Public
72- Which of the following is the correct way of importing an entire package ‘pkg’?
a) import pkg.
b) Import pkg.
c) import pkg.*
d) Import pkg.*
Ans- a) interface
Ans- a) Public
75- Which of the following is the correct way of implementing an interface A by class B?
a) class B extends A{}
b) class B implements A{}
c) class B imports A{}
d) None of the mentioned
Ans- c) thrown
79- Which of these keywords must be used to handle the exception thrown by try block in some
rational manner?
a) try
b) finally
c) throw
d) catch
Ans- d) catch
Ans- b) run()
Ans- b) start()
Ans- b) It’s a process in which two or more parts of same process run simultaneously
84- Which of these is used to perform all input & output operations in Java?
a) streams
b) Variables
c) classes
d) Methods
Ans- a) streams
85- Which of these classes are used by Byte streams for input and output operation?
a) InputStream
b) InputOutputStream
c) Reader
d) All of the mentioned
Ans- a) InputStream
Ans- d) ByteArrayInputStream
Ans- c) HTML
89- Which method is automatically called after the browser calls the init method?
a) start
b) stop
c) destroy
d) paint
Ans- a) Start
90- ___________ method is defined in Graphics class, it is used to output a string in an applet.
a) display()
b) Print()
c) drawString()
d) transient()
Ans- c) drawString()
91- The ………………… method called the first time an applet is loaded into the memory of a computer.
a) init( )
b) start( )
c) stop( )
d) destroy( )
Ans- a) init( )
92- Which of the following applet tags is legal to embed an applet class named Test into a webpage?
b) <applet>
code=Test.class width=200 height=100>
</applet>
d) <applet
param=Test.class width=200 height=100>
</applet>
Ans- c) <applet code=Test.class width=200 height=100>
</applet>
93- What is an event in delegation event model used by Java programming language?
a) An event is an object that describes a state change in a source
b) An event is an object that describes a state change in processing
c) An event is an object that describes any change by the user and system
d) An event is a class used for defining object, to create events
95- Which of these operators can be used to concatenate two or more String objects?
a) +
b) +=
c) &
d) ||
Ans- a) +
96- Which of this method of class String is used to obtain a length of String object?
a) get()
b) Sizeof()
c) lengthof()
d) length()
Ans- d) length()
97- Which of the following is the default Layout Manager for an Applet?
a)FlowLayout
b)BorderLayout
c)GridLayout
d)CardLayout
Ans- a) FlowLayout
Ans- b) java.awt
99- In which memory a String is stored, when we create a string using new operator?
a)Stack
b)String memory
c)Heap memory
d)Random storage space
Answer: b
Explanation: HTML is Hyper Text Markup Language which is used to create web pages and
applications. The id attribute is most used to point to a style in a style sheet, and by JavaScript (via
the HTML DOM) to manipulate the element with the specific id. Class is a name given to HTML
elements which can be used by CSS and JavaScript for styling the web pages. A self-contained
content is called attribute.
2. The _____________ attribute specifies an inline style associated with an element, which
determines the rendering of the affected element.
a) dir
b) style
c) class
d) article
Answer: b
Explanation: Style attribute specifies an inline style for an element. The style attribute will override
any style set globally, e.g. styles specified in the style tag or in an external style sheet. A
self-contained content is called attribute. Class is a name given to HTML elements which can be used
by CSS and JavaScript for styling the web pages. List of directory files is given by dir tag which is
not supported in HTML5.
3. Which attribute is used to provide an advisory text about an element or its contents?
a) tooltip
b) dir
c) title
d) head
Answer: c
Explanation: The extra information about an element is specified by title tag. The information is most
often shown as a tooltip text when the mouse moves over the element. List of directory files is given
by dir tag which is not supported in HTML5. Tooltip or else infotip is a graphical user interface of an
element. Container of metadata is called head.
4. The __________ attribute sets the text direction as related to the lang attribute.
a) lang
b) sub
c) dir
d) ds
Answer: c
Explanation: The dir attribute specifies the text direction of the element’s content. List of directory
files is given by dir tag which is not supported in HTML5. The language of an element’s content is
given by lang attribute. The subscript text is defined by sub attribute.
5. The accesskey attribute specifies a keyboard navigation accelerator for the element.
a) True
b) False
Answer: a
Explanation: The accesskey attribute specifies a shortcut key to activate/focus an element. It specifies
a keyboard navigation accelerator for the element. We can use accesskey attribute in forms or links.
6.Which of the following is the attribute that is used to set a global identifier for a microdata item?
a) key
b) id
c) itemclass
d) itemid
Answer: d
Explanation: The unique id for an element in html is specified by id attribute. Itemmid allows a
vocabulary to define a global identifier for a microdata item, for example an ISBN number on a
book. Use itemid on the same element as the item’s itemscope and itemtype attributes.
Answer: b
Explanation: <dd> element is used to contain definition. The definition list is created by using <dl>
element. Inside <dl> element we can have pairs of <dd> and <dt> elements. <dt> contains the term
being defined. <ul> is unordered list. A description list is specified by <dl> tag. <dt> tag is a term in
description list.
Answer: c
Explanation: list-style-property is used for defining the style of list item marker. Its value can be
square, circle, disc or none. For setting list item marker to be bullet we use the value disc. It is the
default value. For setting list item marker to a circle we used the circle, for setting it to be square we
set the value square. If we set the value none, list items will not be marked.
Answer: b
Explanation: If we want to display the list horizontally we can use display:inline or float:left. It will
create a menu. E.g. ul {list-style-type: none; padding:0; overflow:hidden; } li {float:left} li g{
display: block; color:red; padding: 20px;}. <dd> element is used to contain definition. <dt> tag is a
term in description list.
Answer: b
Explanation: For the creation of multicolumn directory lists dir element was designed. For designing
a single column menu list menu element was designed. They have the same structure as ul. It is just a
different rendering. In practice, it works exactly as a ul list. <ol> represents a ordered list where as
<ul> is unordered list. List of commands is defined by <menu> tag.
Answer: d
Explanation: The content property includes Strings, URIs, Normal, None, Image, Counter and many
more. When we are using these characters it is essential to encode them as their escaped HEX
equivalents. These characters will work i.e. will only be visible in Mozilla/Netscape or in Opera.
Answer: b
Explanation: td stands for table data, we can represent each cell of the table by using <td>, at the end
we used </td> tag. But some browsers by default draw the lines around table. <tr> is used to indicate
start of every row i.e. it stands for table row. The header information is present in <th> tag. <thead>
tag contains the group of header.
Answer: d
Explanation: <th> element is used for representing heading of column or a row. It works same as
<td> element. If shell has no content we can use <th> element also there. We can use scope attribute
for specifying the heading is for row or column. Usually content of <th> is represented in bold.
<thead> tag contains the group of header. <tr> is used to indicate start of every row i.e. it stands for
table row.
Answer: a
Explanation: Headings of the table lies inside <thead> element. Footer lies inside the <tfoot>
element. The body of the table lies inside <tbody> element. <th> is used for giving heading to a row
or a column. Every element must have closing tag also i.e. </thead>, </tfoot>, </tbody>
16.Which of the following is not the element associated with HTML table layout?
a) size
b) spanning
c) alignment
d) color
Answer: d
Explanation: There are three elements in HTML table layout i.e. size, spanning and alignment.
Layout type can be achieved by setting Rows elements layout attribute to Fixed or Auto. Auto
attribute relies on browser compatibility whereas fixed layout relies on developer specification.
17. Which of the following element is not associated with a class attribute?
a) Row
b) <thead>
c) Column cell
d) Rows
Answer: b
Explanation: Column cell, Row, and Rows are the container elements. They have a class attribute
with the help of this we can apply special styling. Table alignment is also controlled style sheet
classes. Text-align and vertical-align are the style attributes that align the content of the table.
Answer: c
Explanation: Borders can’t be applied on <tr> elements. It can’t be applied on table structural
elements. For setting borders with <tr> element, border-collapse property should be set to collapse.
Syntax is
table {border-collapse: collapse;}
th, td{border-bottom: 2px dotted red; }
Answer: d
Explanation: We can specify column width in three ways i.e. Percentage, Fixed, Proportional. Fixed
width is given in pixels. Percentage specification is the percentage of horizontal space availability in
the table. The proportional specification is the portions of fixed horizontal space required for the
table.
Answer: c
Explanation: align attribute is the alignment of data and for justification of text in the cell. It can take
the values left, right, justify, center, char. Justify is for double justifying the text, char is for aligning
text around a particular character.
Answer: a
Explanation: valign attribute is for specifying the vertical position of the data in a cell. It can take the
values middle, top, baseline, bottom, Top is for the top of the cell’s data, middle is for the centered
data, bottom is for the bottom of the cell, first text line occurs on the baseline which is common to all
the cells.
22.Which among the following is the correct way in HTML to insert an image?
(a) <img url=“https://bit.ly/2FicgIx”>Geeksforgeeks</img>
(b) <img href=“https://bit.ly/2FicgIx” alt= “Geeksforgeeks”></img>
Answer: (c)
23. Which of the following gives a text description of the image if it is not available?
a) alt
b) title
c) src
d) height
Answer: a
Explanation: The alt attributes gives a text description of the image if the image is not available at a
time. Syntax is
src attribute defines the address of the image, title attribute provides some additional information
about the image. Height attribute is used to adjust the height of an image as per need.
a) <figure>
b) <src>
c) <alt>
d) <title>
Answer: a
Explanation: An alt attributes gives a text description of the image if the image is not available at a
time. An address of image is defined by src attribute. HTML5 has introduced new element named
<figure>. It contains image and its caption and hence both are associated with each other. We can
also have more than one image inside <figure> element and they share the same caption. Syntax is
a) character set
b) links
c) scripts
d) color
Answer: d
Explanation: Metadata define character set, title of the document, links, styles, scripts and other meta
information. E.g. <!doctype html> <html> <title> The Code </title> <meta charset= “UTF-8”>
</head> <body>.
a) <p>
b) <pre>
c) <hr>
d) <ins>
Answer: b
Explanation: <p> defines paragraph/text. Preformatted test is defined by <pre> element. The text
written inside this element will be displayed in fixed-width font. It also preserves line breaks and
spaces. E.g.
This is the first line. </pre>. A text which has been inserted into a document is defined by a <ins>..
27.Relative URLs are used to ____________
Answer: a
Explanation: Relative URLs are used for linking other pages within the same site. These are the
shorthand version of absolute URLs. It does not need a domain name. These URLs are helpful when
building a site on a computer because we can create links between pages without having set up for
hosting or domain name.
28. Which one of the following is not the value of the target attribute?
a) _blank
b) _top
c) _self
d) _empty
Answer: d
Explanation: Where to open linked document is specified by target attribute. It can have the values
_blank, _top, _parent, _self, framename. _blank opens linked document is a new tab or window. The
linked document is opened in the parent frame by _parent. Linked document is opened in a named
frame by framename. Linked document is opened in the same window by _self.
29.What is the path for an image located in same folder as the current page?
Answer: a
Explanation: The path <img src= “pic.jpg”> indicates that pic.jpg is located in same folder as
current page. The path <img src= “images/pic.jpg”> indicates that pic.jpg is located in current
folder. The path <img src= “/images/pic.jpg”> is located in images folder at root of current web.
The path <img src= “../pic.jpg”> indicates that pic.jpg is located in folder one level up from
current folder.
a) href
b) id
c) target
d) <a>
Answer: b
Explanation: id attribute is used for defining bookmarks in a page. For linking to the bookmark we
use href attribute. Target attribute is used to define where to open a linked document. <a> element is
used to define a link.
a) Selector
b) Attribute
c) Value
d) Tag
Answer: a
Explanation: HTML element h1 is used in CSS for styling then it is also called a selector. Attributes
are the special words which control the element’s behaviour. To show the start and end of HTML
element, tag is used.
a) Selector
b) Rule
c) Declaration
d) Value
Answer: c
Explanation: In CSS, color:red is the declaration for an element saying that the given element has to
apply a red color. Color is one of CSS property.
34. Which selector is used to specify a rule to bind a particular unique element?
a) id
b) class
c) tag
Answer: a
Explanation: For binding a particular unique element, id selectors are used. While for group of
elements, class selector can be used.
a) <script>
b) <style>
c) <css>
d) <!DOCTYPE html>
Answer: b
Explanation: <style> </style> tag is used to embed CSS in HTML page, while <script> </script> is
used to embed JS in HTML. <!DOCTYPE html> is HTML5 declaration.
36.Which of the following value is supposed to be a slightly bolder weight that standard bold in font
attribute?
a) empasize
b) light
c) lighter
d) dark
Answer: d
37.Which of the following property allows contextual adjustment of inter-glyph spacing, i.e. the
spaces between the characters in text?
a) font-style
b) font-family
c) font-kerning
d) font-variant
Answer: c
38.Which of the following value specifies whether the user agent is allowed to synthesize bold or
oblique font faces when a font family lacks bold or italic faces?
a) font-weight
b) font-synthesis
c) font-kerning
d) font-variant
Answer: b
39.Which of the following selects a normal, or small-caps face from a font family?
a) font-weight
b) font-synthesis
c) font-kerning
d) font-variant
Answer: d
40.Which of the following Allows you to expand or condense the widths for a normal, condensed, or
expanded font face?
a) font-style
b) font-stretch
c) font-expand
d) none of the mentioned
Answer: d
Answer: d
Explanation: In this case, we should see the browser continue to parse the value of color as “red
textdecoration:
underline” before it sees a closing semicolon. The font-style property that follows would then be
used. Because the color property has an illegal value, it should be ignored.
h1 {color: "green";}
c) error occors
d) nothings happen
Answer: d
Explanation: Output of above code snippet won’t happen as the declaration syntax is wrong. The
correct declaration is : h1 { color: green; } which will yeild an output. In CSS, we don’t write
value in double quotes.
44. With, which tag you write the style rules directly within the document found
a) <script>
b) <php>
c) <style>
d) <css>
Answer: c
Explanation: In <style></style> tag we write the style rules directly within the document in the
head section of the document. <script></script> tag is used to add javascript in the document.
45.For Inline Style, we don’t need to reapply style information throughout the document and
outside documents.
a) True
b) False
Answer: b
Explanation: In inline style, properties are confined with a particular element to which it is applied. It
won’t be applied to other element of the same type. We need to reapply style information throughout
the document whenever it is necessary.
46.For External Style Sheets in some cases when @import is used, the browser may cause a
rendering “flash” under slow loading conditions.
a) True
b) False
Answer: a
Explanation: External Style Sheets in some cases when @import is used the browser may cause a
rendering “flash” under slow loading conditions.
a) px
b) em
c) pt
d) mm
Answer: b
48.Which of the following element is used for linking a External Files to the html page?
a) <script>
b) <style>
c) <link>
Answer: c
49.Which of the following color has this value #ff0000?
a) blue
b) green
c) red
d) yellow
Answer: c
50.Which of the following attribute specifies the URL of the linked resource?
a) src
b) link
c) rel
d) href
Answer: d
Explanation: href attribute specifies the URL of the linked resource. A URL might be absolute or
relative.
A. It is used to describe and validate the structure and the content of XML data.
A. XZD
B. XAS
C. XSD
D. XFD
Ans : C
a) Node
b) Attributes
c) Elements
d) Arrays
Answer: a
Explanation: The HTML DOM model is constructed as a tree of Objects. In the HTML DOM
(Document Object Model), everything is a node:
b) Queue
c) Hierarchy
d) Stack
Answer: c
Explanation: The HTML DOM model is constructed as a tree of Objects. The objects are
organized in the hierarchy format in the HTML DOM.
a) Legacy DOM
b) W3C DOM
c) IE4 DOM
Answer: d
Explanation: IE4 document object model was introduced in Version 4 of Microsoft’s Internet
Explorer browser. IE 5 and later versions include support for most basic W3C DOM features. All
of the above mentioned are types of HTML DOM.
a) Window Object
b) Document Object
c) Form Object
Explanation: The DOM is arranged in the form of tree with every node as an object. Window
object is the top of the hierarchy. It is the outmost element of the object hierarchy.
Answer: b
Explanation: The Legacy DOM: This is the model which was introduced in early versions of
JavaScript language. It is well supported by all browsers but allows access only to certain key
portions of documents, such as forms, form elements, and images.
58.What is the reason for avoiding the attributes property in the HTML DOM?
a) Found unnecessary
d) Considered irrelevant
Answer: b
Explanation: When a web page is loaded, the browser creates a Document Object Model of the
page. The reason for avoiding the attributes property in the HTML DOM is because Attributes
don’t have attributes.
59.A computer that translates …………………… of another computer into an …………… and vice
versa, upon request is known as DNS server.
a) 120
b) 130
c) 140
d) 90
Answer: c
Explanation: In HTML one can use a color name to specify a color e.g. Tomato, Orange,
DodgerBlue, MediumSeaGreen, Gray, SlateBlue, Violet, LightGray etc. For colored fonts, we used
text-decoration property to set the color of the text.
a) font-style: normal
b) font-style: italic
c) font-style: oblique
d) font-style: capitalize
Answer: d
Explanation: Text-transform: capitalize, capitalizes the first letter of each word whereas font-style
set font as normal, italic, oblique. We use text-transform: uppercase and text-transform: lowercase
to change the text from lowercase to uppercase and from uppercase to lowercase respectively.
62.What should be set with text-align property so that every line has equal width like in magazines
and newspapers?
a) text-align: justify
b) text-align: none
c) text-align: bottom
d) text-align: top
Answer: a
Explanation: By setting text-align property to “justify”, each line is stretched so that every line has
equal width, left and right margins are straight like in magazines and newspapers. Text-align:
center, text-align: right, text-align: left is also used for aligning the text at center, right and left
respectively.
a) <strong>
b) <em>
c) <b>
d) <blockquote>
Answer: b
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <b></b>
makes text bolder. A section which is quoted from another source is specified by <blockquote>.
<em> element indicates emphasis, browser will show the contents of <em> element in italic.
64.Which works similar to <b> element?
a) <strong>
b) <em>
c) <i>
d) <blockquote>
Answer: a
Explanation: The words written inside <strong> can be said with strong emphasis. Browser shows
contents written inside <strong> element in bold.
a) <em>
b) <q>
c) <abbr>
d) <blockquote>
Answer: c
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element
in italic. We used <q> element for shorter quote. Browser put quote around <q> element. A section
which is quoted from another source is specified by <blockquote>. For using, abbreviation or
acronym <abbr> element is helpful. A title element is to be used with abbr.
<p>The <abbr title=”Doctor”>Dr.</abbr> is on the way.</p>
b) contains IP address
d) contains url
View Answer
Answer: a
Explanation: The contact details for author of a page is specified by <address> attribute. The
content is often displayed in italics,
e.g.
<address>
<a href="mailto:[email protected]">Example</a>
</address>
Output:
Example
a) <ins>
b) <del>
c) <em>
d) <strong>
View Answer
Answer: b
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <em>
element indicates emphasis, browser will show the contents of <em> element in italic. <ins>
element shows the content that has been inserted, usually it has underline. <del> element shows
text that has been deleted from, usually it has a line through the content.
Answer: a
Explanation: For bidirectional override of current text direction, we used <bdo> element, e.g. <bdo
dir=”rtl”>Text is right to left</bdo>. This element was already there before HTML5. It is
supported by all the browsers.
a) <tiny>
b) <min>
c) <small>
d) <em>
Answer: c
Explanation: min is an attribute for input method for inserting minimum value. smaller text is
define by <small>element. <em> is used for emphasis usually it is display in italics.
70.Metadata store information about the web page that is not necessarily visible to end users.
a) True
b) False
Answer: a
Explanation: Metadata is “data [information] that provides information about other data. Meta tags
store information about the web page—known as metadata that is not necessarily visible to end
users (unless you reveal the page source code).
71. Which is the property of a Window object that holds the name of the frame?
a) name
b) title
c) description
d) style
Answer: a
Explanation: The name property of a Window object holds the name of the frame if it has one.
This property is writable, and scripts can set it as desired. An iframe creates a nested browsing
context represented by a Window object of its own.
a. <a href=”xxx@yyy”>
b. <mail href=”xxx@yyy”>
c. <mail>xxx@yyy</mail>
d. <a href=”mailto:xxx@yyy”>
Answer: d
a) body tag
b) html tag
c) head tag
d) title tag
View Answer
Answer: c
Explanation: Metadata is information about data. The meta tag provides metadata/meta
information about the HTML document. Metadata will not be displayed on the page. Metadata is
present in head. The body tag defines document’s body. A title tag is an HTML element which
specifies the title of a web page.
Answer: c
Explanation: A charset attribute is new in HTML5. The charset is used to provide the character
support. The charset attribute specifies the character encoding which is in an external script file.
a) scheme
b) content
c) http-equiv
d) name
Answer: a
Explanation: The scheme attribute is supported in HTML but not in HTML5. Rest of attributes
like “content”, “http-equiv” and “name” are supported in both HTML as well as HTML5. The
scheme element is deprecated from HTML5.
76. ___________ prevents search engines from following links inside the page.
a) noarchive
b) nofollow
c) noindex
d) novalue
Answer: b
Explanation: NOFOLLOW attribute instruct search engines that a hyperlink should not influence
the link target’s ranking in search engine. NOINDEX prevents page from being indexed. To
prevent a page from being cracked, NOARCHIEVE tag can be used.
77.__________ prevents search engines from showing a cached link for the page.
a) nobot
b) nofollow
c) noarchive
d) nosearch
Answer: c
Explanation: The “noarchive” meta tag is used to tell browsers not to store cached link for the
page. A “nofollow” attribute instruct search engines that a hyperlink should not influence the link
target’s ranking in search engine. The “noindex” prevents page from being indexed.
b) physical layer
c) network layer
d) transport layer
Answer: b
Explanation: There are seven layers namely Physical layer, data Link layer, network Layer,
transport layer, session layer, presentation layer, and application layer. The physical layer is the
first layer, it is used for transmitting electrical signal across the network. Examples are USB,
Bluetooth or Ethernet.
a) presentation layer
b) network layer
c) application layer
Answer: b
Explanation: Network layer is the third layer, it deals with routing across complicated networks,
Internet Protocol (IP) is very commonly used at this level. It is capable of traveling across multiple
networks. It can also travel through intermediate devices like routers.
80.Which one is not the feature of HTTP protocol?
a) media independent
b) connectionless
c) responsive
d) stateless
Answer: c
Explanation: There are basically three main features of HTTP protocol i.e HTTP is media
independent, HTTP is connectionless and it is stateless also. Browser initiates HTTP request, and
then client disconnects from the server.
a) Request-header
b) Response-header
c) General-header
d) Entity-header
Answer: d
Explanation: A HTTP header which does not relate to the content of message is a response-header.
A request-header is used to provide information about request or response. Entity-header field
defines meta information about the body. If the body is not present resource is identified by
request. The general syntax for all the header fields is msg-header=field-name “:” [field-value].
General-header field is for both response and request.
a) Head
b) Get
c) Remove
d) Put
Answer: c
Explanation: There are various request methods on the resource identified by Request-URI. Get,
post, head, delete, trace, connect, put and options are some of the methods. For retrieving
information from the server we use Get method.
83.Which symbol is used when HTTP request does not apply to the particular source?
a) ‘&’
b) ‘*’
c) ‘#’
d) ‘@’
Answer: b
Explanation: When HTTP request does not apply to particular resource ‘*’ is used. It is applied to
the server itself. This is only allowed when the used method is not necessarily applied to the
resource. E.g. OPTIONS * HTTP/1.1
a) Expect
b) Host
c) Delete
d) If-None-Match
Answer: c
Explanation: For passing additional information about request we use request-header fields. These
are also requested modifiers. There are several request-header fields like Accept-Encoding,
Expect, Accept-Charset, Accept-Language, Form, Host, Authorization, If-Match,
Proxy-Authorization, Range, User-Agent, TE, Referer, If-Unmodified-Since, If-Range.
a) Location
b) Server
c) ETag
d) Referer
Answer: d
Explanation: For passing additional information about the response that can’t be placed in
Status-Line, we use response-header fields. Some of the fields are Age, Accept-Ranges, Location,
ETag, WWW-Authenticate, Vary, Server, Retry-After.
a) Communication
b) Standard
c) Metropolitan communication
d) Bandwidth
Answer: a
Explanation: A protocol is a set of rules that governs the communications between computers on a
network. These rules include guidelines that regulate the characteristics of a network including
access method, allowed physical topologies, types of cabling, and speed of data transfer.
87.Which tag is used with JavaScript?
a) <canvas>
b) <table>
c) <article>
d) <footer>
Answer: a
Explanation: <canvas> tag is basically used for graphics via scripting i.e. usually with Java Script
(scripting language, basically used to create animations). Other tags like <table>, <article>,
<footer> can be used simply with HTML.
a) <!doctype html>
b) <doctype html!>
c) <doctype html>
d) </doctype html>
Answer: a
Explanation: The correct syntax of HTML5 doctype is <!doctype html>, doctype is the very first
thing to write in HTML5. <!doctype html> or <!DOCTYPE HTML> both are same because
‘doctype’ keyword is not case sensitive.
89.What if one does not use the doctype in the starting of HTML document?
Answer: a
Explanation: If the browser finds <!doctype html> in the starting of an HTML document it sets the
document in standard mode but if one does not use a doctype, the browser goes to quirky mode. In
this mode, certain content will not be displayed as per one wrote that. So it is always
recommended to write a doctype at the very start of the HTML document.
a) <input>
b) <audio>
c) <embed>
d) <bdo>
Answer: d
Explanation: <bdo>, <rp>, <rt>, <ruby> are some tags which support Non-English language.
<input> is for web forms and <audio>, <embed> are the tags for audio and plug-ins.
a) <strike>
b) <center>
c) <small>
d) <big>
Answer: c
Explanation: Although HTML5 adds new elements, it also kicked out some old elements like
<big>, <center>, <font>, <tt>, <strike>. HTML5 adapted many elements also <small> is one
among these. The <small> element represents “small print”.
a) day
b) week
c) month
d) time
Answer: a
Explanation: Day is not defined in the pre-defined attribute list of input tag. Week attribute defines
week and year when used as attribute in input tag. Month specifies month and year when it is
accessed in input tag. The time attribute displays current time in html.
93.The new __________ element is supposed to represent some form of extra details, such as a
tooltip or revealed region that may be shown to a user.
a) progress
b) meter
c) details
d) menu
Answer: c
Explanation: A scalar measurement within a range or fractional value is defined by meter tag. A
list/menu of coommands is displayed by menu tag in html. The details tag specifies additional
details that the user can view or hide on demand. The details tag can be used to create an
interactive widget that the user can open and close. Any sort of content can be put inside the
<details> tag. Progress of a task is done by progress element.
94.The __________ element may contain not just links but also other interactive items, including the
newly introduced command element.
a) progress
b) meter
c) details
d) menu
View Answer
Answer: d
Explanation: A scalar measurement within a range or fractional value is defined by meter tag. The
menu tag defines a list/menu of commands. The menu tag is used for context menus, toolbars and
for listing form controls and commands. The details tag specifies additional details that the user
can view or hide on demand. The details tag can be used to create an interactive widget that the
user can open and close. Any sort of content can be put inside the <details> tag. Progress of a task
is done by progress element.
95.The __________ attribute effectively renders the iframe as an inline include, which allows the
parent document’s CSS to affect the contents of the iframe.
a) allow-forms
b) seamless
c) embed
d) allow-scripts
Answer: b
Explanation: Embed attribute attach external content at a specified point in document. The
seamless attribute is a boolean attribute. When present, it specifies that the iframe should look like
it is a part of the containing document (no borders or scrollbars). Allow-forms re-enables from
submission. Scripts are re-enabled by allow-scripts.
96. __________ allows the iframe to pull in content from elsewhere in the same domain.
a) allow-same-origin
b) allow-forms
c) allow-scripts
d) allow-pointer-lock
Answer: a
a) <form>
b) <optgroup>
c) <output>
d) <option>
Answer: b
Explanation: HTML form element is used in its <form> tag having its own structure which is used
by users for various tasks. If you have a long list of options, groups of related options are easier to
handle for a user. Result of calculation (script) is represented by output tag. A drop down list of
items is defined by <option> tag in HTML.
98. Which element specifies a list of pre-defined options for an input element?
a) <datalist>
b) <keygen>
c) <output>
d) <password>
Answer: a
Explanation: The datalist tag is used to provide an “autocomplete” feature on input elements.
Users will see a drop-down list of pre-defined options as they input data. Password defines
password field in HTML. It is attribute for input-type. The <keygen> element references from data
after form has submitted. Result of calculation (script) is represented by output tag.
i. <B>Go boldly</B>
a) iv
b) i
d) both iv and i
Answer: c
Explanation: Traditional HTML is case insensitive and thus we can write tag/element name either
in lowercase or uppercase or both which will be ignored by browser by default.
b) False
Answer: b
Explanation: Traditionally XHTML is case sensitive while HTML is case insensitive. In HTML
these are ignored by default by browsers.
Unit-3 MCQ(JavaScript, AJAX, Networking)
B - JavaScript has object-oriented capabilities that allows you to build interactivity into otherwise
static HTML pages.
C - The general-purpose core of the language has been embedded in Netscape, Internet Explorer,
and other web browsers.
Q 2 - Which of the following function of String object returns the primitive value of the specified
object.
A - toLocaleUpperCase()
B - toUpperCase()
C - toString()
D - valueOf()
Q 3 - Which of the following function of Array object creates a new array with all of the elements of
this array for which the provided filtering function returns true?
A - concat()
B - every()
C - filter()
D - some()
Q 4 - Which of the following function of Array object removes the first element from an array and
returns that element?
A - reverse()
B - shift()
C - slice()
D - some()
Q5. When a user views a page containing a JavaScript program, which machine actually executes the
script?
A. The </script>
B. The <script>
A. Validating a form
A. System.out.println("Hello World")
C. document.write("Hello World")
D. response.write("Hello World")
A. <js>
B. <scripting>
C. <script>
D. <javascript>
Q10. What is the correct syntax for referring to an external script called " abc.js"?
Q12. If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within
the paragraph?
A. "New Text"?
B. para1.value="New Text";
D. para1.nodeValue="New Text";
Q13. avaScript entities start with _______ and end with _________.
A. Semicolon, colon
B. Semicolon, Ampersand
C. Ampersand, colon
D. Ampersand, semicolon
Q15. What is the correct JavaScript syntax to change the content of the HTML element below?
A. alert("Hello World");
B. msg("Hello World");
C. msgBox("Hello World");
D. alertBox("Hello World");
A. function myFunction()
B. function = myFunction()
C. function:myFunction()
D. NONE
Q18. How do you round the number 7.25, to the nearest integer?
A. Math.round(7.25)
B. round(7.25)
C. rnd(7.25)
D. Math.rnd(7.25)
Q19. What is the correct JavaScript syntax for opening a new window called "w2" ?
A. w2 = window.open("http://www.w3schools.com");
B. w2 = window.new("http://www.w3schools.com");
Q20. Which event occurs when the user clicks on an HTML element?
A. onclick
B. onmouseover
C. onmouseclick
D. onchange
A. .javascript
B. .jvs
C. .js
D. .jsc
Q23. Select all the correct option(s). State the correct place of JS Code inside HTML -
A. All of these
B. Inside Head
C. Inside Body
D. Inside Single JavaScript File
Q24. JS code included inside head section is loaded before loading page.
A. True
B. False
Q25. _____ attribute is used to specify the character encoding used in an external script file.
A. charset
B. character
C. None of These
D. Type
A. IE
B. Mozilla Firefox
C. Netscape
D. Google Chrome
A. float
B. var
C. boolean
D. undefined
A. Netscape
B. Bell Labs
C. Sun Microsystems
D. IBM
A. Alert
B. Prompt
C. Confirm
var a = 1;
document.write(a--);
document.write(a);
A. 00
B. 01
C. 11
D. 10
A. 2
B. 1 plus 1 is 2
C. 1 plus 1 is 11
D. 1 plus 1 is 1 + 1
Q33. What if you use parseInt() to convert a string containing decimal value?
A. Throws Error
A. Throws Error
B. object
C. Displays Nothing
D. Current Date
Q35. The _______ method of an Array object adds and/or removes elements from an array.
A. Reverse
B. Shift
C. Slice
D. Splice
B. It provides a means of exchanging structured data between the Web server and client.
C. It provides the ability to asynchronously exchange data between Web browsers and a Web server.
D. It provides the ability to mark up and style the display of Web-page text.
A. True
B. False
C. more dynamic
A. Dependent on JavaScript
B. Security issues
C. Debugging is difficult
D. All of the above
A. JavaScript
B. XMLHttpRequest
C. Document Object Model
D. Flash
A. 2003
B. 2005
C. 2004
D. 2006
Q46. AJAX made popular by
A. Microsoft
B. IBM
C. Sun Microsystem
D. Google
A. POST, GET
B. GET, POST
C. Both A & B
Q48. The ___ property defines a function to be executed when the readyState changes.
A. onreadystatechange
B. onreadystateup
C. onreadystatedown
A. Bandwidth utilization
B. More interactive
D. All of these
A. responseXML
B. responseText
C. responseString
Q51. Which of these package contains classes and interfaces for networking?
a) java.io
b) java.util
c) java.net
d) java.network
Q52. Which of these is a protocol for breaking and sending packets to an address across a network?
a) TCP/IP
b) DNS
c) Socket
d) Proxy Server
Q53. How many ports of TCP/IP are reserved for specific protocols?
a) 10
b) 1024
c) 2048
d) 512
a) DatagramPacket
b) URL
c) InetAddress
d) ContentHandle
import java.net.*;
class networking
System.out.print(obj1.getHostName());
a) cisco
b) cisco.com
c) www.cisco.com
Q57. Which of these class is used to create servers that listen for either local or remote
client programs?
a) httpServer
b) ServerSocket
c) MimeHeader
d) HttpResponse
Q58. Which of these is a standard for communicating multimedia content over email?
a) http
b) https
c) Mime
d) httpd
Q59. What will be the output of the following Java program?
import java.net.*;
class networking
{
public static void main(String[] args) throws MalformedURLException
{
URL obj = new URL("https://www.ABC.com/XYZ");
System.out.print(obj.toExternalForm());
}
}
a) sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) https://www.ABC.com/XYZ
Q60. What does URL stands for?
a) Uniform Resource Locator
b) Uniform Resource Latch
c) Universal Resource Locator
d) Universal Resource Latch
Q61. Which of these methods is used to know host of an URL?
a) host()
b) getHost()
c) GetHost()
d) gethost()
Q62. hich of these data member of HttpResponse class is used to store the response
from an http server?
a) status
b) address
c) statusResponse
d) statusCode
Q63. Which of these is a bundle of information passed between machines?
a) Mime
b) Cache
c) Datagrams
d) DatagramSocket
Q64. Which of these class is necessary to implement datagrams?
a) DatagramPacket
b) DatagramSocket
c) All of the mentioned
d) None of the mentioned
Q65. Which of these method of DatagramPacket is used to obtain the byte array of data
contained in a datagram?
a) getData()
b) getBytes()
c) getArray()
d) recieveBytes()
Q66. Which of these method of DatagramPacket is used to find the port number?
a) port()
b) getPort()
c) findPort()
d) recievePort()
Q67. Which of these class must be used to send a datagram packets over a
connection?
a) InetAdress
b) DatagramPacket
c) DatagramSocket
d) All of the mentioned
Q68. Which API gets the SocketAddress (usually IP address + port number) of the
remote host that this packet is being sent to or is coming from.
a) getSocketAddress()
b) getAddress()
c) address()
d) none of the mentioned
Q69. Which constructor of DatagramSocket class is used to creates a datagram socket
and binds it with the given Port Number?
a. DatagramSocket(int port)
b. DatagramSocket(int port, InetAddress address)
c. DatagramSocket()
d. None of the above
Q70. The DatagramSocket and DatagramPacket classes are not used for connection-
less socket programming.
a. True
b. False
Q71. What does the java.net.InetAddress class represent?
a. Socket
b. IP Address
c. Protocol
d. MAC Address
Q72. Which class is used to create servers that listen for either local client or remote
client programs?
A) ServerSockets
B) httpServer
C) httpResponse
D) None of the above
Q73. The client in socket programming must know which informations?
A) IPaddress of Server
B) Port number
C) Both A & B
D) None of the above
Q74. Datagram is basically an information but there is no guarantee of its content, arrival
or arrival time.
A) True
B) False
Q75. The DatagramSocket and DatagramPacket classes are not used for connection-
less socket programming.
A) True
B) False
Q76. Which of these is a protocol for breaking and sending packets to an address
across a network?
a) TCIP/IP
b) DNS
c) Socket
d) Proxy Server
Q 77. Which of these class is used to create servers that listen for either local or remote
client programs?
a) httpServer
b) ServerSockets
c) MimeHeader
d) HttpResponse
Q78. A port number in java has…size.
A. 8-bit
B. 16-bit
C. 24-bit
D. 48-bit
Q79. Datagram Socket class in Java is used to create Sockets in
A. UDP client
B. UDP server
C. A and B both
D. None
Q80. In Java implementation of TCP, a client uses…….. a server uses……….
A. ClientSocket object; ServerSocket object
B. Socket object; ServerSocket objec
C. Socket object; ServerSocket object and Socket object
D. None of the choices are correct.
1 D
2 D
3 C
4 B
5 A
6 A
7 C
8 C
9 C
10 C
11 B
12 B
13 D
14 D
15 A
16 A
17 A
18 A
19 A
20 A
21 C
22 D
23 A
24 A
25 A
26 C
27 A
28 A
29 D
30 D
31 D
32 C
33 B
34 D
35 D
36 A
37 D
38 C
39 B
40 A
41 A
42 D
43 D
44 D
45 B
46 D
47 A
48 A
49 D
50 A
51 C
52 A
53 B
54 D
55 C
56 B
57 B
58 C
59 D
60 A
61 B
62 D
63 C
64 C
65 A
66 B
67 D
68 A
69 B
70 B
71 B
72 A
73 C
74 A
75 B
76 A
77 B
78 B
79 C
80 C
UNIT 4 WebTech
114 MCQs
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
Answer : D
2) Which case of a session bean obtains the UserTransaction object via the EJBContext using the
getUserTransaction() method in EJB transaction management?
a. Bean-managed transactions
b. Container-managed transactions
c. Both A & B
d. None of the above
3) EJB QL is a Query Language provided for navigation across a network of enterprise beans and
dependent objects defined by means of container managed persistence.
a. True
b. False
4) A message driven bean is like statefull session bean that encapsulates the business logic and
doesn't maintain state.
a. True
b. False
ANSWER: False
6) JMS is mainly used to send and receive message from one application to another.
a. True
b. False
ANSWER: True
7) Which session bean maintain their state between client invocations but are not required to
maintain their state across server crashes or shutdowns?
8) Which EJB container must provide an implementation of Java Naming and Directory Interface
(JNDI) API to provide naming services for EJB clients and components?
- Published on 21 Jul 15
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
ANSWER: Naming support
9) EJB is a specification for J2EE server, not a product; Java beans may be a graphical component
in IDE.
a. True
b. False
ANSWER: True
10) A session bean represents a multiple clients inside the Application Server.
a. True
b. False
ANSWER: False
11) Which component does the Entity bean represent the persistent data stored in the database?
- Published on 20 Jul 15
a. Server-side component
b. Client-side component
12) EJB is a specification for J2EE server, not a product; Java beans may be a graphical
component in IDE.
- Published on 20 Jul 15
a. True
b. False
ANSWER: True
a. True
b. False
ANSWER: True
15) The life cycle of session bean is not maintained by the application server (EJB Container).
- Published on 17 Jul 15
a. True
b. False
ANSWER: False
a. Entity Bean
b. Session Bean
c. Both A & B
17) Which component does the Entity bean represents the persistent data stored in the database?
- Published on 15 Jul 15
a. Server-side component
b. Client-side component
a. True
b. False
ANSWER: True
a. Security
b. Transaction Management
c. Both A & B
a. EJB
b. RMI
c. Both A & B
ANSWER: EJB
a. 2
b. 3
c. 4
d. 5
ANSWER: 3
22) Which type of instances retain no data or conversational state for a specific client?
- Published on 13 Jul 15
a. Message-Driven Bean
b. Session Bean
c. Entity Bean
b. Transaction Management
c. Both A & B
24) Which session bean does the conversational state between multiple method calls is not
maintained by the container?
- Published on 10 Jul 15
a. True
b. False
ANSWER: False
26) Which services are provided to EJB components by the EJB container?
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
A - This type of bean stores data of a particular user for a single session.
B - This is a type of enterprise bean which is invoked by EJB container when it receives a
message from queue or topic.
Answer: B
Explanation
A message driven bean is a type of enterprise bean which is invoked by EJB container when it
receives a message from queue or topic. Message driven bean is a stateless bean and is used to do task
asynchronously.
A - EJB Container normally creates a pool of few stateless bean's objects and use these
objects to process client's request.
B - Because of pool, instance variable values are not guaranteed to be same across
lookups/method calls.
Answer: C
Explanation
EJB Container normally creates a pool of few stateless bean's objects and use these objects to process
client's request. Because of pool, instance variable values are not guaranteed to be same across
lookups/method calls.
Answer : B
Explaination
mappedName attribute in @javax.ejb.Stateless annotation is used to specify the JNDI name of the
session bean.
29) Which of the following is correct about name attribute in @javax.ejb.EJB annotation?
A - It is used to specify name which will be used to locate the referenced bean in
environment.
name attribute in @javax.ejb.EJB annotation is used to specify name which will be used to locate the
referenced bean in environment.
30) Which of the following annotation is used to specify Local interface(s) of a session bean?
A - @javax.ejb.Stateless
B - @javax.ejb.Stateful
C - @javax.ejb.Local
D - @javax.ejb.EJB
Answer : C
Explaination
31) Which of the following is correct about @PostActivate annotation for a callback method?
B - Method is invoked when a bean is removed from the bean pool or is destroyed.
Answer : C
Explaination
A - @EJB
B - @Resource
Answer : B
Explaination
A - byte[]
B - String
C - Serializable Object
Answer : D
Explaination
34) Which of the following is correct about a Success attrribute of Bean Managed Transactions
in EJB?
Answer : B
Explaination
35) Which of the following is true about exceptions handling by EJB Container?
A - When Application Exception occurs, ejb container intercepts the exception but returns the
same to the client as it is.
B - EJB Container does not roll back the transaction unless it is specified in code by
EJBContext.setRollBackOnly() method.
Answer : C
Explaination
When Application Exception occurs, ejb container intercepts the exception but returns the same to the
client as it is. It does not roll back the transaction unless it is specified in code by
EJBContext.setRollBackOnly() method.
Options
A : @Qualifier
B : @Type
C : @Constructor
D : @Name
View Answer
Options
View Answer
39) What is the attribute of java bean to specify scope of bean to have single instance per Spring
IOC?
Options
A : prototype
B : singleton
C : request
D : session
View Answer
Options
A : destroy
B : destroy-method
C : destruction
D : destruction-method
41. Which of the following annotation is used to specify or inject a dependency as ejb instance
into another ejb?
A. javax.ejb.Stateless
B. javax.ejb.Stateful
C. javax.ejb.MessageDrivenBean
D. javax.ejb.EJB
View Answer
Workspace
Report
Discuss
Answer: Option D
Explanation:
A. transactional components
D. server-side components
View Answer
Workspace
Report
Discuss
Answer: Option B
Explanation:
A. Preserving of any state across method calls does not performed by Stateless session beans
B. Multiple users can access Stateful session beans at the same time
D. None
View Answer
Workspace
Report
Discuss
Answer & Explanation
Answer: Option A
Explanation:
44. Which EJB container must provide an implementation of Java Naming and Directory
Interface (JNDI) API to provide naming services for EJB clients and components?
A. Transaction support
B. Persistence support
C. Naming support
View Answer
Workspace
Report
Discuss
Answer: Option C
Explanation:
A. In both stateless and statefull session classes, the bean provider must write the method
public void remove()
B. The method << remove >> in the component interface can be accessed only by the remote
clients
C. The bean’s handle must be provided by the client, in order to ask the EJBHome for
removing a session bean
View Answer
Workspace
Report
Discuss
Answer: Option C
Explanation:
Answer : C
Explanation
Statement encapsulates an SQL statement which is passed to the database to be parsed, compiled,
planned and executed.
47) In which of the following type of ResultSet, the cursor can only move forward in the result
set?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
C - ResultSet.TYPE_SCROLL_SENSITIVE
Answer : A
Explanation
ResultSet.TYPE_FORWARD_ONLY: The cursor can only move forward in the result set.
48) Which of the following type of JDBC driver, uses database native protocol?
Answer : D
Explanation
A - Statement
B - PreparedStatement
C - CallableStatement
D - QueryStatement
Answer : D
Explanation
A - PreparedStatement allows mapping different requests with same prepared statement but
different arguments to execute the same execution plan.
B - Prepared statements are more secure because they use bind variables, which can prevent
SQL injection attack.
Answer : C
Explanation
PreparedStatement allows mapping different requests with same prepared statement but different
arguments to execute the same execution plan. Prepared statements are more secure because they use
bind variables, which can prevent SQL injection attack.
51) How does JDBC handle the data types of Java and database?
A - The JDBC driver converts the Java data type to the appropriate JDBC type before sending
it to the database.
Answer : C
Explanation
The JDBC driver converts the Java data type to the appropriate JDBC type before sending it to the
database. It uses a default mapping for most data types. For example, a Java int is converted to an
SQL INTEGER.
54) Which of the following is correct about connection pooling?
A - Application server like WebLogic, WebSphere, jBoss and Tomcat provides the facilities
to configure connection pooling.
Answer : C
Explanation
If you use an application server like WebLogic, WebSphere, jBoss, Tomcat. , then your application
server provides the facilities to configure for connection pooling. If you are not using an application
server then components like Apache Commons DBCP Component can be used.
A - setFetchSize(int) defines the number of rows that will be read from the database when the
ResultSet needs more rows.
Answer : C
Explanation
setMaxRows(int) method of the ResultSet specifies how many rows a ResultSet can contain at a time.
setMaxRows(int) affects the client side JDBC object.
A - In typical database transactions, say one transaction reads and changes the value while the
second transaction reads the value before committing or rolling back by the first transaction.
This reading process is called as 'dirty read'.
B - There is always a chance that the first transaction might rollback the change which causes
the second transaction reads an invalid value.
Answer : C
Explanation
In typical database transactions, say one transaction reads and changes the value while the second
transaction reads the value before committing or rolling back by the first transaction. This reading
process is called as 'dirty read'. Because there is always a chance that the first transaction might
rollback the change which causes the second transaction reads an invalid value.
57) New drivers can be plugged-in to the JDBC API without changing the client code.
A - true
B - false
Answer : A
Explanation
New drivers can be plugged-in to the JDBC API without changing the client code.
Workspace
Answer: a
Explanation:
Driver: The database communications link, handling all communication with the database.
Statement: Encapsulates an SQL statement which is passed to the database to be parsed, compiled,
planned, and executed.
ResultSet: The ResultSet represents a set of rows retrieved due to query execution.
Workspace
Answer: d
Explanation: JDBC API is divided into two packages i.e. java.sql and javax.sql. We have to import
these packages to use classes and interfaces in our application.
A. Type 3 Driver
B. Type-2 Driver
C. Type-4 Driver
D. Type-1 Driver
Workspace
Answer: c
Explanation: The JDBC thin driver is a pure Java driver. It is also known as Type-4 Driver. It is
platform-independent so it does not require any additional Oracle software on the client-side. It
communicates with the server using SQL *Net to access Oracle Database.
2.7M
Workspace
Answer: b
Explanation: To create a database connection in Java, we must follow the sequence given below:
64) Which of the following method is used to perform DML statements in JDBC?
a) executeResult()
b) executeQuery()
c) executeUpdate()
d) execute()
Answer: c
Explanation: We use the executeUpdate() method for DML SQL queries that change data in the
database, such as INSERT, UPDATE, and DELETE which do not return a resultset.
65) How many transaction isolation levels provide the JDBC through the Connection interface?
a) 3
b) 4
c) 7
d) 2
Answer: b
66) Which of the following method is static and synchronized in JDBC API?
a) getConnection()
b) prepareCall()
c) executeUpdate()
d) executeQuery()
Answer: A
Explanation: A Java application using the JDBC API establishes a connection to a database by
obtaining a Connection object. The standard way to obtain a Connection object is to call the method
DriverManager.getConnection() method that accepts a String contains the database connection URL.
It is a static and synchronized method.
a) getConnection()
b) registerDriver()
c) forName()
d) Both b and c
Answer: d
By using the registerDriver() Method: To access the database through a Java application, we must
register the installed driver in our program. We can do this with the registerDriver() method that
belongs to the DriverManager class. The registerDriver() method takes as input a driver class, that is,
a class that implements the java.sql.Driver interface, as is the case with OracleDriver.
By using the Class.forName() Method: Alternatively, we can also use the forName() method of the
java.lang.Class to load the JDBC drivers directly. However, this method is valid only for JDK-
compliant Java virtual machines. It is invalid for Microsoft JVMs.
a) ParameterizedStatement
b) PreparedStatement
c) CallableStatement and Parameterized Statement
d) All kinds of Statements
Answer: b
a) Statement
b) PreparedStatement
c) QueryStatement
d) CallableStatement
Answer: c
Explanation:
Statement: Use this for general-purpose access to your database. It is useful when we are using static
SQL statements at runtime. The Statement interface cannot accept parameters.
PreparedStatement: It represents the pre-compiled SQL statements that can be executed multiple
times.
70) Identify the isolation level that prevents the dirty in the JDBC Connection class?
a) TRANSACTION_READABLE_READ
b) TRANSACTION_READ_COMMITTED
c) TRANSACTION_READ_UNCOMMITTED
d) TRANSACTION_NONE
Answer: b
Explanation: The isolation level TRANSACTION_READ_COMMITTED prevents the dirty read but
non-repeatable reads and phantom reads can occur.
Answer: b
Explanation: The way to allow two or more statements to be grouped into a transaction is to disable
the auto-commit mode. After the auto-commit mode is disabled, no SQL statements are committed
until we call the commit() method explicitly.
a) CallableStatement
b) Statement
c) CalledStatement
d) PreparedStatement
Answer: b
Explanation: The stored procedure is a database program that can be utilized to perform CRUD tasks
with the table. We can call these procedures by using the Statement Interface. It provides methods to
execute queries with the database.
73) What should be the correct order to close the database resource?What should be the correct
order to close the database resource?
Answer: d
Explanation: The golden rule to JDBC connections and statements is to close in the reverse order of
initiation or opening. In addition, the ResultSet is dependant on the execution of the Statement and the
Statement is dependant on the Connection instance. Hence, the closing should occur in that order
(ResultSet, Statement, and then Connection).
a) JDBC tracing
b) Exception handling
c) Both a and b
d) Only b
Answer: a
Explanation: The JDBC Driver supports both DriverManager and DataSource tracing as documented
in the JDBC 3.0 API specification. Trace information consists of JDBC API method entry and exit
points with the corresponding parameter and returns values. DriverManager.setLogWriter method to
send trace messages to a PrintWriter. The trace output contains a detailed listing of the JDBC activity.
75) Which JDBC driver can be used in servlet and applet both?
a) Type 3
b) Type 4
c) Type 3 and Type 2
d) Type 3 and Type 4
Answer: d
Explanation: Type 3 driver follows the three-tier approach which is used to access the databases. The
JDBC clients use standard network sockets to communicate with a middleware application server. In a
Type 4 driver, a pure Java-based driver that communicates directly with the vendor's database through
a socket connection.
a) Type 4
b) Type 3
c) Type 1
d) Type 2
Answer: c
Explanation: Type 1 driver is also known as the JDBC-ODBC bridge driver. It is a database driver
implementation that employs the ODBC driver to connect to the database. The driver converts JDBC
method calls into ODBC function calls.
Answer: d
Explanation: JDBC Net pure Java driver (Type 4) is the fastest driver because it converts the JDBC
calls into vendor-specific protocol calls and it directly interacts with the database.
a) TYPE_FORWARD_ONLY
b) CONCUR_WRITE_ONLY
c) TYPE_SCROLL_INSENSITIVE
d) TYPE_SCROLL_SENSITIVE
Answer: b
TYPE_FORWARD_ONLY: This is the default type and the cursor can only move forward in the
result set.
TYPE_SCROLL_INSENSITIVE: The cursor can move forward and backward, and the result set is
not sensitive to changes made by others to the database after the result set was created.
TYPE_SCROLL_SENSITIVE: The cursor can move forward and backward, and the result set is
sensitive to changes made by others to the database after the result set was created.
CONCUR_UPDATABLE: We can use the ResultSet update method to update the rows data.
Answer: a
Explanation: JDBC Savepoint helps us in creating checkpoints in a transaction and we can rollback to
that particular checkpoint.
80) How many stages are used by Java programmers while using JDBC in their programs?
a) 3
b) 2
c) 5
d) 6
Answer: d
Connecting to a database
Answer: a
Explanation: By creating an object to the driver class of the driver software, we can register the driver.
To register the JdbcOdbcDriver of the sun microsystems, we can create an object to the driver class
JdbcOdbcDriver, as follows:
a) 2
b) 3
c) 4
d) 5
Answer: c
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
3. By sending the driver class name directly to the forName() For example:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Class.forName(dname);
If you are using the above method to register the driver, we should have to specify the driver's name at
the time of running the program. The getProperty() method receives the driver name and stores the
driver name in dname.
We use the following command to provide the driver name at run time:
For example:
Answer: d
Explanation: Data Source Name (DSN) is a name given to the database to identify it in the Java
program. The DSN is linked with the actual location of the database.
84) Which statement is correct if we want to connect the Oracle database using the thin driver
provided by Oracle Corp.?
Answer: a
Explanation: We use the following statement to connect Oracle database using the thin driver.
a) Forward ResultSet
b) Scrollable ResultSet
c) Only a
d) Both a and b
Answer: d
Explanation: JDBC provides only two types of ResultSets: Forward and Scrollable ResultSet.
a) Variable
b) Object
c) Data type
d) Keyword
Answer: c
Explanation: SQL offers BLOB (Binary Large OBject) data type to store image files like .gif or .jpg
or jpeg into the database table.
87) Which data type is used to store files in the database table?
a) BLOB
b) CLOB
c) File
d) Both a and b
Answer: b
Explanation: To store a large volume of data such as text file into a table, we use CLOB (Character
Large OBject) data type of SQL.
Answer: a
89) Which of the following driver converts the JDBC calls into database-specific calls?
a) JDBC-ODBC Bridge Driver (Type 1)
b) Native API-partly Java Driver (Type 2)
c) Net Protocol-pure Java Driver (Type 3)
d) Native Protocol-pure Java Driver (Type 4)
Answer: b
Explanation: Type 2 driver converts JDBC calls into database-specific calls with the help of vendor
database library. It directly communicates with the database server.
a) Yes, but only if we call the method openCursor() on the ResultSet and if the driver and
database support this option.
b) Yes, but only if we indicate a concurrency strategy when executing the statement, and if the
driver and database support this option.
c) Yes, but only if the ResultSet is an object of class UpdateableResultSet and if the driver and
database support this option.
d) No, ResultSets are never updateable. We must explicitly execute a DML statement to change
the data in the underlying database.
Answer: b
Explanation: By default, a ResultSet object is not updatable and its cursor moves only in the forward
direction. If we want to create an updateable ResultSet object, either we can use
ResultSet.TYPE_SCROLL_INSENSITIVE or the ResultSet.TYPE_SCROLL_SENSITIVE type,
which moves the cursor forward and backward relative to the current position.
91) Which of the following interface provides the commit() and rollback() methods?
a) Statement Interface
b) ResultSet Interface
c) Connection Interface
d) RowSet Interface
Answer: c
Explanation: The connection interface provides the commit() and rollback() method. The commit()
method makes all changes made since the previous commit/rollback permanent and releases any
database locks currently held by this Connection object. The rollback() method undoes all changes
made in the current transaction and releases any database locks currently held by this Connection
object.
a) 2
b) 1
c) 3
d) Multiple
Answer: d
Explanation: Multiple statements can be created and used on the same connection, but only one
resultset at once can be created and used on the same statement.
93) JDBC API supports____________ and __________ architecture model for accessing the
database.
a) Two-tier
b) Three-tier
c) Both a and b
d) Only b
Answer: c
Explanation: The JDBC API supports both two-tier and three-tier processing models for database
access. In the two-tier model, a Java application talks directly to the data source. In the three-tier
model, commands are sent to a "middle tier" of services, which then sends the commands to the data
source.
i. A transaction is a set of one or more SQL statements that make up a logical unit of work.
ii. A transaction ends with either a commit or a rollback, depending on whether there are any
problems with data consistency or data concurrency.
iii. A lock is a mechanism that allows two transactions from manipulating the same data at the same
time.
iv. To avoid conflicts during a transaction, a DBMS uses locks, mechanisms for blocking access by
others to the data that is being accessed by the transaction.
1. Only i and ii
2. Only i and iii
3. Only i, ii, and iv
4. All the above
Answer: c
Explanation: The statements i, ii, and iv are true about transactions but iii is not because the lock
mechanism prohibits two transactions from manipulating the same data at the same time.
a) java.io.date
b) java.sql.date
c) java.util.date
d) java.util.dateTime
Answer: d
Explanation: java.util.date contains both date and time. Whereas, java.sql.date contains only date.
Answer: d
Explanation: Since the JDBC connection takes time to establish. Creating connection at the
application start-up and reusing at the time of requirement, helps performance of the application.
a) Slow performance
b) Encourages SQL injection
c) Prevents SQL injection
d) More memory usage
Answer: c
Explanation: PreparedStatement in Java improves performance and also prevents from SQL injection.
a) java.sql.TimeStamp
b) java.sql.Time
c) java.io.Time
d) java.io.TimeStamp
Answer: a
Explanation: java.sql.Time contains only time. Whereas, java.sql.TimeStamp contains both time and
date.
Answer: c
Explanation: setAutoCommit(false) does not commit transaction automatically after each query. That
saves a lot of time of the execution and hence improves performance.
a) Statement
b) PreparedStatement
c) CallableStatment
d) CalledStatement
Answer: c
Explanation: CallableStatement is used in JDBC to call stored procedure from Java program.
101) Which of the following is used to limit the number of rows returned?
a) setMaxRows(int i)
b) setMinRows(int i)
c) getMaxrows(int i)
d) getMinRows(int i)
Answer: a
Explanation: setMaxRows(int i) method is used to limit the number of rows that the database returns
from the query.
a) setBatch()
b) deleteBatch()
c) removeBatch()
d) addBatch()
Answer: d
Explanation: addBatch() is a method of JDBC batch process. It is faster in processing than executing
one statement at a time.
a) rollback()
b) rollforward()
c) deleteTransaction()
d) RemoveTransaction()
Answer: a
Explanation: rollback() method is used to rollback the transaction. It will rollback all the changes
made by the transaction.
a) TRANSACTION_NONE
b) TRANSACTION_READ_COMMITTED
c) TRANSACTION_REPEATABLE_READ
d) TRANSACTION_NONREPEATABLE_READ
Answer: d
Explanation: TRANSACTION_NONREPEATABLE_READ is not a JDBC connection isolation
level.
a) Doubleton
b) Singleton
c) Stateful
d) Stateless
Answer: a
Explanation: Stateful, Stateless and Singleton are session beans.
Answer: b
Explanation: java.io.Serializable is not a class. Instead it is an interface. Hence it cannot be extended.
a) /
b) \
c) –
d) //
Answer: a
Explanation: MANIFEST file uses classes using / file separator.
108) Which of the following is correct error when loading JAR file with duplicate name?
a) java.io.NullPointerException
b) java.lang.ClassNotFound
c) java.lang.ClassFormatError
d) java.lang.DuplicateClassError
Answer: c
Explanation: java.lang.ClassFormatError: Duplicate Name error is thrown when .class file in the JAR
contains a class whose class name is different from the expected name.
a) True
b) False
Answer: b
Explanation: JavaBeans do not add any security features to the Java platform.
a) Introspection
b) Events
c) Persistence
d) Serialization
Answer: d
Explanation: Serialization is not the feature of Java Beans. Introspection, Customization, Events,
Properties and Persistence are the features.
111) What is the attribute of java bean to specify scope of bean to have single instance per
Spring IOC?
a) prototype
b) singleton
c) request
d) session
Answer: b
Explanation: Singleton scope of bean specifies only one instance per spring IOC container. This is the
default scope.
a) init
b) init-method
c) initialization
d) initialization-method
Answer: b
Explanation: init-method is used to specify the initialization method.
a) destroy
b) destroy-method
c) destruction
d) destruction-method
Answer: b
Explanation: destroy-method is used to specify the destruction method.
a) @Qualifier
b) @Type
c) @Constructor
d) @Name
Answer: a
Explanation: Differet beans of the same class are identified by name.
Web Technologies(Unit-5)
Servlet MCQ
Q 1 - When service() method of servlet gets called?
A - The service() method is called when the servlet is first created
B - The service() method is called whenever the servlet is invoked.
C - Both of the above.
D - None of the above.
Answer : B
Explaination
Each time the server receives a request for a servlet, the server spawns a new thread and calls
service() method.
Q 2 - Which of the following code is used to set content type of a page to be serviced using
servlet?
A - response.setContentType()
B - request.setContentType()
C - writer.setContentType()
D - None of the above.
Answer : A
Explaination
You call response.setContentType() method to set content type of a page to be serviced using
servlet.
Q 3 - Which of the following code is used to get cookies in servlet?
A - response.getCookies()
B - request.getCookies()
C - Cookies.getCookies()
D - None of the above.
Answer : B
Explaination
request.getCookies() returns an array containing all of the Cookie objects the client sent with
this request.
Q 4 - Which of the following code retrieves the MIME type of the body of the request?
A - new MimeType()
B - request.getContentType()
C - response.getContentType()
D - None of the above.
Answer : B
Explaination
request.getContentType() returns the MIME type of the body of the request, or null if the type is
not known.
Q 5 - Which of the following code encodes the specified URL for use in the sendRedirect
method?
A - response.encodeRedirectURL(url)
B - request.encodeRedirectURL(url)
C - Header.encodeRedirectURL(url)
D - None of the above.
Answer : A
Explaination
Answer : B
Explaination
response.addHeader(name,date) adds a response header with the given name and value.
Q 7 - Which of the following code can be used to set the content type for the body of the
response?
A - request.setContentType(type)
B - response.setContentType(type)
C - header.setContentType(type)
D - None of the above.
Answer : B
Explaination
response.setContentType(type) sets the content type for the body of the response.
Q 9 - Which of the following code is used to get an attribute in a HTTP Session object in
servlets?
A - session.getAttribute(name)
B - session.alterAttribute(name)
C - session.updateAttribute(name)
D - None of the above.
Answer : A
Explaination
session.getAttribute() returns the object bound with the specified name in this session, or null if
no object is bound under the name.
Q 10 - Which of the following code is used to set the session timeout in servlets?
A - session.setMaxInactiveInterval(interval)
B - response.setMaxInactiveInterval(interval)
C - request.setMaxInactiveInterval(interval)
D - None of the above.
Answer : A
Explaination
You can call public void setMaxInactiveInterval(int interval) method of session to set the
timeout for a session individually.
11.What is the difference between servlets and applets?
i. Servlets execute on Server; Applets execute on browser
ii. Servlets have no GUI; Applet has GUI
iii. Servlets creates static web pages; Applets creates dynamic web pages
iv. Servlets can handle only a single request; Applet can handle multiple requests
a) i, ii, iii are correct
b) i, ii are correct
c) i, iii are correct
d) i, ii, iii, iv are correct
Answer: b
Explanation: Servlets execute on Server and doesn’t have GUI. Applets execute on browser and
has GUI.
12 Which of the following code is used to get an attribute in a HTTP Session object in servlets?
a) session.getAttribute(String name)
b) session.alterAttribute(String name)
c) session.updateAttribute(String name)
d) session.setAttribute(String name)
Answer: a
Explanation: session has various methods for use.
13. When destroy() method of a filter is called?
a) The destroy() method is called only once at the end of the life cycle of a filter
b) The destroy() method is called after the filter has executed doFilter method
c) The destroy() method is called only once at the begining of the life cycle of a filter
d) The destroyer() method is called after the filter has executed
Answer: a
Explanation: destroy() is an end of life cycle method so it is called at the end of life cycle.
14. Which of the following is true about servlets?
a) Servlets execute within the address space of web server
b) Servlets are platform-independent because they are written in java
c) Servlets can use the full functionality of the Java class libraries
d) Servlets execute within the address space of web server, platform independent and uses the
functionality of java class libraries
Answer: d
Explanation: Servlets execute within the address space of a web server. Since it is written in java
it is platform independent. The full functionality is available through libraries.
Answer: b
Explanation: URL rewriting, using session object, using cookies, using hidden fields are session
tracking techniques.
16. The _______ specification defines an application programming interface for communication
between the server and the application program
a) Java Servlet
b) JDBC
c) Java Applet
d) Java Swing
Answer: a
Explanation: The java servlet specification defines an application programming interface for
communication between the server and the application program. The HttpServlet class in Java
implements the servlet API specification.
17. State true or false: Servlets are used to generate dynamic responses to HTTP requests.
a) True
b) False
Answer: a
Explanation: Servlets are used to generate dynamic responses to HTTP requests. The task of a
servlet is to process a request dynamically.
18. Which of these functions is not a part of the servlet lifecycle
a) Checking if an instance of servlet exists or not
b) Invoking the service method of the servlet
c) Shutting down the servlet
d) Pausing the servlet for a given period of time.
Answer: d
Explanation: Pausing the servlet for a given amount of time is not a part of the servlet lifecycle.
A servlet can be checked, invoked and destroyed but it cannot be paused.
19. Which of the following application servers do not provide built in support for servlets?
a) Tomcat server
b) Glassfish
c) JBoss
d) None of the mentioned
Answer: d
Explanation: All of the mentioned application servers provide built in support for servlets.
Glassfish and Tomcat are the most prominently used application servers.
Answer: b
Explanation: A servlet class extends the capabilities of servers that host applications which are
accessed by way of a request-response programming model.
21. What does MIME stand for?
a) Multipurpose Internet Messaging Extension
b) Multipurpose Internet Mail Extension
c) Multipurpose Internet Media Extension
d) Multipurpose Internet Mass Extension
Answer: b
Explanation: MIME is an acronym for Multi-purpose Internet Mail Extensions. It is used for
classifying file types over the Internet. It contains type/subtype e.g. application/msword.
22. What is the storage capacity of single cookie?
a) 2048 MB
b) 2048 bytes
c) 4095 bytes
d) 4095 MB
Answer: c
Explanation: Storage capacity of cookies is 4095 bytes/cookie.
Answer: d
Explanation: Applet and Servlet communicate through HTTP Tunneling.
Q.24 Which of the following statement is not correct about HTTP method ?
a. A POST request append data to the end of the URL.
b. A GET request append data to the end of the URL.
c. HTTP DELETE method request for the Server to delete the resource
d. HTTP OPTIONS request for communication options available on the request/response chain
Correct Answer : OPTION A, A POST request append data to the end of the URL
a. Web Container
b. Servlet Context
c. JVM
d. Server
Correct Answer : OPTION D, POST method sends data in the body of the request
30. Q. Deployment Descriptor(DD) is a _________ .
b. Text document
c. XML document that is used by Web Container to run servlets and JSPs.
d. Library file.
Correct Answer : OPTION C, XML document that is used by Web Container to run
servlets and JSPs.
31. Deployment Descriptor(DD) is used for initializing parameter. True or False?
a. True
b. False
a. service()
b. initialize()
c. init()
a. CONNECT method
b. COMPARE method
c. OPTIONS method
d. TRACE method
a. HttpServletRequest
b. HttpServletResponse
c. ServletConfig
d. ServletContext
a. sendURL()
b. redirectURL()
c. sendRedirect()
d. getRequestDispatcher()
a. BinaryInputStream s = request.getInputStream();
b. ServletInputStream s = request.getInputStream();
c. BinaryInputStream s = request.getBinaryStream();
d. ServletInputStream s = request.getInputStream();
A. getRequestDispatcher()
b. getDispatcher()
c. getRequest()
d. requestDispatcher()
d.None
a. getRequestMethod()
b. getHttpMethod()
c. getHttpRequestMethod()
d. getMethod()
a. ServletConfig
b. ServletInit
c. ServletContext
a. Servlet
b. ServletConfig
c. ServletContext
d. HttpServletContext
a. ServletConfig
b. ServletResponse
c. RequestDispatcher
d. HttpServletRequest
b. Any servlet can have access to HttpSession object through the getSession() method
c. A session will become invalid as soon as the user close all the browser window
a. request.getSession(false);
b. request.createSession();
c. request.getNewSession();
d. request.getSession();
a. getCookies()
b. getNewCookies();
c. cookies();
d. returnCookies();
a. getParameterValue()
b. getParameter()
c. getValue()
d. requestParameter()
a. if session already exist, it return the existing session else create a new session
d.none
a. getSessionId()
b. getUniqueId()
c. getUniqueSessionId()
d. getId()
b. Server
a. invalidateSession()
b. invalidate()
c. deleteSession()
d. delete()
a. getCreationTime()
b. getTime()
c. getStartingTime()
d. creationTime()
Ans:b,c,d
55.Which of the following interprets html code and renders webpages to user?
a.client
b.server
c.browser
Ans :C
56.What are the correct statement about server?
b.can be software
c.can be hardware
d.non of these
Ans:a,b,c
a.https
b.http
c.ftp
d.none of these
Ans:a,b
a.<action>
b.<form>
c.<input>
d.all of these
Ans:b
Ans:a,b,c
b.false
Ans:a
61.Which http method send by browser that asks the server to get the page only?
a.get
b.post
c.option
d.put
Ans:a
62.Which http method send by browser that gives the server what user data typed in the form?
a.put
b.post
c.get
d.none of these
Ans:b
a.We can't
b.Through url
c.Through payload
d.Non of these
Ans:b
64.When we are sending data in URL in get method, how to separate separate path and
parameter?
b.By &
c.By ?
d.All of these
Ans:c
65.When we are sending data in URL in get method, how to separate parameters?
a.,
b.;
c.?
d.&
Ans:d
Ans:c
a.application/java
b.image/bmp
c.text/html
d.text/css
e.text/plain
Ans:all
a.It tells the browser what type of data browser will send
b.It tells the browser what type of data browser will receive
c.It tells the server what type of data server will receive
d.It tells the server what type of data server will send
Ans:b
a.dynamic
b.static
d.none of these
Ans:b
b.tomcat
c.Lighttpd
d.nginx
e.glassfish
Ans:a,b,c,d
a.JBoss
b.JRun
c.WebLogic Server(BEA)
e.GlassFish
Ans:d
a.true
b.false
Ans:a
a.web-app
b.welcome-file-list
c.servlet
d.servlet-mappings
Ans:d
JSP MCQ
1) JSP stands for ___.
Ans :A
2) What is JSP?
A. Java Server Pages (JSP) is a server-side programming technology that enables the creation of
dynamic, platform-independent method for building Web-based applications.
B. Java Server Pages (JSP) is a client-side programming technology that enables the creation of
dynamic, platform-independent method for building Web-based applications.
C. Both A and B
Ans:A
3) Which of the following is the correct syntax to declare comments in JSP?
C. //..
Ans:A
A. include
B. page
C. export
D. useBean
Ans:C
5) Which technology do we mix our business logic with the presentation logic?
A. Servlet
B. JSP
C. Both A & B
Ans:A
6) Which JSP Action tags is used to include the content of another resource, it may be JSP, html
or Servlet?
A. <jsp:include >
B. <jsp:forward >
C. <jsp:plugin >
D. <jsp:papam >
Ans:A
A. HTML tags
B. JSP tags
C. Both A & B
Ans:C
A. javax.servlet.jsp
B. java.servlet
C. javax.servlet.jsp.tagext
D. Both A & C
Ans:D
Ans:A
A. True
B. False
Ans:A
Ans:D
A. platform independent
C. easily maintained
Ans:D
A. to catch any Throwable that occurs in its body and optionally exposes it.
Ans:A
A. Parsing of JSP
Ans D
C. It removes a variable from either a specified scope or the first scope where the variable is
found.
Ans:C
A. <%@ page…%>
B. <% page…%>
C. <!@ page…!>
Ans:A
17) Which syntax is used to defines the programming language (underlying language) being used
in the JSP?
Ans:A
Ans:B
19) A __ is used to insert the value of a scripting language expression, converted into a string,
into the data stream returned to the client.
A. JSP expression
B. ASP
C. PHP
Ans:A
A. useBean action first searches for an existing object utilizing the id and scope variables. If an
object is not found, it then tries to create the specified object.
Ans:C
Ans:A
A. javax.servlet.HttpContext
B. javax.servlet.ServletContext
C. javax.servlet.Context
D. javax.servlet.Application
Ans:B
23) Which tag should be used to pass information from JSP to included JSP?
Ans:B
A. Objects are accessible only from the pages which are processing the same request
B. Objects are accessible only from the pages which reside in same application
C. Objects are accessible only from the page in which they are created
D. Objects are accessible only from the pages which are in same session
Ans:D
A. True
B. False
Ans:A
26) Which one is the correct order of phases in JSP life cycle?
Ans:A
A. ServletRequest
B. HttpServletRequest
C. Request
D. HttpRequest
Ans :B
A. id, type
B. type, property
C. type,id
D. id, class
Ans:D
A. compilation
B. translation
C. Both A and B
D. syntax
Ans:D
30) Which of the scripting of JSP not putting content into service method of the converted
servlet?
A. Declarations
B. Expressions
C. Scriptlets
Ans:B
A - True
B - False
Answer : A
Explaination
JSP container creates _jspService() methods so it should not be overridden.
A - html
B - jsp
C - javaScript
D - css
Answer : B
Explaination
jsp is a server side technology.
A - True
B - False
Answer : B
Explaination
No, Jsp pages are not required to be mapped/configured in web.xml
A - True
B - False
Answer : B
Explaination
isErrorPage is required to be set true, it is false by default.
A - javax.servlet.ServletContext
B - javax.servlet.ServletConfig
C - javax.servlet.jsp.PageContext
D - javax.servlet.Application
Answer : C
Explaination
The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The
pageContext object is used to represent the entire JSP page.
A - true
B - false
Answer : A
Explaination
The default value of the attribute is true, meaning that expressions, ${...}, are evaluated as
dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated
but rather treated as static text.
A - The isELIgnored option gives you the ability to disable the evaluation of Expression
Language (EL) expressions.
Answer : C
Explaination
The isELIgnored option gives you the ability to disable the evaluation of Expression Language
(EL) expressions. The default value of the attribute is true, meaning that expressions, ${...}, are
evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are
not evaluated but rather treated as static text.
38)Which of the following is true about Initialization phase in JSP life cycle?
A - When a container loads a JSP it invokes the jspInit() method before servicing any requests.
39) Can you make use of a ServletOutputStream object from within a JSP page?
A - true
B - false
Answer : B
Explaination
No. You are supposed to make use of only a JSPWriter object (given to you in the form of the
implicit object out) for replying to clients.
C - It removes a variable from either a specified scope or the first scope where the variable is
found
Answer : C
Explaination
The <c:remove > tag removes a variable from either a specified scope or the first scope where
the variable is found (if no scope is specified).
41) Which of the following is true about JSP?
A.1 & 2
B.1 & 3
C.2 & 3
A.jspInit()
B._jspService()
C.jspDestroy()
Explanation
Correct Option :D.
43) Request processing of JSP is done by calling which method?
A.jspInit()
B._jspService()
C.jspDestroy()
D._jspRequest()
Explanation
Correct Option :B.
44) Which of the following method helps in jsp page initialization?
A.jspInit()
B._jspService()
C.jspDestroy()
D.init()
Explanation
Correct Option :A.
45) Which of the following is correct about JSP?
2. JSP translator is a part of the web server which is responsible for translating the JSP page into
Servlet.
A.only 1
B.only 2
C.Both 1 & 2
D.None
Explanation
Correct Option :C.
46) Which of the following folder in JSP project contains web.xml file?
A.META-INF
B.WEB-INF
C.context-root
D.Any of A & B
Explanation
Correct Option :B.
47) Arrange in correct sequence of JSP life cycle.
1. Instantiation
2. Request processing
3. Initialization
4. Classloading
6. Destroy
A.7-5-4-1-3-2-6
B.6-5-4-1-3-2-7
C.1-5-4-7-3-2-6
D.7-5-4-3-1-2-6
Explanation
Correct Option :A.
48) In JSP, java code can be written inside the jsp page using _____________
A.scriptlet tag
B.expression tag
C.declaration tag
Explanation
Correct Option :A.
49) Which of the following can be used as scripting elements in jsp?
A.scriptlet tag
B.expression tag
C.declaration tag
Explanation
Correct Option :D.
50) The code placed within _______ is written to the output stream of the response.
A.declaration tag
B.scriptlet tag
C.expression tag
Explanation
Correct Option :C.
51. <%= statement %>
This represents:
A.scriptlet tag
B.expression tag
C.declaration tag
D.taglib directive
Explanation
Correct Option :B.
52. Which of the following scripting elements can be used to declare methods and fields?
A.scriptlet tag
B.expression tag
C.declaration tag
Explanation
Correct Option :C.
53) How many implicit objects are there in jsp?
A.7
B.8
C.9
D.10
Explanation
Correct Option :C.
54) Which of the following are implicit objects in jsp?
A.request
B.config
C.application
Explanation
Correct Option :D.
55) Which of the following is not implicit object in jsp?
A.session
B.page
C.pageContext
D.cookies
Explanation
Correct Option :D.
56)_________ can be used to get request information such as parameter, header information,
remote address, server name, server port, content type, character encoding etc.
A.JSP request
B.JSP response
C.JSP config
D.JSP session
Explanation
Correct Option :A.
57)The ________ object is created by the web container for each jsp page.
A.application
B.config
C.exception
Explanation
Correct Option :B.
58)This object can be used to get initialization parameter from configuaration file (web.xml)
A.config
B.application
C.session
D.request
Explanation
Correct Option :B.
59)Which of the following is not a jsp directive element?
A.page directive
B.include directive
C.taglib directive
D.session directive
Explanation
Correct Option :D.
60)The pageContext object can be used to set or get or remove attributes from which of the
following scopes
A.request
B.session
C.application
Explanation
Correct Option :D.
61)Which of the following is not a jsp action tag?
A.jsp:forward
B.jsp:useBean
C.jsp:setProperty
D.jsp:setException
Explanation
Correct Option :D.
62)Which of the following is/are jsp action tags?
A.jsp:getProperty
B.jsp:plugin
C.jsp:fallback
Explanation
Correct Option :D.
63)______ action tag helps embeds another components such as applet.
A.jsp:plugin
B.jsp:config
C.jsp:setProperty
D.jsp:fallback
Explanation
Correct Option :A.
64) <%@ page ... %>
Above jsp element defines page-dependent attributes, such as:
A.scripting language
B.error page
C.buffering requirements
E.Only A & B
Explanation
Correct Option :D.
All of the above is the correct answer
Explanation
Correct Option :A.
Includes a file during the translation phase is the correct answer
66)<%@ taglib ... %>
above jsp element is used to:
A.Declare a tag library used in the page
Explanation
Correct Option :D.
All of the above is the correct answer
67)Which of the following jsp element makes a JavaBeans component available in a page?
A.jsp:useBean element
B.jsp:getProperty element
C.jsp:include element
D.jsp:plugin element
Explanation
Correct Option :A.
jsp:useBean is the correct answer
A.Includes the response from a servlet during the request processing phase
B.Includes the response from a JSP page during the request processing phase
E.Only A & B
Explanation
Correct Option :E.
Only A & B is the correct answer
69)jsp element is used to:
C.Adds a parameter value to a request handed off to another servlet or JSP page
D.Includes the response from a servlet or JSP page during the request processing phase
Explanation
Correct Option :A.
Forwards the processing of a request to a servlet or JSP page is the correct answer
70)Gets a property value from a JavaBeans component and adds it to the response in jsp
A.jsp:getProperty element
B.jsp:setProperty element
C.jsp:param element
D.jsp:includeProperty element
Explanation
Correct Option :A.
jsp:getProperty element is the correct answer
71)Generates HTML that contains the appropriate client browser-dependent elements (OBJECT
or EMBED) needed to execute an Applet with the Java Plugin software
A.jsp:forward element
B.jsp:plugin element
C.jsp:setProperty element
D.jsp:useBean element
Explanation
Correct Option :B.
jsp:plugin element element is the correct answer
72)<% ... %>
above jsp element is known as :
A.scriptlet
B.declaration
C.expression
D.beans
E.taglib
Explanation
Correct Option :A.
scriptlet is the correct answer
A.scriptlet
B.expression
C.declaration
D.beans
E.taglib
Explanation
Correct Option :C.
declaration is the correct answer
C.The JSP container is often implemented as a servlet configured to handle all requests for JSP
pages.
D.A JSP container is responsible for converting the JSP page into a servlet
Explanation
Correct Option :B.
A JSP page can be sent as-is to the browser is the correct answer
75)A servlet container and a JSP container are often combined into one package under the name:
A.Web services
B.Microservices
C.Interface
D.IOC container
E.Web container
Explanation
Correct Option :E.
web container is the correct answer
Explanation
Correct Option :C.
Page, Request, Session, Application is the correct answer
A.generatePdfFormat
B.generatePdf
C.contentType
D.typePDF
E.PdfContent
Explanation
Correct Option :C.
contentType is the correct answer
JDBC Drivers MCQ
Question 1
Select the packages in which JDBC classes are defined?
jdbc and javax.jdbc
rdb and javax.rdb
jdbc and java.jdbc.sql
java.sql and javax.sql
Question 2
Question 3
Question 5
Which of the following driver is the fastest one?
JDBC-ODBC Bridge Driver
Native API Partly Java Driver
Network Protocol Driver
JDBC Net Pure Java Driver
Question 6
Which of the following driver converts the JDBC calls into database-specific
calls?
JDBC-ODBC Bridge Driver (Type 1)
Native API-partly Java Driver (Type 2)
Net Protocol-pure Java Driver (Type 3)
Native Protocol-pure Java Driver (Type 4)
Question 7
Question 8
Question 9
Question 10
Question 11
Question 12
Question 13
Driver types are used to categorize the technology used to connect to database.
True
False
Question 14
Question 15
a. ParameterizedStatement
b. PreparedStatement
c. CallableStatement and Parameterized Statement
d. All kinds of Statements
a. Statement
b. PreparedStatement
c. QueryStatement
d. CallableStatement
Explanation:
a. CallableStatement
b. Statement
c. CalledStatement
d. PreparedStatement
A. db,
B. db:
C. jdbc,
D. jdbc:
Explanation: All JDBC URLs begin with the protocol jdbc followed by a colon
as a delimiter.
A. Connection.getConnection(url)
B. Driver.getConnection(url)
C. DriverManager.getConnection(url)
D. new Connection(url)
12- Which of the following is efficient than a statement due to the pre-
compilation of SQL?
A - Statement
B - PreparedStatement
C - CallableStatement
D - None of the above.
13-What is JDBC?
a. JDBC is a java based protocol.
b. JDBC is a standard Java API for database-independent
connectivity between the Java programming language and a
wide range of databases.
c. JDBC is a specification to tell how to connect to a database.
d. Joint Driver for Basic Connection
14-Which type of driver converts JDBC calls into the network protocol
used by the database management system directly?
Type 1 driver
Type 2 driver
Type 3 driver
Type 4 driver
statement
connection
query
both A and B
17-Which type of driver provides JDBC access via one or more ODBC drivers?
Type 1 driver
Type 2 driver
Type 3 driver
Type 4 driver
18-Which of the following methods are needed for loading a database driver in
JDBC?
registerDriver()
Class.forName()
Both A and B
getConnection()
19-Which driver is efficient and always preferable for using JDBC applications?
Type – 4
Type – 3
Type – 2
Type – 1
20-Are prepared statements actually compiled?
Yes, they compiled
No, they are bound by the JDBC driver
21-Which of the following describes the correct sequence of the steps involved
in making a connection with a database.
1. Loading the driver
2. Process the results.
3. Making the connection with the database
4. Executing the SQL statements
1,3,4,2
1,2,3,4
2,1,3,4
4,1,2,3
22- In type-1 driver database is _______ and platform is _______.
dependent, dependent
independent, dependent
dependent, independent
independent, independent
23- Driver types are used to categorize the technology used to connect to
database.
True
False
24- JDBC stands for:
Java Database Component
Java Database Connectivity
Java Database Control
None
25- Which of the following driver converts the JDBC calls into database-
specific calls?
JDBC-ODBC Bridge Driver (Type 1)
Native API-partly Java Driver (Type 2)
Net Protocol-pure Java Driver (Type 3)
Native Protocol-pure Java Driver (Type 4)
Servlet
javax.servlet
javax.servlet.http
Both of the above.
None of the above.
class loading
init()
service()
destroy()
8- which lifecycle method make ready the servlet for garbage collection
init()
service()
destroy()
put()
9- What are Servlets?
Java Servlets are programs that run on a Web or Application server.
Java Servlets act as a middle layer between a request coming from a Web
browser or other HTTP client and databases or applications on the HTTP server.
Both of the above.
None of the above.
10- Which of the following is the correct order of servlet life cycle phase
methods?
init, service, destroy
initialize, service, destroy
init, execute, destroy
init, service, delete
11- When destroy method of servlet gets called?
The destroy method is called only once at the end of the life cycle of a
servlet.
The destroy method is called after the servlet has executed service method.
Both of the above
None of the above
12- Which are the session tracking techniques?
i. URL rewriting
ii. Using session object
iii.Using response object
iv. Using hidden fields
v. Using cookies
vi. Using servlet object
i, ii, iii, vi
i, ii, iv, v
i, vi, iii, v
i, ii, iii, v
13- What type of servlets use these methods doGet(), doPost(),doHead,
doDelete(), doTrace()?
Genereic Servlets
HttpServlets
All of the above
None of the above
14-Which cookie it is valid for single session only and it is removed each time
when the user closes the browser?
Persistent cookie
Non-persistent cookie
All the above
None of the above
15-Sessions is a part of the SessionTracking and it is for maintaining the client
state at server side.
True
False
16-Which method in session tracking is used in a bit of information that is sent
by a web server to a browser and which can later be read back from that
browser?
HttpSession
URL rewriting
Cookies
Hidden form fields
17-Which are the examples of Application Server?
Apache
Tomcat
JBoss
Weblogic
Both C & D
18- How many techniques are used in Session Tracking?
4
3
2
5
19-In HTTP Request method Get request is secured because data is exposed in
URL bar
True
False
20-Servlet technology is used to create web application
True
False
q2- JSP
1-All servlet classes are required to be mapped and configured in web.xml.
True
False
2-Which of the following method can be used to read a form parameter in JSP?
request.getParameter()
response.getParameter()
request.getValue()
response.getValue()
7-How many jsp implicit objects are there and these objects are created by the
web container that are available to all the jsp pages?
8
9
10
7
13-JSPs eventually are compiled into Java servlets, you can do as much with
JSPs as you can do with Java servlets.
True
False
14-Which technology do we mix our business logic with the presentation logic?
Servlet
JSP
Both A & B
None of the above
um
d) className objectName();
Answer: a
nt
Explanation: The syntax must contain * symbol after the className as the type of object. This declares an object pointer. This
ua
can store address of any object of the specified class.
_Q
3. Which operator should be used to access the members of the class using object pointer?
a) Dot operator
ks
b) Colon to the member
c) Scope resolution operator
d) Arrow operator oo
_B
Answer: d
Explanation: The members can be accessed from the object pointer by using arrow operator. The arrow operator can be used
es
only with the pointer of class type. If simple object is declared, it must use dot operator to access the members.
ot
4. How does compiler decide the intended object to be used, if more than one object are used?
_N
Answer: c
A
Explanation: This pointer denotes the object, in which it is being used. If member function is called with respect to one object
then this pointer refers to the same object members. It can be used when members with same name are involved.
e/
t.m
Answer: d
ht
Explanation: The address of only the specified class type can get their address stored in the object pointer. The addresses
doesn’t differ but they do differ for the amount and type of memory required for objects of different classes. Hence same class
object pointer should be used.
6. What is the size of an object pointer?
a) Equal to size of any usual pointer
b) Equal to size of sum of all the members of object
c) Equal to size of maximum sized member of object
d) Equal to size of void
Answer: a
Explanation: The size of object pointer is same as that of any usual pointer. This is because only the address have to be stored.
There are no values to be stored in the pointer.
7. A pointer
a) Can point to only one object at a time
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) No, because objects can be referenced from another objects too
d) No, never
nt
Answer: d
ua
Explanation: The pointers to an object can never access the private members of the class outside the class. The object can
indirectly use those private members using member functions which are public in the class.
_Q
10. Is name of an array of objects is also a pointer to object?
ks
a) Yes, always
b) Yes, in few cases
c) No, because it represents more than one object
d) No, never
oo
_B
Answer: a
es
Explanation: The array name represents a pointer to the object. The name alone can represent the starting address of the array.
But that also represents an array which is in turn stored in a pointer.
ot
_N
Answer: a
Explanation: The pointer to an object can hold only the addresses. Address of any other object of same class. This allows the
e/
12. Which is the correct syntax to call a member function using pointer?
a) pointer->function()
/
s:/
b) pointer.function()
c) pointer::function()
tp
d) pointer:function()
ht
Answer: a
Explanation: The pointer should be mentioned followed by the arrow operator. Arrow operator is applicable only with the
pointers. Then the function name should be mentioned that is to be called.
13. If a pointer to an object is created and the object gets deleted without using the pointer then
a) It becomes void pointer
b) It becomes dangling pointer
c) It becomes null pointer
d) It becomes zero pointer
Answer: b
Explanation: When the address pointed by the object pointer gets deleted, the pointer now points to an invalid address. Hence it
becomes a dangling pointer. It can’t be null or void pointer since it doesn’t point to any specific location.
14. How can the address stored in the pointer be retrieved?
a) Using * symbol
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: b
Explanation: The references are made to object when the object is created and initialized with another object without calling any
nt
constructor. But the object pointer must be declared explicitly using * symbol that will be capable of storing some address.
ua
Hence both are different.
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) Initialize all the objects of a class to another object of another class
Answer: a
nt
Explanation: The copy constructor has the most basic function to initialize the members of an object with same values as that of
ua
some previously created object. The object must be of same class.
_Q
3. If two classes have exactly same data members and member function and only they differ by class name. Can copy
constructor be used to initialize one class object with another class object?
ks
a) Yes, possible
b) Yes, because the members are same
c) No, not possible
d) No, but possible if constructor is also same
oo
_B
Answer: c
es
Explanation: The restriction for copy constructor is that it must be used with the object of same class. Even if the classes are
exactly same the constructor won’t be able to access all the members of another class. Hence we can’t use object of another
ot
Answer: b
e/
Explanation: When an object is passed to a function, actually its copy is made in the function. To copy the values, copy
t.m
constructor is used. Hence the object being passed and object being used in function are different.
5. Which returning an object, we can use
/
s:/
a) Default constructor
b) Zero argument constructor
tp
c) Parameterized constructor
ht
d) Copy constructor
Answer: d
Explanation: While returning an object we can use the copy constructor. When we assign the return value to another object of
same class then this copy constructor will be used. And all the members will be assigned the same values as that of the object
being returned.
6. If programmer doesn’t define any copy constructor then
a) Compiler provides an implicit copy constructor
b) Compiler gives an error
c) The objects can’t be assigned with another objects
d) The program gives run time error if copying is used
Answer: a
Explanation: The compiler provides an implicit copy constructor. It is not mandatory to always create an explicit copy constructor.
The values are copied using implicit constructor only.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
a) Must be passed by reference
b) Must be passed by value
nt
c) Must be passed with integer type
d) Must not be mentioned in parameter list
ua
Answer: a
_Q
Explanation: This is mandatory to pass the object by reference. Otherwise, the object will try to create another object to copy its
values, in turn a constructor will be called, and this will keep on calling itself. This will cause the compiler to give out of memory
ks
error.
10. Out of memory error is given when the object
a) Is passed with & symbol
oo
to the copy constructor.
_B
b) Is passed by reference
c) Is passed as <classname &obj>
es
Answer: d
_N
Explanation: All the options given, directly or indirectly indicate that the object is being passed by reference. And if object is not
passed by reference then the out of memory error is produced. Due to infinite constructor call of itself.
TU
Answer: c
Explanation: Whenever the compiler creates a temporary object, copy constructor is used to copy the values from existing object
to the temporary object.
/
s:/
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
To practice basic questions and answers on all areas of Object Oriented Programming using C++, .
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Can be passed by reference or value
d) Can be passed with reference
nt
Answer: c
ua
Explanation: The objects can be passed by reference if required to use the same object. The values can be passed so that the
main object remains same and no changes are made to it if the function makes any changes to the values being passed.
_Q
3. Which symbol should be used to pass the object by reference in C++?
ks
a) &
b) @
c) $
d) $ or &
oo
_B
Answer: a
es
Explanation: The object to be passed by reference to the function should be preceded by & symbol in the argument list syntax of
the function. This indicates the compiler not to use new object. The same object which is being passed have to be used.
ot
_N
Answer: a
Explanation: The copy constructor is used. This constructor is used to copy the values into a new object which will contain all the
e/
values same as that of the object being passed but any changes made to the newly created object will not affect the original
t.m
object.
5. Pass by reference of an object to a function
/
s:/
d) Affects the object only if mentioned with & symbol with every call
Answer: c
Explanation: The original object in the caller function will get affected. The changes made in the called function will be same in
the caller function object also.
6. Copy constructor definition requires
a) Object to be passed by value
b) Object not to be passed to it
c) Object to be passed by reference
d) Object to be passed with each data member value
Answer: c
Explanation: The object must be passed by reference to a copy constructor. This is to avoid the out of memory error. The
constructors keeps calling itself, if not passed by reference, and goes out of memory.
7. What is the type of object that should be specified in the argument list?
Answer: d
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Yes, only if the data members are public and are being passed to a function outside the class
c) No, can’t be passed outside the class
d) No, can’t be done
nt
ua
Answer: b
Explanation: The data members can be passed with help of object but only if the member is public. The object will obviously be
_Q
used outside the class. The object must have access to the data member so that its value or reference is used outside the class
which is possible only if the member is public.
ks
10. What exactly is passed when an object is passed by reference?
a) The original object name
b) The original object class name
oo
_B
c) The exact address of the object in memory
d) The exact address of data members
es
Answer: c
ot
Explanation: The location of the object, that is, the exact memory location is passed, when the object is passed by reference.
_N
The pass by reference is actually a reference to the object that the function uses with another name to the same memory location
as the original object uses.
TU
11. If the object is not to be passed to any function but the values of the object have to be used then?
a) The data members should be passed separately
K
Answer: a
Explanation: The data members can be passed separately. There is no need to pass whole object, instead we can use the
object to pass only the required values.
/
s:/
13. What will be the output if all necessary code is included (Header files and main function)?
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
address and is denoted by another name also. But in pass by value, another object is created and new memory space is
allocated for it.
nt
15. Pass by reference and pass by value can’t be done simultaneously in a single function argument list.
ua
a) True
b) False
_Q
Answer: b
ks
Explanation: There is no condition which specifies that only the reference pass or values pass is allowed. The argument list can
contain one reference pass and another value pass. This helps to manipulate the objects with functions more easily.
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
b) Overriding can be implemented without using inheritance
c) Inheritance must be done, to use overriding are overridden
nt
d) Inheritance is mandatory only if more than one functions
ua
Answer: c
Explanation: The inheritance must be used in order to use function overriding. If inheritance is not used, the functions can only be
_Q
overloaded. There must be a base class and a derived class to override the function of base class.
ks
3. Which is the correct condition for function overriding?
a) The declaration must not be same in base and derived class
b) The declaration must be exactly the same in base and derived class oo
c) The declaration should have at least 1 same argument in declaration of base and derived class
_B
d) The declaration should have at least 1 different argument in declaration of base and derived class
es
Answer: b
Explanation: For a function to be over ridden, the declaration must be exactly the same. There must not be any different syntax
ot
used. This will ensure that the function to be overridden is only the one intended from to be overridden from the derived class.
_N
Answer: d
e/
Explanation: Declaration includes the whole prototype of the function. The return type name and the parameter list must be same
t.m
in order to confirm that the function is same in derived and the base class. And hence can be overridden.
5. Which among function will be overridden from the function defined in derived class below:
/
s:/
class A
tp
{
int i;
ht
void show()
{
cout<<i;
}
void print()
{
cout <<i;
}
};
class B
{
int j;
void show()
{
cout<<j;
}
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
7. The functions to be overridden
a) Must be private in base class
nt
b) Must not be private base class
ua
c) Must be private in both derived and base class
d) Must not be private in both derived and base class
_Q
Answer: b
ks
Explanation: If the function is private in the base class, derived class won’t be able to access it. When the derived class can’t
access the function to be overridden then it won’t be able to override it with any definition.
8. Which language doesn’t support the method overriding implicitly?
oo
_B
a) C++
b) C#
es
c) Java
d) SmallTalk
ot
_N
Answer: b
Explanation: The feature of method overriding is not provided in C#. To override the methods, one must use override or virtual
TU
keywords explicitly. This is done to remove accidental changes in program and unintentional overriding.
9. In C#
K
Answer: a
Explanation: The non-virtual and static methods can’t be overridden in C# language. The restriction is made from the language
/
s:/
implicitly. Only the methods that are abstract, virtual or override can be overridden.
tp
10. In Delphi
a) Method overriding is done implicitly
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
14. If virtual functions are defined in the base class then
a) It is not necessary for derived classes to override those functions
nt
b) It is necessary for derived classes to override those functions
ua
c) Those functions can never be derived
d) Those functions must be overridden by all the derived classes
_Q
Answer: a
ks
Explanation: The derived classes doesn’t have to redefine and override the base class functions. If one definition is already
given it is not mandatory for any derived class to override those functions. The base class definition will be used.
15. Which feature of OOP is exhibited by the function overriding?
oo
_B
a) Inheritance
b) Abstraction
es
c) Polymorphism
d) Encapsulation
ot
_N
Answer: c
Explanation: The polymorphism feature is exhibited by function overriding. Polymorphism is the feature which basically defines
TU
that same named functions can have more than one functionalities.
K
A
e/
/ t.m
s:/
tp
ht
um
c) Address of the object is passed
d) A new object is created with new random values
nt
Answer: a
ua
Explanation: When an object is passed by value, a new object is created implicitly. This new object uses the implicit values
assignment, same as that of the object being passed.
_Q
3. Pass by address passes the address of object and pass by reference passes the address of the object
ks
a) Explicitly, explicitly
b) Implicitly, implicitly
c) Explicitly, Implicitly
oo
_B
d) Implicitly, explicitly
es
Answer: c
Explanation: Pass by address uses the explicit address passing to the function whereas pass by reference implicitly passes the
ot
d) Are reflected to caller function object and called function object also
A
Answer: a
e/
Explanation: When an object is passed by reference, its address is passed implicitly. This will make changes to the main
t.m
5. Constructor function is not called when an object is passed to a function, will its destructor be called when its copy is
/
s:/
destroyed?
a) Yes, depending on code
tp
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
9. How many objects can be returned at once?
a) Only 1
nt
b) Only 2
ua
c) Only 16
d) As many as required
_Q
Answer: a
ks
Explanation: Like any other value, only one object can be returned at ones. The only possible way to return more than one object
is to return address of an object array. But that again comes under returning object pointer.
{
int i;
ot
public : A(int n)
_N
{
i=n; cout<<”inside constructor ”;
TU
}
~A()
{
K
cout<<”destroying ”<<i;
A
}
void seti(int n)
e/
{
t.m
i=n;
}
/
int geti()
s:/
{
return I;
tp
}
ht
};
void t(A ob)
{
cout<<”something ”;
}
int main()
{
A a(1);
t(a);
cout<<”this is i in main ”;
cout<<a.geti();
}
a) inside constructor something destroying 2this is i in main destroying 1
b) inside constructor something this is i in main destroying 1
c) inside constructor something destroying 2this is i in main
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: d
Explanation: There is no limit to how many objects can be passed. This works in same way as that any other variable gets
nt
passed. Array and object can be passed at same time also.
ua
13. If an object is passed by address, will be constructor be called?
a) Yes, to allocate the memory
_Q
b) Yes, to initialize the members
c) No, values are copied
ks
d) No, temporary object is created
Answer: c oo
Explanation: A copy of all the values is created. If the constructor is called, there will be a compile time error or memory shortage.
_B
This happens because each time a constructor is called, it try to call itself again and that goes infinite times.
es
14. Is it possible that an object of is passed to a function, and the function also have an object of same name?
a) No, Duplicate declaration is not allowed
ot
Answer: a
Explanation: There can’t be more than one variable or object with the same name in same scope. The scope is same, since the
K
object is passed, it becomes local to function and hence function can’t have one more object of same name.
A
15. Passing an object using copy constructor and pass by value are same.
e/
a) True
t.m
b) False
Answer: b
/
s:/
Explanation: The copy constructor is used to copy the values from one object to other. Pass by values is not same as copy
constructor method. Actually the pass by value method uses a copy constructor to copy the values in a local object.
tp
ht
um
c) The private members can be accessed only by the private members of the class
d) The private members can’t be accessed by the protected members of the class
nt
Answer: b
ua
Explanation: The private members are accessible within the class. There is no restriction on use of private members by public or
protected members. All the members can access the private member functions of the class.
_Q
3. Which member can never be accessed by inherited classes?
ks
a) Private member function
b) Public member function
c) Protected member function
d) All can be accessed
oo
_B
Answer: a
es
Explanation: The private member functions can never be accessed in the derived classes. The access specifiers is of maximum
security that allows only the members of self class to access the private member functions.
ot
_N
4. Which syntax among the following shows that a member is private in a class?
a) private: functionName(parameters)
TU
b) private(functionName(parameters))
c) private functionName(parameters)
d) private::functionName(parameters)
K
A
Answer: c
Explanation: The function declaration must contain private keyword follower by the return type and function name. Private
e/
Answer: a
Explanation: The private members doesn’t have to have the keyword with each private member. We only have to specify the
keyword private followed by single colon and then private member’s are listed.
6. In java, which rule must be followed?
a) Keyword private preceding list of private member’s
b) Keyword private with a colon before list of private member’s
c) Keyword private with arrow before each private member
d) Keyword private preceding each private member
Answer: d
Explanation: The private keyword must be mentioned before each private member. Unlike the rule in C++ to specify private once
and list all other private member’s, in java all member declarations must be preceded by the keyword private.
7. How many private member functions are allowed in a class?
a) Only 1
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) Can be accessed only if nested class is public
Answer: a
nt
Explanation: The nested class members can’t be accessed in the enclosed class even though other members can be accessed.
ua
This is to ensure the class members security and not to go against the rules of private members.
_Q
10. Which function among the following can’t be accessed outside the class in java in same package?
a) public void show()
ks
b) void show()
c) protected show()
d) static void show() oo
_B
Answer: c
Explanation: The protected members are available within the class. And are also available in derived classes. But these
es
members are treated as private members for outside the class and inheritance structure. Hence can’t be accessed.
ot
11. If private members are to be called outside the class, which is a good alternative?
_N
Answer: a
A
Explanation: The private member functions can be accessed within the class. A public member function can be called which in
turn calls the private member function. This maintains the security and adheres to the rules of private members.
e/
t.m
12. A private function of a derived class can be accessed by the parent class.
a) True
b) False
/
s:/
Answer: b
tp
Explanation: If private functions get accessed even by the parent class that will violate the rules of private members. If the
functions can be accessed then the derived class security is hindered.
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) Ones which are defined in all the classes
Answer: a
nt
Explanation: When there is no type defined for any function and just a simple syntax is used with the return type, function name
ua
and parameter list then those are known as simple member functions. This is a general definition of simple members.
_Q
3. What are static member functions?
a) Functions which use only static data member but can’t be accessed directly
ks
b) Functions which uses static and other data members
c) Functions which can be accessed outside the class with the data members
oo
d) Functions using only static data and can be accessed directly in main() function
_B
Answer: d
Explanation: The static member functions can be accessed directly in the main function. There is no restriction on direct use. We
es
can call them with use of objects also. But the restriction is that the static member functions can only use the static data members
of the class.
ot
_N
4. How can static member function can be accessed directly in main() function?
a) Dot operator
TU
b) Colon
c) Scope resolution operator
d) Arrow operator
K
A
Answer: c
Explanation: The static member functions can be accessed directly in the main() function. The only restriction is that those must
e/
use only static data members of the class. These functions are property of class rather than each object.
t.m
5. Correct syntax to access the static member functions from the main() function is
a) classObject::functionName();
/
s:/
b) className::functionName();
c) className:classObject:functionName();
tp
d) className.classObject:functionName();
ht
Answer: b
Explanation: The syntax in option b must be followed in order to call the static functions directly from the main() function. That is a
predefined syntax. Scope resolution helps to spot the correct function in the correct class.
6. What are const member functions?
a) Functions in which none of the data members can be changed in a program
b) Functions in which only static members can be changed
c) Functions which treat all the data members as constant and doesn’t allow changes
d) Functions which can change only the static members
Answer: c
Explanation: The const member functions are intended to keep the value of all the data members of a class same and doesn’t
allow any changes on them. The data members are treated as constant data and any modification inside the const function is
restricted.
7. Which among the following best describes the inline member functions?
Answer: d
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) void fun() constant {}
c) void const fun() {}
nt
d) const void fun(){}
ua
Answer: a
Explanation: The general syntax to be followed in order to declare a const function in a class is as in option a. The syntax may
_Q
vary in different programming languages.
ks
10. Which keyword is used to make a nonmember function as friend function of a class?
a) friendly
b) new
c) friend
oo
_B
d) connect
es
Answer: c
Explanation: The keyword friend is provided in programming languages to use it whenever a functions is to be made friend of
ot
one class or other. The keyword indicates that the function is capable of new functionalities like accessing private members.
_N
Answer: c
e/
Explanation: The functions definitions can be given inside or outside the body of class. If defined inside, general syntax is used. If
t.m
defined outside then the class name followed by scope resolution operator and then function name must be given for the
definition.
/
s:/
12. All type of member functions can’t be used inside a single class.
a) True
tp
b) False
ht
Answer: b
Explanation: There is no restriction on the use of type of member functions inside a single class. Any type any number of times
can be defined inside a class. The member functions can be used as required.
13. Which among the following is true?
a) Member functions can never be private
b) Member functions can never be protected
c) Member functions can never be public
d) Member functions can be defined in any access specifier
Answer: d
Explanation: The member functions can be defined inside any specifier. There is no restriction. The programmer can apply
restrictions on its use by specifying the access specifier with the functions.
14. Which keyword is used to define the static member functions?
a) static
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) No, main must not be defined inside abstract class
d) No, because main() is not abstract function
nt
Answer: b
ua
Explanation: This is a property of abstract class. It can define main() function inside it. There is no restriction on its definition and
implementation.
_Q
3. If there is an abstract method in a class then,
ks
a) Class must be abstract class
b) Class may or may not be abstract class
c) Class is generic
d) Class must be public
oo
_B
Answer: a
es
Explanation: It is a rule that if a class have even one abstract method, it must be an abstract class. If this rule was not made, the
abstract methods would have got skipped to get defined in some places which are undesirable with the idea of abstract class.
ot
_N
Answer: a
Explanation: Either of the two things must be done, either implementation or declaration of class as abstract. This is done to
e/
ensure that the method intended to be defined by other classes gets defined at every possible class.
t.m
5. Abstract class A has 4 virtual functions. Abstract class B defines only 2 of those member functions as it extends class A.
Class C extends class B and implements the other two member functions of class A. Choose the correct option below.
/
s:/
Answer: c
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Runtime polymorphism
c) Compile time Polymorphism
nt
d) Polymorphism within methods
ua
Answer: b
Explanation: The runtime polymorphism is supported by reference and pointer to an abstract class. This relies upon base class
_Q
pointer and reference to select the proper virtual function.
ks
10. The abstract classes in java can
a) Implement constructors
b) Can’t implement constructor
c) Can implement only unimplemented methods
oo
_B
d) Can’t implement any type of constructor
es
Answer: a
Explanation: The abstract classes in java can define a constructor. Even though instance can’t be created. But in this way, only
ot
during constructor chaining, constructor can be called. When instance of concrete implementation class is created, it’s known as
_N
constructor chaining.
a) True
b) False
K
A
Answer: a
Explanation: If an abstract class is made final in java, it will stop the abstract class from being extended. And if the class is not
e/
getting extended, there won’t be another class to implement the virtual functions. Due to this contradicting fact, it can’t be final in
t.m
java.
12. Can abstract classes have static methods (Java)?
/
s:/
a) Yes, always
b) Yes, but depends on code
tp
c) No, never
d) No, static members can’t have different values
ht
Answer: a
Explanation: There is no restriction on declaring static methods. The only condition is that the virtual functions must have some
definition in the program.
13. It is to have an abstract method.
a) Not mandatory for an static class
b) Not mandatory for a derived class
c) Not mandatory for an abstract class
d) Not mandatory for parent class
Answer: c
Explanation: Derived, parent and static classes can’t have abstract method (We can’t say what type of these classes is). And for
abstract class it’s not mandatory to have abstract method. But if any abstract method is there inside a class, then class must be
abstract type.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) The abstract functions must be defined in base and derived class
d) The abstract functions must be defined either in base or derived class
nt
Answer: a
ua
Explanation: The abstract functions can’t be defined in base class. They are to be defined in derived classes. It is a rule for
abstract functions.
_Q
3. How are abstract functions different from the abstract functions?
ks
a) Abstract must not be defined in base class whereas virtual function can be defined
b) Either of those must be defined in base class
c) Different according to definition
d) Abstract functions are faster
oo
_B
Answer: a
es
Explanation: The abstract functions are only declared in base class. Derived classes have to implement those functions in order
to inherit that base class. The functions are always defined in derived classes only.
ot
_N
Answer: d
Explanation: The abstract function are only declared in base classes and then has to be defined in all the derived classes. This
e/
allows all the derived classes to define own definition of any function whose declaration in base class might be common to all the
t.m
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Derived class should be made abstract class
c) Derived class should not derive from that base class
nt
d) Derived class should not use that function
ua
Answer: b
Explanation: If the function that is not to be defined in derived class but is declared as abstract in base class then the derived
_Q
class must be made an abstract class. This will make the concept mandatory that the derived class must have one subclass to
define that method.
ks
10. Static methods can’t be made abstract in java.
a) True
b) False
oo
_B
Answer: a
es
Explanation: The abstract functions can’t be made static in a program. If those are made static then the function will be a
property of class rather than each object. In turn ever object or derived class must use the common definition given in the base
ot
class. But abstract functions can’t be defined in the base class. Hence not possible.
_N
Answer: c
e/
Explanation: The abstract methods can never be made static. Even if it is in derived class, it can’t be made static. If this
t.m
happens, then all the subsequent sub classes will have a common definition of abstract function which is not desirable.
12. Which among the following is correct for abstract methods?
/
s:/
Answer: a
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Provide more number of features
d) Provide better features
nt
Answer: a
ua
Explanation: It can make programming easy. The programming need not know how the inbuilt functions are working but can use
those complex functions directly in the program. It doesn’t provide more number of features or better features.
_Q
3. Class is abstraction.
ks
a) Object
b) Logical
c) Real
d) Hypothetical
oo
_B
Answer: b
es
Explanation: Class is logical abstraction because it provides a logical structure for all of its objects. It gives an overview of the
features of an object.
ot
_N
4. Object is abstraction.
a) Object
TU
b) Logical
c) Real
d) Hypothetical
K
A
Answer: c
Explanation: Object is real abstraction because it actually contains those features of class. It is the implementation of overview
e/
given by class. Hence the class is logical abstraction and its object is real.
t.m
b) Program complexity
c) Idealized interface
tp
d) Unstable interface
ht
Answer: c
Explanation: It is to idealize the interface. In this way the programmer can use the programming features more efficiently and can
code better. It can’t increase the program complexity, as the feature itself is made to hide it.
6. Abstraction can apply to
a) Control and data
b) Only data
c) Only control
d) Classes
Answer: a
Explanation: Abstraction applies to both. Control abstraction involves use of subroutines and control flow abstraction. Data
abstraction involves handling pieces of data in meaningful ways.
7. Which among the following can be viewed as combination of abstraction of data and code.
a) Class
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: b
Explanation: Higher the level of abstraction, lower are the details. The best way to understand this is to consider a whole system
that is highest level of abstraction as it hides everything inside. And next lower level would contain few of the computer
nt
components and so on.
ua
10. Encapsulation and abstraction differ as
_Q
a) Binding and Hiding respectively
b) Hiding and Binding respectively
ks
c) Can be used any way
d) Hiding and hiding respectively
Answer: a
oo
_B
Explanation: Abstraction is hiding the complex code. For example, we directly use cout object in C++ but we don’t know how is it
actually implemented. Encapsulation is data binding, as in, we try to combine a similar type of data and functions together.
es
Answer: a
K
Explanation: Abstraction is called stream to provide a level of complexity hiding, for how the files operations are actually done.
A
Actual devices are called file because in one way or another, those can be considered as single entity and there is nothing
hidden.
e/
t.m
12. If two classes combine some private data members and provides public member functions to access and manipulate those
data members. Where is abstraction used?
a) Using private access specifier for data members
/
s:/
b) Using class concept with both data members and member functions
c) Using public member functions to access and manipulate the data members
tp
Answer: c
Explanation: It is the concept of hiding program complexity and actual working in background. Hence use of public member
functions illustrates abstraction here.
13. A phone is made up of many components like motherboard, camera, sensors and etc. If the processor represents all the
functioning of phone, display shows the display only, and the phone is represented as a whole. Which among the following have
highest level of abstraction?
a) Motherboard
b) Display
c) Camera
d) Phone
Answer: d
Explanation: Phone as a whole have the highest level of abstraction. This is because the phone being a single unit represents
the whole system. Whereas motherboard, display and camera are its components.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Private and Public together
d) All three together
nt
Answer: d
ua
Explanation: All the classes can use any of the specifiers as needed. There is no restriction on how many of them can be used
together.
_Q
3. Which among the following can restrict class members to get inherited?
ks
a) Private
b) Protected
c) Public
d) All three
oo
_B
Answer: a
es
Explanation: Private members of a class can’t be inherited. These members can only be accessible from members of its own
class only. It is used to secure the data.
ot
_N
4. Which access specifier is used when no access specifier is used with a member of class (java)?
a) Private
TU
b) Default
c) Protected
d) Public
K
A
Answer: b
Explanation: Default access is used if the programmer doesn’t specify the specifier. This acts in a similar way as that of private.
e/
5. Which specifier allows a programmer to make the private members which can be inherited?
a) Private
/
s:/
b) Default
c) Protected
tp
Answer: c
Explanation: Protected access is used to make the members private. But those members can be inherited. This gives both
security and code reuse capability to a program.
6. Which among the following is false?
a) Private members can be accessed using friend functions
b) Member functions can be made private
c) Default members can’t be inherited
d) Public members are accessible from other classes also
Answer: c
Explanation: The default members can be inherited. Provided that they are in same package. It works in a little different way from
private access specifier.
7. If a class has all the private members, which specifier will be used for its implicit constructor?
a) Private
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
8. If class A has add() function with protected access, and few other members in public. Then class B inherits class A privately.
Will the user will not be able to call from the object of class B.
a) Any function of class A
b) The add() function of class A
c) Any member of class A
d) Private, protected and public members of class A
Answer: d
Explanation: Class B object will not be able to call any of the private, protected and public members of class A. It is not only
about the function add(), but all the members of class A will become private members of class B.
9. Which access specifier should be used in a class where the instances can’t be created?
a) Private default constructor
b) All private constructors
um
c) Only default constructor to be public
d) Only default constructor to be protected
nt
Answer: b
ua
Explanation: All the constructors must be made private. This will restrict the instance of class to be made anywhere in the
program. Since the constructors are private, no instance will be able to call them and hence won’t be allocated with any memory
_Q
space.
ks
10. On which specifier’s data, does the size of a class’s object depend?
a) All the data members are added
b) Only private members are added
c) Only public members are added
oo
_B
d) Only default data members are added
es
Answer: a
Explanation: All the data members are counted to calculate the size of an object of a class. The data member access specifier
ot
doesn’t play any role here. Hence all the data size will be added.
_N
11. If class B inherits class A privately. And class B has a friend function. Will the friend function be able to access the private
TU
member of class A?
a) Yes, because friend function can access all the members
b) Yes, because friend function is of class B
K
c) No, because friend function can only access private members of friend class
A
d) No, because friend function can access private member of class A also
e/
Answer: c
t.m
Explanation: The friend function of class B will not be able to access private members of class A. Since B is inheriting class A
privately, the members will become private in class B. But private members of class A won’t be inherited at all. Hence it won’t be
accessible.
/
s:/
13. Which access specifier should be used so that all the parent class members can be inherited and accessed from outside the
class?
a) Private
b) Default or public
c) Protected or private
d) Public
Answer: d
Explanation: All the members must be of public access. So that the members can be inherited easily. Also, the members will be
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Overloaded operator must be member function of either left or right operand
d) Overloaded operator must not be dependent on the operands
nt
Answer: a
ua
Explanation: The operator to be overloaded must be made the member function of the operand on left side of expressions to be
used. This allows the compiler to identify whether the overloading has to be used or not. This rule also reduces the ambiguity in
_Q
code.
ks
3. When the operator to be overloaded becomes the left operand member then
a) The right operand acts as implicit object represented by *this
b) The left operand acts as implicit object represented by *this oo
c) Either right or left operand acts as implicit object represented by *this
_B
d) *this pointer is not applicable in that member function
es
Answer: b
Explanation: The left operand becomes the object that is referred by *this pointer in the member function that will be called while
ot
using operator overloading. This is done to point to a specific object on which the overloading will be applied.
_N
4. If the left operand is pointed by *this pointer, what happens to other operands?
a) Other operands are passed as function return type
TU
Answer: d
e/
Explanation: The operands that are used during overloading expect the left operand, can be passed as function arguments.
t.m
Those are then referred in function definition with the names specified in the argument list.
5. If a friend overloaded operator have to be changed to member overloaded operator, which operator should be used with the
/
s:/
class name?
a) Scope resolution operator
tp
b) Colon
ht
c) Arrow operator
d) Dot operator
Answer: a
Explanation: The scope resolution operator can be used followed by the class name. Then the operator keyword with the
operator symbol that should be overloaded. This is done to use member function instead of friend function.
6. What is the syntax to overload an operator?
a) className::operator<operatorSymbol>(parameters)
b) className:operator<operatorSymbol>(parameters)
c) className.operator<operatorSymbol>(paramteres)
d) className->operator<operatorSymbol>(parameters)
Answer: a
Explanation: The class name is followed by the scope resolution operator. This is done to specify the class to which the function
should belong to. Then the keyword operator should be used in order to indicate the operator that is to be overloaded. Then
come the parameters list to specify other operands.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
9. If left operand member is specified directly in the function definition, which is the correct implicit conversion of that syntax?
a) *this className
b) *this parameterObject
nt
c) *this returnedObject
ua
d) *this object
_Q
Answer: d
Explanation: Since the left operands are passed implicitly, those object members can be accessed directly in the function
ks
definition. The compiler converts the syntax into the syntax that can be processed. The implicitly converted syntax contains *this
pointer followed by the objectName that is left operand in the expression.
oo
10. When the friend operator overloading is converted into member operator overloading
_B
a) Two parameters of friend function remains same parameters in member operator overloading
b) Two parameters of friend function becomes only one parameter of member function
es
c) Two parameters of friend function are removed while using member function
d) Two parameters of friend function are made 4 in member operator overloading
ot
_N
Answer: b
Explanation: The friend function would accept two arguments if some binary operator is overloaded. When we try to convert that
TU
definition to member operator overloading then it becomes only one parameter. The reason behind is that the left operand is
passed implicitly while using the member functions.
K
Explanation: The left operand is passed implicitly by the compiler to the member function. But this is done, when the compiler
adds the calling object as *this to the parameter list. It is always added as the left most parameter, i.e. the first parameter of the
tp
function.
ht
12. Which operator among the following can be overloading using only member function?
a) Assignment operator
b) Addition operator
c) Subtraction operator
d) Multiplication and division operator
Answer: a
Explanation: Only the assignment operator among the options given must be overloaded using the member functions. The
assignment operator can’t be overloaded using friend function. This is a restriction in the programming languages to make the
programs more resistant towards errors.
13. Which operator among the following can be overloaded using both friend function and member function?
a) Assignment operator
b) Subscript
c) Member selection (arrow operator)
d) Modulus operator
14. All the operators can be overloaded using the member function operator overloading.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
operators must be overloaded using friend function because the left operand is object of some other class and the right operand
is usually of some different type.
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Reference to another object is created
d) The new object is initialized to null values
nt
Answer: c
ua
Explanation: The new object created, refers to the same address of the previously created object. Now whenever new object
changes any data member value, it will affect the previously existing object.
_Q
3. How the argument passed to a function get initialized?
ks
a) Assigned using copy constructor at time of passing
b) Copied directly
c) Uses addresses always
d) Doesn’t get initialized
oo
_B
Answer: a
es
Explanation: The arguments get initialized using the copy constructor. There is a need of assigning the value of all the members
of an object to the local object of the function.
ot
_N
class A
TU
{
public int i;
K
};
A
void main()
{
e/
A x;
t.m
A y=x;
x.i=10;
y.i=20;
/
s:/
y.i++;
y.i=20;
tp
cout&l;<tx.i;
ht
}
a) 10
b) 20
c) 21
d) 0
Answer: b
Explanation: The expected output may be 10 because the value of member of object x is printed. But when object x is assigned
to y, y points to the same address where x is stored. So actually both objects x and y point to the same location and refers to the
same object.
5. If programmer doesn’t define any copy assignment operator then
a) Compiler gives an error
b) Program fails at run time
c) Compiler gives an implicit definition
d) Compiler can’t copy the member values
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
error. To reduce that, we use const argument in definition, so that both const and non – const objects are accepted.
8. How many objects can be assigned to a single address?
nt
a) Only 1
ua
b) At most 7
c) At most 3
_Q
d) As many as required
ks
Answer: d
Explanation: The memory address can be referenced by more than one object. There is no maximum number defined. Any
number of objects can reference to the same address. oo
_B
9. Use of assignment operator
a) Changes its use, when used at declaration and in normal assignment
es
Answer: a
TU
Explanation: The assignment operator if used at declaration then it uses copy constructor for the copying of objects. If used in
simple assignment syntax then it uses copy assignment function.
K
10. If more than one object refer to the same address, any changes made
A
Explanation: At a memory address, only one object can be referenced. All the other objects which refer to the same memory
address make changes for all of the objects referring that address.
tp
11. How to make more than one object refer to the same object?
ht
a) Initialize it to null
b) Initialize the object with another at declaration
c) Use constructor to create new object
d) Assign the address directly
Answer: b
Explanation: The object must get initialized with another object at time of declaration only. We don’t have to create a new object
we just have to get name of new object because there after same address will be referred.
12. We can assign
a) Value of one reference variable to another
b) Value of any object to another
c) Value of any type to any object
d) Value of non – reference to another reference
Answer: a
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
15. Assigning objects takes place while passing the arguments.
a) True
nt
b) False
ua
Answer: b
_Q
Explanation: The actual assignment doesn’t take place as the object might have got passed by reference. Also even if not by
reference, the copy constructor is called to copy the values into the new object and not exactly the assignment operator.
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Is never actually allocated
d) Are never safe
nt
Answer: b
ua
Explanation: The memory is allocated and deallocated automatically for the automatic variables. As soon as the variable comes
in scope, the memory is allocated. The variables are destroyed as soon as those go out of scope.
_Q
3. Scope of an automatic variable
ks
a) Is actually the whole program
b) Is actually never fixed
c) Is always equal to the whole program execution
d) Is actually function or block in which it is defined
oo
_B
Answer: d
es
Explanation: The automatic variables scope is limited only within the block or the function where those are defined. This is the
property of all the automatic variables.
ot
_N
Answer: a
Explanation: The automatic variables are hidden from the called function. Even if passed by reference or address, the address
e/
of the variable is used and not the actual variable of calling function. Automatic variables can be const or variable.
t.m
Answer: b
Explanation: The automatic variables are saved till the called function gets executed. This is done so as to ensure that the
program can continue its execution after the called function is returned. The automatic variables gets destroyed only if those go
out of scope.
6. Where are the automatic variables stored if another function is called in between the execution of the program?
a) Heap
b) Queue
c) Stack
d) Temp variable
Answer: c
Explanation: All the automatic variables are stored in a new stack entry as soon as their scope is created. If another function is
called, the present data is saved in stack and new entry in stack is made for the called function. When the function returns, the
automatic variables are used again from where those were left.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
a) Null value
b) Void value
nt
c) Undefined/Garbage
d) Zero value
ua
Answer: c
_Q
Explanation: The automatic variable which are not initialized, contain garbage value. If we just declare a variable and try to print
its value, the result is some unknown value. The value is garbage as that was not expected value.
ks
10. Constructor of automatic variables is called
oo
a) When execution reaches the place of declaration of automatic variables
b) When the program is compiled
_B
c) When the execution is just started
d) Just before the execution of the program
es
Answer: a
ot
Explanation: Only when the execution reaches the place where the automatic variable was declared, the constructor is called.
_N
This is to ensure that the memory is not allocated if not needed. The memory is allocated and then destroyed as soon as it goes
out of scope.
TU
Answer: d
Explanation: The auto and register keywords are not supported in java. Though the same is allowed in java without specifying
any of those keywords. The variables are local variables. But java makes it mandatory to initialize all of the local variables in a
/
s:/
program.
tp
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Super
d) Sub
nt
Answer: c
ua
Explanation: A class which is being derived by other classes, is called as super class. This concept is clearly used in java as we
call the functions of a base class by using the keyword super as required.
_Q
3. An abstract class is always a class.
ks
a) Base
b) Derived
c) Template
d) Nested
oo
_B
Answer: a
es
Explanation: Every abstract class is a base class. It must be so, because the functions which are not defined inside the abstract
class, must be defined in the derived classes. Hence it becomes a base class.
ot
_N
b) 2
c) 3
d) As many as required
K
A
Answer: a
Explanation: In java, multiple inheritance is not supported, which leads to the fact that a class can have only 1 parent class if
e/
inheritance is used. Only if interfaces are used then the class can implement more than one base class.
t.m
d) Can’t be done
ht
Answer: c
Explanation: Making another class derive from it will make that class as base class. It is not necessary that we have to write
different code for it. If at least one class derives that class, it becomes the base class for the new class.
6. If a base class is being derived by two other classes, which inheritance will that be called?
a) Single
b) Multiple
c) Multi-level
d) Hierarchical
Answer: d
Explanation: When more than one classes are being derived from a single parent class, the inheritance is known as hierarchical
inheritance. This is usually useful when the base class is higher abstraction of its derived classes.
7. Which among the following must be in a base class?
a) Data members
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
Answer: b
Explanation: When a class have more than one nested classes, it is known as enclosing class. It can’t be called as parent or
base class since there is no inheritance involved.
nt
ua
10. Base class have of abstraction.
a) Higher degree
_Q
b) Lower degree
c) Intermediate
ks
d) Minimum degree
Answer: b oo
Explanation: A base class will have lesser information as compared to those of derived classes. Since derived classes inherit
_B
the base class properties and then add on their own features, they elaborate more hence have lower degree of abstraction.
es
11. Always the base class constructors are called constructor of derived class.
a) Before
ot
b) After
_N
c) Along
d) According to priority of
TU
Answer: a
Explanation: When the base class object is created, its constructor will be called for sure. But if a derived class constructor is
K
called, first base class constructor is called and then derived class constructor is taken into consideration.
A
12. Can we call methods of base class using the constructor of the derived class?
e/
a) Yes, always
t.m
Answer: a
tp
Explanation: If the function is defined in the base class, it can always be called from the constructor of its derived class. Since the
constructors are not private, they can be accessed in derived class even if those are protected.
ht
13. If a base class is inherited from another class and then one class derives it, which inheritance is shown?
a) Multiple
b) Single
c) Hierarchical
d) Multi-level
Answer: d
Explanation: If a base class is inherited from another class, single inheritance is shown. But when one more class inherits the
derived class, this becomes a multi-level inheritance.
14. How many base classes can a single derived class have in C++?
a) 1
b) 2
c) 3
d) As many as required
15. If a base class is added with a few new members, its subclass must also be modified.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Variable declaration can’t be done more than ones
d) Variable declaration is always done more than one time
nt
Answer: a
ua
Explanation: The variables can be declared any number of times. There is no restriction on how many times a single variables
can be declared. Declaration is just an indication that the variable will be used in the program.
_Q
3. Which among the following is true for the variables?
ks
a) Variable can be defined only once
b) Variable can be defined any number of times
c) Variable must be defined more than one time
d) Variable can be defined in different files
oo
_B
Answer: a
es
Explanation: The variables can be defined only once. Once the variable is defined, then it can’t be declared again. The definition
of a variable is actual allocation of memory for the variable.
ot
_N
Answer: c
Explanation: The source file must be included in the file which needs to use the extern variable. This is done to ensure that the
e/
variables that are already declared can be used again. Only the declarations are used from one file to another.
t.m
Answer: a
Explanation: The header file only contains the declaration of variables that are extern. It doesn’t contain any static variable
definitions.
6. Which condition is true if the extern variable is used in a file?
a) All the header files declare it
b) Only few required files declare it
c) All header files declared it if required
d) Only one header file should declare it
Answer: d
Explanation: Only one header file should declare the extern variable to be used. There must not be more than one file declaring
the same extern variable. This is to ensure that there is no ambiguity in using the extern variable.
7. Whenever a function is declared in a program
a) extern can be used only in some special cases
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: b
Explanation: The memory for the extern variables are allocated due to their definition. When the variables are declared, it only
nt
indicates the compiler that the variable is going to be used somewhere. But definition makes the compiler to allocate the
ua
memory for the variables.
_Q
10. Which is the correct syntax for extern variable declaration?
a) extern data_type variable_name;
ks
b) extern variable_name;
c) data_type variable_name extern;
d) extern (data_type)variable_name; oo
_B
Answer: a
Explanation: The syntax firstly contains the keyword extern. Then the data type of the variable is given. Then the variabel name is
es
a) extern function_name(argument_list);
b) extern return_type function_name(argument_list);
c) extern (return_type)function_name(argument_list);
TU
Answer: b
A
Explanation: The syntax must contain the keyword extern first, to denote that the function is extern. Though the function are extern
by default but among the given choices, it should contain the keyword, for explicit declaration. Then the usual function declaration
e/
follows.
t.m
{
var = 10;
ht
var++;
cout<<var;
}
a) 10
b) 11
c) Run time error
d) Compile time error
Answer: d
Explanation: The program gives the compiler time error. There is no definition given for the extern variables. This is not allowed
and hence we get a compile time error.
13. If the definition is given in the header file that we include then
a) The program can run successfully
b) Also the program should define the extern variable
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: a
Explanation: The program have all of its functions visible throughout the program usually. Also, there is no specific value that a
nt
function must contain. Hence the functions are extern by default.
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Then catch block of base and derived classes doesn’t matter
d) Then catch block of base and derived classes are not mandatory to be defined
nt
Answer: a
ua
Explanation: It is a condition for writing the catch blocks for base and derived classes. It is mandatory to write derived class
catch block first because the errors produced by the derived class must be handled first.
_Q
3. Which among the following is true?
ks
a) If catch block of base class is written first, it is compile time error
b) If catch block of base class is written first, it is run time error
oo
c) If catch block of base class is written first, derived class catch block can’t be reached
d) If catch block of base class is written first, only derived class catch block is executed
_B
Answer: c
es
Explanation: If the catch block of the base class is defined first and then the derived class catch block is given. The code
becomes unreachable. Hence the derived class catch block must be written first.
ot
_N
Answer: b
Explanation: The catching of base class exception before derived class is not allowed in java. The compiler itself doesn’t allow
e/
Answer: c
Explanation: The compiler in C++ doesn’t identify this as compile time error and allows the execution of the program. But, the
compiler may give some warning related to the catch block sequence or code unreachable.
6. How many catch blocks can a class have?
a) Only 1
b) 2
c) 3
d) As many as required
Answer: d
Explanation: There are many type of exceptions that may arise while running a code. And each catch block can handle only one
exception. Hence there can be as many catch blocks as required.
7. Since which version of java is multiple exception catch was made possible?
a) Java 4
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) The catch parameters are not used
Answer: b
nt
Explanation: The catch parameters are made final. This is to ensure that the parameters are not changed inside the catch block.
ua
Hence those retain their values.
_Q
10. Which among the following handles the undefined class in program?
a) ClassNotFound
ks
b) NoClassException
c) ClassFoundException
d) ClassNotFoundException oo
_B
Answer: d
Explanation: It is the exception handler that handles the exceptions when the class used is not found in the program. This is done
es
to handle all the undefined class exceptions. This can be due to a command line error.
ot
Answer: a
A
Explanation: The catch blocks must be defined. This is to ensure that all the exceptions related to the classes are handled by the
program code and the program doesn’t terminate unexpectedly.
e/
t.m
c) Both the base and derived class catch blocks are important
d) If base and derived classes both produce exceptions, program doesn’t run
tp
Answer: c
ht
Explanation: The purpose of exception handling is to handle the unexpected errors in the program. If base class might produce
some error then its catch block must be given and if the derived class might produce some error then it must be given a specific
catch block too.
13. Which is the necessary condition to define the base and derived class catch blocks?
a) Base class catch should be defined first
b) Derived class catch should be defined first
c) Catch block for both the classes must not be defined
d) Catch block must be defined inside main function
Answer: b
Explanation: The derived class catch blocks must be defined prior to the base class catch block. This is to ensure that all the
catch boxes are reachable. If not done, the code might become unreachable which in turn makes the program prone to errors.
14. Only the base class catch box can handle more than one exception in single block.
a) True
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Function
d) Object
nt
Answer: a
ua
Explanation: A class can be used to group all the brands of cars. The Different brands may have different properties but all will
have some common properties like number of wheels and doors, accessories etc. All of those properties can be grouped into a
_Q
single class representing all the cars.
ks
3. If a class have two data members and two functions to add those two numbers and to subtract them, which among the
following is most efficient if the programmer wants to implement multiplication too?
a) Define a public function which multiplies two numbers
b) Define a public function that returns values of two data members
oo
_B
c) Define a private function which multiplies two numbers
d) Define a private function that returns values of two data members
es
Answer: b
ot
Explanation: The best choice would be to define a public member function that returns the values of two data members of the
_N
class. This way we can implement any operation on those data members. Also there won’t be any need to modify the program
and to add new functions for each new operation.
TU
4. If a database have to be maintained using OOP, to store the details of each employee in a company, which would be the best
choice among the following?
K
Answer: a
Explanation: A single class can be defined that represents a single employee of a company. The specific type of functions that
/
s:/
can be applied to specific employees can be put into another class that is derived from the existing class.
tp
b) Derived
c) Enclosed
d) Base
Answer: d
Explanation: The base classes are the most abstracted part of information. A base class having many other derived classes
would have a bigger overview of all the other derived classes. Hence the base classes have the most abstract information.
6. Which among the following is an advantage of using classes over structures of C?
a) Functions are restricted
b) Functions can’t be defined
c) Functions can also be encapsulated
d) Functions can have more security
Answer: c
Explanation: The functions are also made easy to be encapsulated inside a class. In structures, only the data members were
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
9. In which case the classes can be used to make the more efficient program?
a) To define a function that is called frequently in a program
nt
b) To structure data that is most similar
ua
c) To group the most similar data and operations
d) To define a blueprint that shows memory location of data
_Q
Answer: c
ks
Explanation: The classes would be more suitable to use in case where we need to group the most similar data and operations.
The data can be represented as data members of class and operations as member functions of class. This is indirectly
encapsulation feature. oo
_B
10. What is the use of inbuilt classes?
a) Provide predefined data
es
Answer: c
TU
Explanation: The data that is constant or is always the same initially for use can be provided by some inbuilt classes. The
functions that are mostly used are also provided by the inbuilt classes. The data and functions can be used by including the
corresponding header file or library.
K
A
b) Code efficiency
t.m
c) Code readability
d) Code reusability, efficiency and readability
/
s:/
Answer: d
Explanation: The code is reusable as the functions which are already written, can be used anytime required. The code becomes
tp
easier to read. Also, the code is efficient as there is no need to assign any external code.
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Explanation: The most abstract class is class Cars. The class Cars is the most general form of all other cars. If it is a brand of
car, it comes under car. If it is the type of car then also it comes under Cars.
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Value or Reference, depending on program
d) Copy
nt
Answer: b
ua
Explanation: Classes are pass by reference, and the structures are pass by copy. It doesn’t depend on the program.
_Q
3. What is default access specifier for data members or member functions declared within a class without any specifier, in C++?
a) Private
ks
b) Protected
c) Public
d) Depends on compiler oo
_B
Answer: a
Explanation: The data members and member functions are Private by default in C++ classes, if none of the access specifier is
es
class Student
{
TU
int a;
public : float a;
K
};
A
Answer: a
Explanation: Same variable can’t be defined twice in same scope. Even if the data types are different, variable name must be
tp
different. There is no rule like Public member should come first or last.
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
provided to use when you need to reuse the data of a class but don’t want that class to have those special functions.
9. What is the scope of a class nested inside another class?
nt
a) Protected scope
ua
b) Private scope
c) Global scope
_Q
d) Depends on access specifier and inheritance used
ks
Answer: d
Explanation: It depends on the access specifier and the type of inheritance used with the class, because if the class is inherited
oo
then the nested class can be used by subclass too, provided it’s not of private type.
_B
10. Class with main() function can be inherited.
a) True
es
b) False
ot
Answer: a
_N
Explanation: The class containing main function can be inherited and hence the program can be executed using the derived
class names also in java.
TU
11. Which among the following is false, for a member function of a class?
a) All member functions must be defined
K
Answer: c
Explanation: Member functions must be declared inside class body, though the definition can be given outside the class body.
There is no way to declare the member functions outside the class.
/
s:/
a) class student{ };
b) student class{ };
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
2. If a constructors should be capable of creating objects without argument and with arguments, which is a good alternative for
this purpose?
a) Use zero argument constructor
um
b) Use constructor with one parameter
c) Use constructor with all default arguments
nt
d) Use default constructor
ua
Answer: c
Explanation: The constructor should use all the default arguments. This will allow the constructor to be called even if no
_Q
arguments are passed. And if arguments are passed, those will be accepted instead of the default values.
ks
3. The Constructors with all the default arguments are similar as default constructors.
a) True
b) False oo
_B
Answer: a
Explanation: The constructors with all the default arguments are similar as the default constructors. Those can be used instead of
es
Answer: d
A
Explanation: The constructors must have the same name as that of the class name. This is mandatory because only the
constructor functions doesn’t have any return type. Also, for overloading all the functions must have the same name.
e/
t.m
Answer: b
ht
Explanation: For a parameterized constructor to be used as a default constructor, it must have all the default arguments. This
makes the constructor to have optional arguments which are not mandatory to be passed.
6. Can a class have more than one function with all the default arguments?
a) Yes, always
b) Yes, if argument list is different
c) No, because constructors overloading doesn’t depend on argument list
d) No, never
Answer: d
Explanation: A single class can never have more than once constructor with all the default arguments. This is because it will
make all those constructors as a default constructor. And when an object is created with zero arguments then it will create
ambiguity.
7. Which is the correct syntax for using default arguments with the constructor?
a) default constructorName(default int x=0)
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
8. How many parameters must be passed if only the following prototype is given to a constructor?
Prototype: className(int x, int y, int z=0);
a) 1
b) 2
c) 3
d) Compile time error
Answer: b
Explanation: In the prototype given, only 2 arguments are mandatory. Since the third argument is default argument, so it is not
mandatory to pass the argument.
9. If the constructors are overloaded by using the default arguments, which problem may arise?
a) The constructors might have all the same arguments except the default arguments
b) The constructors might have same return type
um
c) The constructors might have same number of arguments
d) The constructors can’t be overloaded with respect to default arguments
nt
Answer: a
ua
Explanation: The constructors having same arguments except the default arguments can give rise to errors. If only the mandatory
arguments are passed, it will create ambiguity in calling the correct constructor. Hence the mandatory arguments must be
_Q
different.
ks
10. Which among the following is true?
a) More than one constructors with all default arguments is allowed
oo
b) More than one constructors with all default arguments can be defined outside the class
c) More than one constructors can be used with same argument list
_B
d) More than one constructors with all default arguments can’t exist in same class
es
Answer: d
Explanation: The constructors must have different argument list. Along that, if all the arguments are default arguments, there can’t
ot
be more than once constructor like that in the same class as that will create ambiguity while constructors are being called.
_N
11. Which constructor among the following will be called if a call is made like className(5,’a’);?
a) className(int x=5,char c=’a’);
TU
Answer: a
e/
Explanation: The syntax given is passing two parameters to the constructor call. One value is of integer type and another of
t.m
character type. Hence the constructor with arguments of int and char type should be called. There is only one option that first
accepts integer value and then a character value. Hence that constructor will be called.
/
s:/
b) className(char c);
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
15. Which is a good alternative instead of having one zero argument constructor and one single argument constructor with
default argument?
a) No constructor defined
b) One default value constructor
c) Defining the default constructor
d) Using one constructor with two arguments
Answer: b
Explanation: The constructor with one default argument can be the best alternative. This is because the constructor with one
default value will do the work for both the default constructor and one argument constructor.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) It must not have any return type
c) It must contain a definition body
nt
d) It can contains arguments
ua
Answer: c
Explanation: Constructors are predefined implicitly, even if the programmer doesn’t define any of them. Even if the programmer
_Q
declares a constructor, it’s not necessary that it must contain some definition.
ks
3. Which among the following is correct?
a) class student{ public: int student(){} };
b) class student{ public: void student (){} };
c) class student{ public: student{}{} };
oo
_B
d) class student{ public: student(){} };
es
Answer: d
Explanation: The constructors must not have any return type. Also, the body may or may not contain any body. Defining default
ot
4. In which access should a constructor be defined, so that object of the class can be created in any function?
a) Public
TU
b) Protected
c) Private
K
Answer: a
e/
Explanation: Constructor function should be available to all the parts of program where the object is to be created. Hence it is
t.m
advised to define it in public access, so that any other function is able to create objects.
5. How many types of constructors are available for use in general (with respect to parameters)?
/
s:/
a) 2
b) 3
tp
c) 4
ht
d) 5
Answer: a
Explanation: Two types of constructors are defined generally, namely, default constructor and parameterized constructor. Default
constructor is not necessary to be defined always.
6. If a programmer defines a class and defines a default value parameterized constructor inside it.
He has not defined any default constructor. And then he try to create the object without passing arguments, which among the
following will be correct?
a) It will not create the object (as parameterized constructor is used)
b) It will create the object (as the default arguments are passed)
c) It will not create the object (as the default constructor is not defined)
d) It will create the object (as at least some constructor is defined)
Answer: b
Explanation: It will create the object without any problem, because the default arguments use the default value if no value is
passed. Hence it is equal to default constructor with zero parameters. But it will not create the object if signature doesn’t match.
Answer: a
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
8. If class C inherits class B. And B has inherited class A. Then while creating the object of class C, what will be the sequence of
constructors getting called?
a) Constructor of C then B, finally of A
b) Constructor of A then C, finally of B
c) Constructor of C then A, finally B
d) Constructor of A then B, finally C
Answer: d
Explanation: While creating the object of class C, its constructor would be called by default. But, if the class is inheriting some
other class, firstly the parent class constructor will be called so that all the data is initialized that is being inherited.
9. In multiple inheritance, if class C inherits two classes A and B as follows, which class constructor will be called first?
um
class A{ };
class B{ };
class C: public A, public B{ };
nt
ua
a) A()
b) B()
_Q
c) C()
d) Can’t be determined
ks
Answer: a
oo
Explanation: Constructor of class A will be called first. This is because the constructors in multiple inheritance are called in the
sequence in which they are written to be inherited. Here A is written first, hence it is called first.
_B
10. Which among the following is true for copy constructor?
es
Explanation: It can’t be defined with zero number of arguments. This is because to copy one object to another, the object must be
mentioned so that compiler can take values from that object.
K
Answer: c
Explanation: Compiler runs out of memory. This is because while passing the argument by value, a constructor of the object will
tp
be called. That in turn called another object constructor for values, and this goes on. This is like a constructor call to itself, and
this goes on infinite times, hence it must be passed by reference, so that the constructor is not called.
ht
class student
{
int marks;
};
student s1, s2, s3;
a) s1 then s2 then s3
b) s3 then s2 then s1
c) s2 then s3 then s1
d) all are created at same time
Answer: a
Explanation: The objects are created in the sequence of how they are written. This happens because the constructors are called
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
14. Which among the following is correct for the class defined below?
class student
{
int marks;
public: student(){}
student(int x)
{
marks=x;
}
um
};
main()
nt
{
student s1(100);
ua
student s2();
student s3=100;
_Q
return 0;
}
ks
a) Object s3, syntax error
b) Only object s1 and s2 will be created
c) Program runs and all objects are created
oo
_B
d) Program will give compile time error
es
Answer: c
ot
Explanation: It is a special case of constructor with only 1 argument. While calling a constructor with one argument, you are
actually implicitly creating a conversion from the argument type to the type of class. Hence you can directly specify the value of
_N
Answer: a
t.m
Explanation: Each constructor must differ in the number of arguments it accepts and the type of arguments. This actually defines
the constructor signature. This helps to remove the ambiguity and define a unique constructor as required.
/
s:/
tp
ht
um
b) Can be initialized only with help of constructors
c) Can be initialized either in declaration or by constructor
d) Can’t be initialized
nt
ua
Answer: b
Explanation: The data members are not property of class, those are property of the instances of the class. And the memory for
_Q
the data members are not reserved until a constructor is called. Hence we use constructors for their initialization after the
memory is reserved.
ks
3. Which among the following is true for data members?
a) Private data members can be initialized with declaration in class
b) Static members are initialized in constructors
oo
_B
c) Protected data members can be initialized in class directly
d) Static data members are defined outside class, not in constructor
es
Answer: d
ot
Explanation: Static members are not property of instances of classes. Those are shared by all the object of classes. Hence
_N
those are defined outside the constructor, so as to make them common for all the objects.
TU
4. What should be done for data member to be of user defined structure type?
a) The structure must have been defined before class.
b) The structure must have been defined after the class definition
K
Answer: a
t.m
Explanation: The structure must have been defined prior to its use. If the structure is not defined, then the memory space will not
be allocated for its members. This leads to undefined use of new data types.
/
s:/
b) 255
ht
c) 1024
d) As many as required
Answer: d
Explanation: Any class can have as many data members as required. The only restriction that may arise is when there is not
enough memory space. This gives flexibility to define a class with best properties possible.
6. How to access data members of a class?
a) Dot operator
b) Arrow operator
c) Dot or arrow as required
d) Dot, arrow or direct call
Answer: c
Explanation: The data members can never be called directly. Dot operator is used to access the members with help of object of
class. Arrow is usually used if pointers are used.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
int n=10; // global
class A()
nt
{
ua
private : int n;
public : int m;
_Q
A()
{
ks
n=100; m=50;
}
void disp()
{
oo
_B
cout<<”n”<<m<<n;
};
es
ot
a) 1050100
b) 1005010
_N
c) n5010
d) n50100
TU
Answer: d
Explanation: In cout we have specified n as a string to be printed. And m is a variable so its value gets printed. And global
K
variable will not be used since local variable have more preference.
A
Answer: a
tp
Explanation: The static member functions can only access static data members. This is because the static member function
ht
can’t work with the properties that change object to object. It is mandatory that only the common properties of all the objects be
used. And only static data members are common to all as those are property of class.
11. A class can have self-referential data members.
a) True
b) False
Answer: b
Explanation: The data members in a class can never refer to own class type. This is not possible because the data members
should have some memory allocated for its object before the self-reference is used, but class must call constructor for that.
Hence not possible.
12. What is the keyword used to make data members have same value?
a) static
b) const
c) double
d) abstract
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
is passed by reference it would be the same variable that is outside the class. Hence it can’t be considered class member.
15. Which among the following is not allowed for data member declaration?
nt
a) int a;
ua
b) static int a;
c) abstract a;
_Q
d) Boolean a;
ks
Answer: c
Explanation: The abstract keyword in the declaration of data members is not allowed. This is because the abstract keyword
oo
features can’t be used with the data members of the class. We can have all other syntax given, but not abstract.
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Those can be defined anywhere in the argument list
d) Those are declared inside the function definition
nt
Answer: a
ua
Explanation: The default arguments must be declared at last in the argument list. This is to ensure that the arguments doesn’t
create ambiguity. The normal arguments should be passed first.
_Q
3. If a member function have to be made both zero argument and parameterized constructor, which among the following can be
ks
the best option?
a) Two normal and one default argument
b) At least one default argument
c) Exactly one default argument
oo
_B
d) Make all the arguments default
es
Answer: d
Explanation: All the arguments must be made default. This will make sure that none of the arguments are mandatory to be
ot
passed. Which in turn means that the function can work without any argument and can be passed with arguments too.
_N
b) void add(int=0)
c) void add(int x=0, int y=0)
K
d) void add(char c)
A
Answer: c
e/
Explanation: For the function to be called without arguments, either it must have zero arguments or it must have all the default
t.m
arguments. Here the function in option void add(int x=0, int y=0) have all the default arguments and hence can be called directly
with zero argument.
/
s:/
5. If a function have all the default arguments but still some values are passed to the function then
a) The function will use the values passed to it
tp
b) The function will use the default values as those are local
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
8. Which among the following is a wrong call to the function void test(int x, int y=0, int z=0)?
a) test(5,6,7);
b) test(5);
c) test();
d) test(5,6);
Answer: c
Explanation: The function must be passed with at least one argument. There is two default arguments and one normal argument
which must be passed with some value. Hence the third call to the function is wrong as it doesn’t pass even a single parameter
um
to the function
9. Default arguments are
nt
a) Only allowed in the parameter list of the function declaration
ua
b) Only allowed in the return type of the function declaration
c) Only allowed with the class name definition
_Q
d) Only allowed with the integer type values
ks
Answer: a
Explanation: The default arguments are only allowed in the parameter list of the function arguments. This rule was not applicable
oo
in the beginning versions of c++ but later from c++ 14th version it has been implemented. This is the only way to use default
arguments.
_B
10. Which among the following is false for default arguments?
es
Explanation: The statements given are true because that is a feature given to make the programming more flexible and have
some security with accidental changes at same time. The last option is false because it is not a rule defined. It is an opposite
K
11. The non-template functions can be added with default arguments to already declared functions
e/
b) If and only if the function is declared only once in the same scope
c) If and only if the function is declared in different scope
d) If and only if the function is declared twice in the program
/
s:/
Answer: a
tp
Explanation: The non-template functions can also be added with default arguments. This can be done even if the functions were
defined earlier. This is because the call to the function won’t be affected. The function can still be used in the same way as it was
ht
used earlier.
12. The using declaration
a) Doesn’t carry over the default values
b) Carries over the known default arguments
c) Carries over only the normal arguments
d) Carries over only few default arguments
Answer: b
Explanation: The using-declaration carries over all the known default arguments. This is a common feature as the usage doesn’t
gets affected even if the default arguments are added. This comes under flexible programming.
13. The names given to the default arguments are only looked up and and are bound during declaration.
a) Checked for availability
b) Checked for random access
c) Checked for accessibility
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: a
Explanation: The virtual function overrides do not acquire the base class declaration of default arguments. Even if a call to the
nt
virtual function is made, static type of the object decides the default arguments to be used.
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) It can’t be deleted using delete operator
c) It may or may not be deleted using delete operator
nt
d) The delete operator is not applicable
ua
Answer: a
Explanation: The new operator allocates an object in memory and hence the memory allocation is bit different from usual
_Q
allocation of an object. The delete operator can be used to delete the memory allocated for an object.
ks
3. Does delete return any value?
a) Yes, positive value
b) Yes, negative value
c) Yes, zero value
oo
_B
d) No
es
Answer: d
Explanation: The delete operator doesn’t return any value. Its function is to delete the memory allocated for an object. This is
ot
b) void pointer
c) null pointer
K
d) null
A
Answer: a
e/
Explanation: The result of the delete operator is void. The values returned is of no use to the program or any other system
t.m
function hence the return type is not defined for the delete operator.
5. If delete is used to delete an object which was not allocated using new
/
s:/
Answer: b
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Only 3
d) Only 4
nt
Answer: b
ua
Explanation: There are two variants of delete operator. One is for object deletion. Other is for deletion of object array.
_Q
10. Which is the correct syntax to delete a single object?
a) delete *objectName;
ks
b) objectName delete;
c) delete objectName;
d) objectName *delete; oo
_B
Answer: c
Explanation: The object to be deleted is mentioned after the keyword delete. This deletes the object from memory and free up
es
a) delete [] objectName;
b) delete * objectName;
TU
c) objectName[] delete;
d) delete objectName[];
K
Answer: a
A
Explanation: The object array that has to be deleted is mentioned after the keyword delete. But after delete, empty square
brackets have to be given to denote that the deletion have to be done on array of objects.
e/
t.m
12. Which cases among the following produces the undefined result?
a) delete [] on an independent object
b) delete on an object array
/
s:/
Answer: c
ht
Explanation: The undefined result is always produced when we try to use delete [] with a single object. Because the type of
deletion mismatches. Same in case where we try to apply delete to an object array.
13. The delete operator
a) Invokes function operator delete
b) Invokes function defined by user to delete
c) Invokes function defined in global scope to delete object
d) Doesn’t invoke any function
Answer: a
Explanation: The delete operator invokes the function operator delete. This function in turn performs all the delete operations on
the mentioned object. This is ensures safe deletion.
14. For objects that are not of class type
a) Global delete operator is invoked
b) Local delete operator is invoked
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) All the members except private members
d) All the members of base class
nt
Answer: c
ua
Explanation: The class inheriting another class, inherits all the data members and member functions that are not private. This is
done to ensure the security features with maximum flexibility.
_Q
3. If there is a derived class in a program, how many classes must be in that program?
ks
a) 1
b) 2
c) 3
d) 4
oo
_B
Answer: b
es
Explanation: If there is a derived class in a program, there must be at least 2 classes in that program. One is a base class and
another derived class. Hence at least 2 classes must be there.
ot
_N
4. Which members can never be accessed in derived class from the base class?
a) Private
TU
b) Protected
c) Public
d) All except private
K
A
Answer: d
Explanation: There is no restriction for a derived class to access the members of the base class until and unless the members
e/
are private. Private member are declared so that those members are not accessible outside the class.
t.m
5. How many types of inheritance are supported in C++ for deriving a class?
a) 1
/
s:/
b) 2
c) 3
tp
d) 4
ht
Answer: c
Explanation: There are three types of inheritance possible. Private inheritance, protected inheritance, and public inheritance. The
inheritance defines the access specifier to be used with the inherited members in the derived class.
6. How many derived class can a single base class have?
a) 1
b) 2
c) 3
d) As many are required
Answer: d
Explanation: There is no restriction on how many classes can inherit a single base class. Hence there can be as many derived
classes as required in a program from a single base class.
7. Which among the following is correct?
a) Friend function of derived class can access non-private members of base class
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Big class
d) Noticeable class
nt
Answer: a
ua
Explanation: It is just another name given to the derived classes. This is used while denoting all the derived classes subsequent
to a superclass.
_Q
10. If class A is derived from another derived class B which is derived from class C, which class will have maximum level of
ks
abstraction?
a) Class A
b) Class B
c) Class C
oo
_B
d) All have the same level of abstraction
es
Answer: c
Explanation: The abstraction level of class C will be maximum. This is because the parent class have higher level of abstraction.
ot
Hence the parent of all other class will have maximum level of abstraction.
_N
11. If base class is an abstract class then derived class the undefined functions.
a) Must define
TU
Answer: b
e/
Explanation: The function must be defined in the program which are not defined in the base class. Hence the class must be
t.m
a) Only 1
b) At most 1
tp
c) At least 1
ht
d) As many as required
Answer: d
Explanation: When a class is to be derived from another derived class, the derived class behaves as a normal base class hence
there are no restriction on how many class can be derived from a derived class. The derived class again behaves as a normal
superclass.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
15. Deriving a class in such a way that that the base class members are not available for further inheritance is known as
a) Public inheritance
b) Protected inheritance
c) Protected or private inheritance
d) Private inheritance
Answer: d
Explanation: The private members of a class can never be derived to another class. When a class derives another class using
private inheritance, all the members become private members of the derived class. Hence these member won’t be available for
further inheritance.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) At end of whole program
d) Just before the end of object life
nt
Answer: d
ua
Explanation: The destructor is called just before the object go out of scope or just before its life ends. This is done to ensure that
all the resources reserved for the object are used and at last, are made free for others.
_Q
3. Which among the following is correct for abstract class destructors?
ks
a) It doesn’t have destructors
b) It has destructors
c) It may or may not have destructors
d) It contains an implicit destructor
oo
_B
Answer: a
es
Explanation: It doesn’t have destructors. Since an abstract class don’t have constructors, and hence can’t have instances.
Having this case, the abstract classes don’t have destructors too, because that would be of no use here.
ot
_N
4. If in multiple inheritance, class C inherits class B, and Class B inherits class A. In which sequence are their destructors called
if an object of class C was declared?
a) ~C() then ~B() then ~A()
TU
Answer: a
e/
Explanation: The destructors are always called in the reverse order of how the constructors were called. Here class A constructor
t.m
would have been created first if Class C object is declared. Hence class A destructor is called at last.
5. Choose the correct sequence of destructors being called for the following code.
/
s:/
class A{ };
tp
class B{ };
class C: public A, public B{ };
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
9. Destructors can be
a) Abstract type
nt
b) Virtual
ua
c) Void
d) Any type depending on situation
_Q
Answer: b
ks
Explanation: The destructors can be virtual. It is actually advised to keep the destructors virtual always. This is done to suppress
the problems that may arise if inheritance is involved.
10. Global destructors execute in
oo
order after main function is terminated.
_B
a) Sequential
b) Random
es
c) Reverse
d) Depending on priority
ot
_N
Answer: c
Explanation: The destructors are always called in reverse order no matter which destructor it is. This is done to ensure that all the
TU
Answer: a
Explanation: This is always advised to have user defined destructor when pointers are involved in class. This is usually done to
/
s:/
ensure that the memory, that was allocated dynamically, gets free after use and doesn’t cause memory leak.
tp
12. Which among the following is correct for the destructors concept?
a) Destructors can be overloaded
ht
13. Which class destructor will be called first, when following code go out of scope?
class A{ };
class B{ };
class C: public B{ };
A a;
B b;
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
b) Destructor is called at end of function
c) Destructor is called when function is out of scope
nt
d) Destructor is called when called explicitly
ua
Answer: a
Explanation: The destructor is never called in this situation. The concept is that when an object is passed by reference to the
_Q
function, the constructor is not called, but only the main object will be used. Hence no destructor will be called at end of function.
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) It must be done explicitly
d) It can’t be done explicitly
nt
Answer: c
ua
Explanation: The downcasting of any object must be done explicitly. This is because the compilers don’t support the implicit
conversion of a supertype to subtype.
_Q
3. Downcasting is
ks
a) Always safe
b) Never safe
c) Safe sometimes
d) Safe, depending on code
oo
_B
Answer: b
es
Explanation: The downcasting concept is made for exception cases. When there is a need to represent an entity in the form
which is not suitable for it. Representing a base type in derived type is not right but can be done for special cases.
ot
_N
4. Downcasting
a) Can result in unexpected results
b) Can’t result in unexpected result
TU
Answer: a
Explanation: The result of downcasting can be unexpected. This is because downcasting is done on the objects into the objects
e/
b) Dynamic cast
c) Manual cast
tp
d) Implicit cast
ht
Answer: b
Explanation: The dynamic cast can be done using the operator dynamic_cast. This converts one type to another type in a safe
way.
6. What does dynamic_cast return after successful type casting?
a) Address of object which is converted
b) Address of object that is used for conversion
c) Address of object that is mentioned in the syntax
d) Doesn’t return any address
Answer: a
Explanation: The address of the object which is converted is returned by the dynamic_cast operator. This is done to safely
convert the subtype to supertype. This ensures the proper assignment and conversion from one type to another.
7. If dynamic_cast fails, which value is returned?
a) void
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) ClassCastException
Answer: d
nt
Explanation: The exception handler for the exceptions produced during the downcasting exception. This handler can be called
ua
during runtime to handle any exception thrown.
_Q
10. How to prevent the ClassCastExceptions?
a) By using instanceof
ks
b) By using is-a check
c) By using arrow operator with check function
d) By checking type of conversion oo
_B
Answer: a
Explanation: The instanceof operator can be used to check the compatibility of the conversion. This has to be done to check
es
a) True
b) False
TU
Answer: b
Explanation: The downcasting is not possible in java directly. This has to be done explicitly. The downcasting is not safe but can
K
Answer: b
tp
Explanation: The downcasting is always downward the inheritance order. Since the base class object have to be casted into
derived class type. This is a basic definition of downcasting.
ht
13. What happens when downcasting is done but not explicitly defined in syntax?
a) Compile time error
b) Runtime error
c) Code write time error
d) Conversion error
Answer: a
Explanation: The implicit downcasting is not possible. If tried, the compiler produces an error. Since the compiler doesn’t allow
coasting to a type that is not compatible.
14. When is the downcasting used?
a) To separate inherited class from base class
b) To write a more complex code
c) To compare two objects
d) To disable one class in inheritance
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Create private member functions to access those data members
c) Create protected member functions to access those data members
nt
d) Private data members can never be accessed from outside the class
ua
Answer: a
Explanation: We can define public member functions to access those private data members and get their value for use or
_Q
alteration. They can’t be accessed directly but is possible to be access using member functions. This is done to ensure that the
private data doesn’t get modified accidentally.
ks
3. While using encapsulation, which among the following is possible?
a) Code modification can be additional overhead
b) Data member’s data type can be changed without changing any other code
oo
_B
c) Data member’s type can’t be changed, or whole code have to be changed
d) Member functions can be used to change the data type of data members
es
Answer: b
ot
Explanation: Data member’s data type can be changed without changing any further code. All the members using that data can
_N
continue in the same way without any modification. Member functions can never change the data type of same class data
members.
TU
b) Abstraction
A
c) Polymorphism
d) Overloading
e/
t.m
Answer: b
Explanation: Data abstraction can be achieved by using encapsulation. We can hide the operation and structure of actual
program from the user and can show only required information by the user.
/
s:/
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
9. Which among the following violates the principle of encapsulation almost always?
a) Local variables
nt
b) Global variables
ua
c) Public variables
d) Array variables
_Q
Answer: b
ks
Explanation: Global variables almost always violates the principles of encapsulation. Encapsulation says the data should be
accessed only by required set of elements. But global variable is accessible everywhere, also it is most prone to changes. It
doesn’t hide the internal working of program. oo
_B
10. Which among the following would destroy the encapsulation mechanism if it was allowed in programming?
a) Using access declaration for private members of base class
es
Answer: a
TU
Explanation: If using access declaration for private members of base class was allowed in programming, it would have
destroyed whole concept of encapsulation. As if it was possible, any class which gets inherited privately, would have been able
to inherit the private members of base class, and hence could access each and every member of base class.
K
A
11. Which among the following can be a concept against encapsulation rules?
a) Using function pointers
e/
Answer: d
Explanation: If we use any kind of array or pointer as data member which should not be changed, but in some case its address is
tp
passed to some other function or similar variable. There are chances to modify its whole data easily. Hence Against
ht
encapsulation.
12. Consider the following code and select the correct option.
class student
{
int marks;
public : int* fun()
{
return &marks;
}
};
main()
{
student s;
int *ptr=c.fun();
return 0;
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
class hero
{
char name[10];
public : void disp()
{
cout<<name;
}
};
um
a) This maintains encapsulation
b) This code doesn’t maintain encapsulation
nt
c) This code is vulnerable
ua
d) This code gives error
_Q
Answer: a
Explanation: This code maintains encapsulation. Here the private member is kept private. Outside code can’t access the private
ks
members of class. Only objects of this class will be able to access the public member function at maximum.
oo
14. Encapsulation is the way to add functions in a user defined structure.
a) True
_B
b) False
es
Answer: b
Explanation: False, because we can’t call these structures if member functions are involved, it must be called class. Also, it is not
ot
just about adding functions, it’s about binding data and functions together.
_N
d) Very low
A
Answer: b
e/
Explanation: The encapsulation can only ensure data security to some extent. If pointer and addresses are misused, it may
t.m
violate encapsulation. Use of global variables also makes the program vulnerable, hence we can’t say that encapsulation gives
pure security.
/
s:/
tp
ht
1. Virtual function is class function which expected to be redefined in class, so that when reference is made to
derived class object using pointer then we can call virtual function to execute class definition version.
a) Base, derived, derived
b) Derived, Derived, Derived
c) Base, derived, base
d) Base, base, derived
Answer: a
Explanation: The functions which may give rise to ambiguity due to inheritance, can be declared virtual. So that whenever
derived class object is referred using pointer or reference to the base class methods, we can still call the derived class methods
using virtual function. Hence this differentiates those methods from each other.
2. What does a virtual function ensure for an object, among the following?
a) Correct method is called, regardless of the class defining it
um
b) Correct method is called, regardless of the object being called
c) Correct method is called, regardless of the type of reference used for function call
nt
d) Correct method is called, regardless of the type of function being called by objects
ua
Answer: c
Explanation: It is property of the virtual function and one of their main use. Its use ensure that the correct method is called even
_Q
though it is been called from different pointer or references. This also decreases chance of mistakes in program.
ks
3. Virtual functions are mainly used to achieve
a) Compile time polymorphism
b) Interpreter polymorphism
c) Runtime polymorphism
oo
_B
d) Functions code polymorphism
es
Answer: c
Explanation: It is used to achieve runtime polymorphism. The functions which are inherited and overridden, so at runtime the
ot
correct function is executed. The correct function call is made from the intended class.
_N
a) virtual
b) virt
c) anonymous
K
d) virtually
A
Answer: a
e/
Explanation: The virtual keyword is used to declare virtual functions. Anonymous keyword is used with classes and have a
t.m
different meaning. The virtual functions are used to call the intended function of the derived class.
5. Where the virtual function should be defined?
/
s:/
d) Base class
Answer: d
Explanation: The virtual function should be declared in base class. So that when the derived class inherits from the base class,
the functions can be differentiated from the one in base class and another in derived class.
6. The resolving of virtual functions is done at
a) Compile time
b) Interpret time
c) Runtime
d) Writing source code
Answer: c
Explanation: The resolving of virtual functions that are to be called is done at run time. The base class and the derived classes
may contain different definitions and different variables, so all these things are resolved at run time and decided which function is
to be called.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) False
Answer: a
nt
Explanation: The friend functions can access the private members also. This may hinder the security of class members. This is
ua
why the functions should not be made friend functions of other class.
_Q
10. Which is a must condition for virtual function to achieve runtime polymorphism?
a) Virtual function must be accessed with direct name
ks
b) Virtual functions must be accessed using base class object
c) Virtual function must be accessed using pointer or reference
d) Virtual function must be accessed using derived class object only oo
_B
Answer: c
Explanation: The virtual functions must be called using pointer or reference. This is mandatory so that the intended function gets
es
executed while resolving the method at runtime. The must not be any ambiguity between the method of parent class and derived
class.
ot
_N
Answer: b
Explanation: The prototype must be the same. Because the function is to be overridden in the derived class. If the function
e/
prototype is different in derived class then it will not override the base class function and hence virtual function concept won’t
t.m
work here.
12. The virtual functions must be declared and defined in class and overridden in class.
/
s:/
a) Base, base
b) Derived, derived
tp
c) Derived, base
ht
d) Base, derived
Answer: d
Explanation: The virtual functions must be declared and defined in base class. The functions can be redefined in derived class. If
redefined in derived class then it overrides the base class function definition.
13. It is to redefine the virtual function in derived class.
a) Necessary
b) Not necessary
c) Not acceptable
d) Good practice
Answer: b
Explanation: It is not necessary to redefine the virtual function in the derived class. If not defined, the base class function
definition is used but if defined, the intended definition is used according to need. It is not about good coding practice as it
should be redefined only if needed.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) To avoid syntax errors
d) To save memory
nt
Answer: a
ua
Explanation: The exceptions should be handled to prevent any abnormal termination of a program. The program should keep
running even if it gets interrupted in between. The program should preferable show the error occurred and then retry the process
_Q
or just continue the program further.
ks
3. An exception may arise when
a) Input is fixed
b) Input is some constant value of program
c) Input given is invalid
oo
_B
d) Input is valid
es
Answer: c
Explanation: The exceptions may arise because the input given by the user might not be of the same type that a program can
ot
4. If a file that needs to be opened is not found in the target location then
a) Exception will be produced
TU
Answer: a
e/
Explanation: The exceptions are produced when anything unexpected happened. The program might not be able to find a file in
t.m
the target location and hence program produces an exceptions. The exception produced, then terminates the program.
5. Which is the universal exception handler class?
/
s:/
a) Object
b) Math
tp
c) Errors
ht
d) Exceptions
Answer: d
Explanation: Any type of exception can be handled by using class Exceptions. An object of this class is created which can
manipulate the exception data. The data can be used to display the error or to run the program further based on error produced.
6. What are two exception classes in hierarchy of java exceptions class?
a) Runtime exceptions only
b) Compile time exceptions only
c) Runtime exceptions and other exceptions
d) Other exceptions
Answer: c
Explanation: The exceptions class is having two other derived classes which are of runtime exception handler and for other type
of exceptions handling. The runtime exception handler is used to handle the exceptions produced during run time and same with
case of other exceptions.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Maximum 127
d) As many as required
nt
Answer: d
ua
Explanation: There is no limit on the number of catch blocks corresponding to a try block. This is because the error can be of any
type and for each type, a new catch block can be defined. This is to make sure all type of exceptions can be handled.
_Q
10. Which among the following is not a method of Throwable class?
ks
a) public String getMessage()
b) public Throwable getCause()
c) public Char toString()
d) public void printStackTrace()
oo
_B
Answer: c
es
Explanation: Actually all the functions are available in throwable class. But the return type given in the option is wrong. The
function toString returns string value. Hence the return type must be a String and not a char.
ot
_N
Answer: a
Explanation: The object must be created of a specific class of which the error has occurred. If the type of error is unknown then
e/
we can use an object of class Exceptions. This object will be able to handle any kind of exception that a program might produce.
t.m
Answer: b
Explanation: The separate catch blocks for a single try block can be combined into a single catch block. All type of errors can be
then handled in s single block. The type still have to be specified for the errors that might be produced.
13. Which symbol should be used to separate the type of exception handler classes in a single catch block?
a) ?
b) ,
c) –
d) |
Answer: d
Explanation: A pipe symbol can be used to separate different type of exceptions. The exceptions should always be given in
proper sequence to ensure that no code remains unreachable. If not done properly the code might never be used in a program.
14. Which class is used to handle the input and output exceptions?
a) InputOutput
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) A function which is called after termination of the program
d) A function which is called before calling any member function
nt
Answer: a
ua
Explanation: The Destructors are special functions which are called just before an object is destroyed. This functions is
responsible to free all the allocated resources to the object. Objects are destroyed whenever those go out of scope.
_Q
3. Which among the following represents correct constructor?
ks
a) ()classname
b) ~classname()
c) –classname()
d) classname()
oo
_B
Answer: d
es
Explanation: The constructors must contain only the class name. The class name is followed by the blank parenthesis or we can
have parameters if some values are to be passed.
ot
_N
b) ()classname
c) ~classname()
d) -classname()
K
A
Answer: c
Explanation: The destructor must have same name as that of the corresponding class. The class name should be preceded by
e/
b) First the constructor of child classes are called in the sequence of inheritance
c) First constructor called is of the object being created
tp
Answer: a
Explanation: First the constructor of parent class are called. The order in which the parent class constructors are called is same
in the sequence of inheritance used.
6. What is the sequence of destructors call?
a) Same order as that of the constructors call
b) Random order
c) According to the priority
d) Revere of the order of constructor call
Answer: d
Explanation: The destructors are called in the reverse order as that of the constructors being called. This is done to ensure that
all the resources are released in sequence. That is, the derived class destructors will be called first.
7. The destructors
a) Can have maximum one argument
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) Always less than or equal to number of constructors
Answer: a
nt
Explanation: Destructor will be called only to free the resources allocated for an object. The resources are allocated only the
ua
constructor for an object is called.
_Q
10. For explicit call
a) The destructor must be private
ks
b) The destructor must be public
c) The destructor must be protected
d) The destructor must be defined outside the class oo
_B
Answer: b
Explanation: The destructor must be public for explicit calls. If it is made private or protected then it won’t be accessible outside
es
the class. There is no restriction of definition the destructor outside the class.
ot
a) True
b) False
TU
Answer: b
Explanation: Even if the class have 4 constructors, only one would be used. And only one destructor is allowed.
K
Answer: c
Explanation: The destructors can never be overloaded. The destructors doesn’t have arguments. And to get overloaded, they
tp
must have different signature. This is not possible if arguments are not allowed.
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) RAM
d) ROM
nt
Answer: c
ua
Explanation: The memory for the objects or any other data is allocated in RAM initially. This is while we run a program all the
memory allocation takes place in some RAM segments. Arrays in heap and local members in stack etc.
_Q
3. When is the memory allocated for an object?
ks
a) At declaration of object
b) At compile time
c) When object constructor is called
d) When object is initialized to another object
oo
_B
Answer: c
es
Explanation: The object memory allocation takes place when the object constructor is called. Declaration of an object doesn’t
mean that memory is allocated for its members. If object is initialized with another object, it may just get a reference to the
ot
Answer: b
e/
Explanation: The new is type safe because we don’t have to specify the type of data that have to be allocated with memory. We
t.m
can directly use it with data name. Name of the data doesn’t matter though for type of memory allocation though.
5. Which of the following function can be used for dynamic memory allocation of objects?
/
s:/
a) malloc()
b) calloc()
tp
c) create()
ht
6. How much memory will be allocated for an object of class given below?
class Test{
int mark1;
int mark2;
float avg;
char name[10];
};
a) 22 Bytes
b) 24 Bytes
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: b
nt
Explanation: Whenever an object goes out of scope, the deletion of allocation memory takes place. Actually the data is not
deleted, instead the memory space is flagged to be free for further use. Hence whenever an object goes out of scope the object
ua
members become useless and hence memory is set free.
_Q
9. Which among the following keyword can be used to free the allocated memory for an object?
a) delete
ks
b) free
c) either delete or free
d) only delete oo
_B
Answer: c
Explanation: The memory allocated for an object is usually automatically made free. But if explicitly memory has to be made free
es
then we can use either free or delete keywords depending on programming languages.
ot
a) Destructor function
b) Constructor function
TU
c) Delete function
d) Free function
K
Answer: a
A
Explanation: The destructor function of the class is called whenever an object goes out of scope. This is because the destructor
set all the resources, acquired by the object, free. This is an implicit work of compiler.
e/
t.m
c) sizeofobject(objectName)
d) sizedobject(objectName)
tp
ht
Answer: a
Explanation: The sizeof operator is used to get the size of an already created object. This operator must constail keyword
sizeof(objectName). The output will give the number of bytes acquired by a single object of some class.
12. The memory allocated for an object
a) Can be only dynamic
b) Can be only static
c) Can be static or dynamic
d) Can’t be done using dynamic functions
Answer: c
Explanation: The memory allocation for an object can be static or dynamic. The static memory allocation is when an object is
declared directly without using any function usually. And dynamic allocation is when we use some dynamic allocation function to
allocate memory for data member of an object.
13. If an object is declared in a user defined function
a) Its memory is allocated in stack
Answer: a
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) delete
c) Unallocate
nt
d) Collect
ua
Answer: b
Explanation: The delete operator in C++ can be used to free the memory and resources held by an object. The function can be
_Q
called explicitly whenever required. In C++ memory management must be done by the programmer. There is no automatic
memory management in C++.
ks
oo
_B
es
ot
_N
TU
K
A
e/
/t.m
s:/
tp
ht
um
c) No, it’s doesn’t get divided
d) No, it may or may not get divided
nt
Answer: c
ua
Explanation: The class members doesn’t get divided among the child classes. All the members get derived to each of the
subclasses as whole. The only restriction is from the access specifiers used.
_Q
3. Each class can inherit the base class
ks
a) Independently using any inheritance
b) Independently with private inheritance only
c) With same type of inheritance
d) With each class using different inheritance only
oo
_B
Answer: a
es
Explanation: The classes can inherit the base class using any type of inheritance. There is no mandatory condition to use same
private,public or protected inheritance only.
ot
_N
b) At least 3
c) At most 3
d) At least 1
K
A
Answer: b
Explanation: At least 3 classes must be there. Two derived classes and one base class. This lets us implement two classes that
e/
5. Base class
a) Can be made abstract
/
s:/
Answer: a
Explanation: The base class may or may not be declared abstract. It depends on the need of program. If it is made abstract, it
can contain undefined functions too. In turn, those functions will have to be implemented by each of the derived classes.
6. Which access specifiers should be used so that all the derived classes restrict further inheritance of base class members?
a) Private
b) Public
c) Protected
d) Any inheritance type can be used
Answer: a
Explanation: All the derived classes must use private inheritance. This will make the members of base class private in derived
classes. Hence none of the members of base class will be available for further inheritance.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
Answer: d
Explanation: Class A is base class and B and D are derived classes. If class C is considered, it shows hybrid inheritance,
nt
involving single level and multiple inheritance.
ua
8. Which among the following is correct for following code?
_Q
abstract class A
{
ks
public Int a;
public void disp();
};
class B:public A
oo
_B
{
public: void dis()
es
{
ot
court<<a;
}
_N
};
class C:private A
TU
{
public void incr()
{
K
a++;
A
}
e/
}
void main()
t.m
{
B b.disp();
/
s:/
}
tp
Answer: b
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Single level inheritance
d) Multilevel inheritance
nt
Answer: a
ua
Explanation: When we use hybrid inheritance, it can contain any type of inheritance or combination or more than two types.
Hence it may contain Hierarchical inheritance too, hence it can be subset of hybrid inheritance.
_Q
13. Which type of inheritance is most suitable for inheriting Same syllabus into different colleges with different streams?
ks
a) Multiple
b) Single
c) Hierarchical
d) Multilevel
oo
_B
Answer: c
es
Explanation: When hierarchical inheritance is used, the common syllabus can be adopted into different college classes where
the same syllabus is applicable. For changing the syllabus only the details of base class will have to changed.
ot
_N
14. Which class constructor is called first when an object of derived class is created?
a) Base class constructor
TU
Answer: a
Explanation: The base class must be initialised first hence the constructor of base class is called first. This makes everything
e/
15. All the derived classes can access only a few members of base class that other derived classes can’t access at same time,
in hierarchical inheritance.
/
s:/
a) True
b) False
tp
Answer: b
ht
Explanation: The derived classes have full access to all the non private member’s of base class. Every derived class have equal
access, none of the class can have special access to specific members of base class in general cases.
um
c) At most two
d) Always more than 2
nt
Answer: b
ua
Explanation: There must be combination of at least 2 types of inheritance. The inheritance should be of different type.
_Q
3. If single inheritance is used with class A and B. A is base class. Then class C, D and E where C is base class and D is
derived from C, then E is derived from D. Class C is made to inherit from class B. Which is the resultant type?
ks
a) Single level
b) Multilevel
c) Hybrid
d) Multiple
oo
_B
Answer: b
es
Explanation: The statement represents multilevel inheritance. It is not hybrid since looking at complete idea, one can’t
differentiate whether two type of inheritance are used. Hence it is multilevel inheritance.
ot
_N
Answer:a
Explanation: The diamond problem arises when more than one classes are derived from one class and then those classes are
e/
used to derive single clas. Resulting in ambiguity of same functions from each class.
t.m
b) Multiple
c) Multilevel
tp
Answer: a
Explanation: Hierarchical inheritance is deriving more than one classes from a base class, it it is done continuously and
subsequently, it results forming a tree like structure of classes being linked.
6. Which amongst the following is true for hybrid inheritance?
a) Constructor calls are in reverse
b) Constructor calls are priority based
c) Constructor of only derived class is called
d) Constructor calls are usual
Answer: d
Explanation: The constructors will be called in usual way. First the parent class Constructor and then the derived class
Constructors. This is done to initialise all the members properly.
7. Which type of inheritance must be used so that the resultant is hybrid?
a) Multiple
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
9. If hierarchical inheritance requires to inherit more than one class to single class, which syntax is correct? (A, B, C are class
names)
a) hierarchical class A: public B, public C
b) multiple class A: public B, public C
c) many class A: public B, public C
d) class A: public B, public C
um
Answer: d
Explanation: The syntax is as same as declaration of other classes. There is no specific keyword defined for using hybrid
nt
inheritance in programming. Only thing is to specify the class name separated by commas.
ua
10. What is the maximum number of classes allowed in hybrid inheritance?
_Q
a) 7
b) 127
ks
c) 255
d) As many as required
Answer: d
oo
_B
Explanation: The classes in any type of inheritance can inherit as many classes as required. The only condition that may arise is
memory management. The classes can inherit most of the features from more than one class.
es
11. What is the minimum number of classes to be there in a program implementing hybrid inheritance?
ot
a) 2
_N
b) 3
c) 4
TU
d) No limit
Answer: d
K
Explanation: The answer is no limit. There is no condition defined for limit of classes that has to be used in hybrid. Though you
A
must have at least 4 classes so that one set of multiple or hierarchical inheritance is there and one more class to use single level
inheritance.
e/
t.m
12. If object of lowest level class is created (last derived class) of its parent class constructors are called.
a) Few
b) All
/
s:/
Answer: c
ht
Explanation: When derived class object is created, all of its successor parent classes constructors are called. Constructor of all
the connected classes is not created. Since the parent members have to be initialised, but other derived classes are not
needed.
13. If hybrid inheritance is used, it mostly shows feature of OOP.
a) Flexibility
b) Reusability
c) Efficiency
d) Code readability
Answer: b
Explanation: The code is reusable in most of the classes and the data becomes more linked to other classes. Other features are
also exhibited, but the code reusability is used the most. Code readability becomes relatively less. Flexibility increases but it
depends on how the hybrid inheritance is used.
14. The sequence of destructors being called while using hybrid inheritance is
Answer: a
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Are used by the compiler only
d) Can be modified by programmer always
nt
Answer: a
ua
Explanation: The inbuilt classes must be included in the program. Whenever some functions are used, they must have a
declaration before use. The same is the case with classes.
_Q
3. What doesn’t inbuilt classes contain?
ks
a) Function prototype
b) Function declaration
c) Function definitions
d) Objects
oo
_B
Answer: c
es
Explanation: The classes contain the definitions of the special functions that are provided for the programmers use. Those
functions can be used to make the programming easy and to reuse the already existing code.
ot
_N
b) Color
c) String
d) Functions
K
A
Answer: d
Explanation: There is no inbuilt class named function in java. The others are classes already provided in java. All those classes
e/
Answer: a
Explanation: The InputStream is an inbuilt class which is used to handle all the tasks related to input handling. This class extends
input from keyboard or file or any other possible input stream.
6. Which statement is true for the Array class?
a) Arrays can have variable length
b) The length array can be changed
c) Each class has an associated Array class
d) Arrays can contain different type of values
Answer: c
Explanation: The Array class is associated with all the other classes. This gives us the flexibility to declare an array of any type.
The index goes from 0 to n, where n is some fixed size for array.
7. What is the use of Math class?
a) To use the mathematical functions with strings
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Array_name.length
d) length.Array_name
nt
Answer: c
ua
Explanation: The array name is given of which the length have to be calculated. The array length is stored in the attribute length.
Hence we access it using dot operator.
_Q
10. Number class can’t manipulate
ks
a) Integer values
b) Float values
c) Byte values
d) Character values
oo
_B
Answer: d
es
Explanation: The Number class is used to work with all the number type of values. The integers, float, double, byte etc. are all
number type values. Character is not a number value.
ot
_N
11. Which function should be used to exit from the program that is provided by System class?
a) exit(int);
TU
b) gc();
c) terminate();
d) halt();
K
A
Answer: a
Explanation: The exit function should be used to terminate the program. The function is passed with an argument. The argument
e/
b) System
c) Final
tp
d) SystemFinal
ht
Answer: b
Explanation: The runFinalization() Function is defined in the System class. The function is used to finalize an object which
undergo destruction. The action is required to terminate the object properly.
13. What does load(String)::= function do, in System class?
a) Loads dynamic library for a path name
b) Loads all the dynamic libraries
c) Loads all the Number in string format
d) Loads the processor with calculations
Answer: a
Explanation: Only the specified path named dynamic libraries are loaded. All the dynamic libraries can’t be loaded at a time.
Hence we use this function for specific libraries.
14. Which is not a System class variable?
a) err
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) 3
c) 2
nt
d) 1
ua
Answer: a
Explanation: There are basically 4 types of inheritance provided in OOP, namely, single level, multilevel, multiple and hierarchical
_Q
inheritance. We can add one more type as Hybrid inheritance but that is actually the combination any types of inheritance from
the 4 basic ones.
ks
3. Which among the following best defines single level inheritance?
a) A class inheriting a derived class
b) A class inheriting a base class
oo
_B
c) A class inheriting a nested class
d) A class which gets inherited by 2 classes
es
Answer: b
ot
Explanation: A class inheriting a base class defines single level inheritance. Inheriting an already derived class makes it
_N
multilevel inheritance. And if base class is inherited by 2 other classes, it is multiple inheritance.
TU
Answer: a
t.m
Explanation: Class topper is getting derived from 2 other classes and hence it is multiple inheritance. Topper inherits class
stream and class student publicly and hence can use its features. If only few classes are defined, there we are not even using
inheritance (as in option class student{ }; class stream{ }; class topper{ };).
/
s:/
b) C and C++
c) Java and SmallTalk
d) Java
Answer: d
Explanation: Java doesn’t support multiple inheritance. But that feature can be implemented by using the interfaces concept.
Multiple inheritance is not supported because of diamond problem and similar issues.
6. Which among the following is correct for a hierarchical inheritance?
a) Two base classes can be used to be derived into one single class
b) Two or more classes can be derived into one class
c) One base class can be derived into other two derived classes or more
d) One base class can be derived into only 2 classes
Answer: c
Explanation: One base class can be derived into the other two derived classes or more. If only one class gets derived by only 2
other classes, it is also hierarchical inheritance, but it is not a mandatory condition, because any number of derived classes can
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
two base classes, we get a diamond like structure. Here, ambiguity arises when same function gets derived into 2 base classes
and finally to 3rd level class because same name functions are being inherited.
nt
9. Which access type data gets derived as private member in derived class?
ua
a) Private
b) Public
_Q
c) Protected
d) Protected and Private
ks
Answer: a
oo
Explanation: It is a rule, that when a derived class inherits the base class in private access mode, all the members of base class
gets derived as private members of the derived class.
_B
10. If a base class is inherited in protected access mode then which among the following is true?
es
a) Public and Protected members of base class becomes protected members of derived class
b) Only protected members become protected members of derived class
ot
c) Private, Protected and Public all members of base, become private of derived class
_N
Answer: a
Explanation: As the programming language rules apply, all the public and protected members of base class becomes protected
members of derived class in protected access mode. It can’t be changed because it would hinder the security of data and may
K
a) Public members
t.m
b) Protected members
c) Private members
d) Private or Protected members
/
s:/
Answer: c
tp
Explanation: Private access specifier is the most secure access mode. It doesn’t allow members to be inherited. Even Private
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) It can be done both by making the visibility mode public or protected
Answer: d
nt
Explanation: It is not mandatory that you have to make the visibility mode either public or protected. You can do either of those.
ua
That will give you permission to inherit the private members of base class.
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Serialization
c) File system
nt
d) Data streams, serialization and file system
ua
Answer: d
Explanation: The IO classes are made such that those can support the input and output from any type of source or destination.
_Q
The input can be taken from system file and standard input and also some special devices if conned. Same is case to show the
output.
ks
3. Which among the following class contains the methods to access character based console device?
a) Console
b) File
oo
_B
c) Device
d) Pipe
es
Answer: a
ot
Explanation: The Console class contains the methods to access the character based devices. The devices which can stream the
_N
data as character set. All those devices can be made use of by using the methods of class Console.
TU
4. File class is
a) An abstract of file representation only
b) An abstract of path names only
K
Answer: c
t.m
Explanation: The File class is made to operate with the files. The file can be of any type. All the input and output operations that
have to be performed on a file can be done using File class object.
/
s:/
5. What is a FileDescriptor?
a) A handle for machine specific structure of an open file
tp
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
a) Used to read from files
b) Abstract class to read character streams
nt
c) Abstract class to input character streams
d) Used to take input from standard input stream
ua
Answer: b
_Q
Explanation: The Reader class is an abstract class that can be used to read characters stream. It can’t be used for any kind of
input. It can just read the existing data.
ks
10. Which class can handle IO class interrupt?
a) ExceptionIO
b) InteruptedIO
oo
_B
c) InteruptedIOException
d) IOInteruptException
es
Answer: c
ot
Explanation: The only class which handles the IO class interrupts is InteruptedIOException class. This class is specially provided
_N
Answer: d
t.m
Explanation: The StringReader can only work with the string type data. Even if a character array is given, it might produce some
errors in code. Hence only the string values can be handled properly.
/
s:/
12. Which exception handler can be used when character encoding is not supported?
a) UnsupportedException
tp
b) UnsupportedEncodingException
ht
c) SupportException
d) EncodingException
Answer: b
Explanation: The encoding that is unsupported in a system can be handled. The exception handler is
UnSupportedEncodingException class. An object of this class can be created which will catch the exception and handle it.
13. PushBackReader allows the streams to be pushed back to the stream.
a) True
b) False
Answer: a
Explanation: The PushBackReader allows the character streams handling. The main feature is that the stream can be pushed
back to the stream. This is used in special cases of handling input stream.
14. RandomAccessFile can be used to
a) Read from a random access file
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Defined outside the function definition
c) Defined inside the class body
nt
d) Defined at starting of program
ua
Answer: c
Explanation: There is a restriction on where the member functions of the local class should be define. Those must be defined
_Q
inside the class body only. This is to reduce the ambiguity and complexity of program.
ks
3. Can local class members access/use the general local variables (except static, abstract etc.) of the function in which it is
defined?
a) Yes, it can access with arrow operator
b) No, it can’t access with dot operator
oo
_B
c) Yes, it can access using dot operator
d) No, it can’t access In anyway
es
Answer: d
ot
Explanation: The local variables of the functions are not available to the member functions of the class. This is done to reduce the
_N
Answer: a
t.m
Explanation: The local classes have this feature to access the static and extern variables of the function in which those are
defined. This feature is available since these type of data are common to the program and is created only one time. Run time
creation and destruction of these variables is not done. The only restriction that may apply is those members must be constants.
/
s:/
5. Local classes can access the type names and enumerators defined by the enclosing function.
tp
a) True
ht
b) False
Answer: a
Explanation: This is a little tricky part with local classes. Though the local class can’t access the general variables of the function
but can access the types that are defined inside the function. This is because the whole definition of that type would be existing
inside the class.
6. Can static variables be declared inside a local class?
a) Yes, with public access specifier
b) Yes, anywhere as required
c) No, not possible in private access specifier
d) No, not possible anyway
Answer: d
Explanation: No, the static variables can’t be declared inside a local class. This is because each time the function is called, all
the variables get created again and are destroyed as soon as the function is returned. This would have been possible id the
static variable was of function.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Java
c) SmallTalk
d) SAP ABAP
nt
ua
Answer: d
Explanation: Other language might support inheritance with local classes but those doesn’t provide all the proper features of
_Q
inheritance. Language SAP ABAP provides a way to implement inheritance with local classes efficiently.
ks
10. How many local classes can be defined inside a single function?
a) Only 1
b) Only 3
c) Only 5
oo
_B
d) As many as required
es
Answer: d
Explanation: The local classes can be defined as required. There is no restriction on the number of local classes that can be
ot
defined inside a function. But all those classes must follow the rules and restrictions.
_N
b) Defined in constructor
c) Declared and defined in constructor
K
Answer: b
e/
Explanation: The data members follow the same rules as of simple classes. Hence the data members must be declared first.
t.m
Answer: a
Explanation: The local classes can have same name if they belong to different functions. The classes would be local to those
specific functions and hence can have same name. This is same as that of local variables concept.
13. What is the scope of local class?
a) Within the class only
b) Within the function
c) Within the program
d) One time creation and live till end of program
Answer: b
Explanation: The scope of a local class is limited only within the function definition. The function can use the class as usual as
local variables. The class gets destroyed as soon as the function is returned.
14. Can a function, other than the enclosing function of local class, access the class members?
Answer: d
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) Names
Answer: d
nt
Explanation: The names are not property of an object. The identity can be in any form like address or name of object but name
ua
can’t be termed as only identity of an object. The objects contain attributes that define what type of data an object can store.
_Q
3. What is function object?
a) An object with a single function
ks
b) An object with only functions
c) An object with more than one function
d) An object with no functions oo
_B
Answer: a
Explanation: A function object is an object with single function. In C++ a function object can be like operator() function. This acts
es
Answer: a
A
Explanation: An immutable object can be created for an object which has to be fixed with values. The object data will not be
changed throughout the program. This can be useful to eliminate the unintentional changes in the data of object.
e/
t.m
c) Container object
d) Enclosure object
tp
Answer: c
ht
Explanation: A container object can be used to contain other objects. Container object is an ADT. Its object are collection of
other objects. Some specific rules apply to these types of objects.
6. A factory object is used
a) To create new classes
b) To create new function
c) To create new data members
d) To create new objects
Answer:d
Explanation: The factory object is an object that can be used to create other objects. If it is seen formally, it behaves like a
method that will return object on its use. The object returned is assumed to be a new object.
7. What are singleton objects?
a) The only two objects of a class throughout the program
b) The only object of a class throughout the program
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: b
Explanation: The object types are always fixed. Once the object is created of a specific type then it can’t be changed. Neither at
nt
runtime nor at compile time.
ua
10. An object can be used to represent
a) A real world entity
_Q
b) A real function
c) Some real data only
ks
d) Some function only
Answer: a oo
Explanation: The objects are actually meant to represent an entity. The classes are real world object’s blueprint. The classes then
_B
are used to create an entity representation.
es
Answer: b
Explanation: The objects are created for a specific class. Then the objects can be used to access the public members of a
K
class. The members can be the data members or the member functions of the class.
A
Answer: a
tp
Explanation: The objects can’t be used to define any member function. Member functions must be defined by the class only.
ht
15. If same object name is given to different objects of different class then
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) 3
c) 4
nt
d) 5
ua
Answer: d
Explanation: There are 5 types of member functions that are generally provided in C++. Namely, simple, static, const, inline and
_Q
friend member functions. Member functions are specific to classes.
ks
3. How can a static member function be called in the main function?
a) Using dot operator
b) Using arrow operator
c) Using dot or arrow operator
oo
_B
d) Using dot, arrow or using scope resolution operator with class name
es
Answer: d
Explanation: The member functions can be called using only the dot operator or the arrow operator. But the static members can
ot
be called using directly the class name followed by the scope resolution operator and static member function name. This is
_N
useful when you don’t have any object to call the member.
TU
Answer: b
t.m
Explanation: The member functions whose definition is expanded at the call, and no jump to function and return happened, are
termed as inline functions. This is used to make the program faster and more efficient.
/
s:/
5. What happens if non static members are used in static member function?
a) Compile time error
tp
b) Runtime error
ht
c) Executes fine
d) Executes if that member function is not used
Answer: a
Explanation: There must be specific memory space allocated for the data members before the static member functions uses
them. But the space is not reserved if object is not declared. Hence only if static members are not used, it leads to compile time
error.
6. Static member functions
a) Contains “this” pointer for data members
b) Contains “this” pointer if used for member functions
c) Doesn’t contain “this” pointer
d) Doesn’t contain “this” pointer if member functions are referred
Answer: c
Explanation: The static member functions doesn’t contain “this” pointer. Static member functions can’t be defined as const or
volatile also. These are restrictions on static member functions.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
9. If a virtual member function is defined
a) It should not contain any body and defined by subclasses
nt
b) It must contain body and overridden by subclasses
ua
c) It must contain body and be overloaded
d) It must not contain any body and should not be derived
_Q
Answer: a
ks
Explanation: The virtual functions are defined using virtual keyword. These are made in order to make all the classes to define
them as the class gets inherited. Increases code understanding.
10. Member functions of a generic class are
oo
_B
a) Not generic
b) Automatically generic
es
Answer: b
Explanation: When generic type is used in a class, the functions are automatically generic. This is so because the functions
TU
would use the same type as defined to make the class generic. The functions will get to know the type of data as soon as the
generic class is used. It’s inbuilt feature.
K
Explanation: The member functions has access to all the members of the class. Whenever data members of a class, which might
be private, have to be modified, we make use of these member functions. This is more secure way to manipulate data.
tp
12. Which among the following is proper syntax for class given below?
ht
class A
{
int a,b;
public : void disp();
}
a) void disp::A(){ }
b) void A::disp(){ }
c) void A:disp() { cout<<a<<b ; }
d) void disp:A(){ cout<<a<<b; }
Answer: b
Explanation: The syntax in option void A::disp(){ } is correct. We use scope resolution to represent the member function of a
class and to write its definition. It is not necessary for a function to have anything in its definition.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Definition without return type
c) Access public members of subclass
nt
d) Access static members of class
ua
Answer: c
Explanation: A member function of a class can only have the access to the members of its own class and parent classes if
_Q
inheritance used. Otherwise a member function can never access the members of a subclass. Accessing static members of a
class is possible by normal and static member functions.
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
2. If there are 5 classes, E is derived from D, D from C, C from B and B from A. Which class constructor will be called first if the
object of E or D is created?
a) A
um
b) B
c) C
nt
d) A and B
ua
Answer: a
Explanation: A is parent of all other classes indirectly. Since A is parent of B and B is parent of C and so on till E. Class A
_Q
constructor will be called first always.
ks
3. If there are 3 classes. Class C is derived from class B and B is derived from A, Which class destructor will be called at last if
object of C is destroyed.
a) A
b) B
oo
_B
c) C
d) All together
es
Answer: a
ot
Explanation: The destructors are called in the reverse order of the constructors being called. Hence in multilevel inheritance, the
_N
constructors are created from parent to child, which leads to destruction from child to parent. Hence class A destructor will be
called at last.
TU
Answer: a
Explanation: The class with highest degree of abstraction will be the class at the 1st level. You can look at a simple example like,
a CAR is more abstract than SPORTS CAR class. The level of abstraction decrease with each level as more details comes out.
/
s:/
c) Each subsequent class can access all members of previous level parent classes
d) None of the members will be available to any other class
Answer: b
Explanation: The classes will be able to access only the non-private members of its parent class. The classes are using private
inheritance, hence all the members of the parent class become private in the derived class. In turn those won’t be allowed for
further inheritance or direct access outside the class.
6. Multilevel inheritance allows in the program.
a) Only 7 levels of inheritance
b) At least 7 levels of inheritance
c) At most 16 levels of inheritance
d) As many levels of inheritance as required
Answer: d
Explanation: The multilevel inheritance allows any number of levels of inheritance. This is the maximum flexibility feature to make
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
9. All the classes must have all the members declared private to implement multilevel inheritance.
a) True
nt
b) False
ua
Answer: b
_Q
Explanation: There is no mandatory rule to make the members private for multilevel inheritance. Moreover, if all the classes have
only the private members then there won’t be any member to get inherited. Hence the working will be of no use.
ks
10. Can abstract classes be used in multilevel inheritance?
a) Yes, always
b) Yes, only one abstract class
oo
_B
c) No, abstract class doesn’t have constructors
d) No, never
es
Answer: a
ot
Explanation: The abstract classes can always be used in multilevel inheritance. The only condition that may arise is that all the
_N
undefined functions must be defined in subclasses. There must not be any undefined function.
11. How many abstract classes can be used in multilevel inheritance?
TU
a) Only 1
b) Only 2
K
Answer: c
t.m
Explanation: At least one class must implement all the undefined functions. Hence there must be at least one class which is not
abstract. That is at least one less than number of levels.
/
s:/
12. If all the classes used parameterized constructors and no default constructor then
a) The object of lower level classes can’t be created
tp
b) Object of lower level classes must call parent class constructors explicitly
c) Object of lower level classes must define all the default constructors
ht
class A
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
a) Yes, class C and class D
b) Yes, All together it’s multilevel
nt
c) No, 4 classes are used
d) No, multiple inheritance is used with class A, B and C
ua
_Q
Answer: d
Explanation: Since multiple inheritance is used to derive class C and then class D is derived from class C. This is not multilevel
inheritance. The classes should derive from single class. This is actually hybrid inheritance.
ks
15. Is it compulsory for all the classes in multilevel inheritance to have constructors defined explicitly if only last derived class
object is created? oo
_B
a) Yes, always
b) Yes, to initialize the members
c) No, it not necessary
es
Answer: c
_N
Explanation: It’s not mandatory to define the constructors explicitly. Default constructor will always be provided by the compiler
itself if none another constructor is defined in those classes. If explicit default constructor is defined it will be used.
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Circle
c) Triangle
nt
d) Loop
ua
Answer: a
Explanation: The diamond problem arises when multiple inheritance is used. This problem arises because the same name
_Q
member functions get derived into a single class. Which in turn creates ambiguity in calling those methods.
ks
3. How many classes should a program contain to implement the multiple inheritance?
a) Only 1
b) At least 1
c) At least 3
oo
_B
d) Exactly 3
es
Answer: c
Explanation: For the implementation of multiple inheritance, there must be at least 3 classes in a program. At least 2 base
ot
classes and one class to inherit those two classes. If lesser, it becomes single level inheritance.
_N
b) PHP
c) SmallTalk
K
d) Java
A
Answer: d
e/
Explanation: Java doesn’t allow use of multiple inheritance with classes. But this can be done by using the interfaces. This is
t.m
a) Yes, always
b) Yes, only if derived class implements all the methods
tp
d) No, never
Answer: b
Explanation: The condition for abstract class applies same here too. All the undefined functions must be defined. Hence all the
base classes can be abstract but derived class must implement all those undefined functions.
6. If class A inherits class B and class C as “class A: public class B, public class C {// class body ;}; ”, which class constructor will
be called first?
a) Class A
b) Class B
c) Class C
d) All together
Answer: b
Explanation: The constructors of parent class will be called first. In that, the constructor of the classes will be called in the same
sequence as that mentioned in class definition inheritance. Since class B is mentioned first for inheritance, its constructor will be
called first.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
flexibility.
9. How to overcome diamond problem?
nt
a) Using alias name
ua
b) Using seperate derived class
c) Using virtual keyword with same name function
_Q
d) Can’t be done
ks
Answer: c
Explanation: To overcome the ambiguity and conflict we can use keyword virtual. This will help us to differentiate the functions
with same name that came to last derived class in diamond problem. oo
_B
10. When multiple inheritance is used, which class object should be used in order to access all the available members of parent
and derived class?
es
Explanation: The derived class object can access all of its own members. It can also access the available members of the parent
classes, because the members are derived into the derived class.
K
11. If all the members of all the base classes are private then
A
Answer: a
Explanation: The derived class will not be able to access any members of the base classes. Since private member’s are not
tp
12. Is it compulsory to have constructor for all the classes involved in multiple inheritance?
a) Yes, always
b) Yes, only if no abstract class is involved
c) No, only classes being used should have a constructor
d) No, they must not contain constructors
Answer: b
Explanation: The constructors must be defined in every class. If class is abstract, it won’t have any constructor but other classes
must have constructor. Either implicit or explicit.
13. If a class contains 2 nested class and is being inherited by another class, will there be any multiple inheritance?
a) No, only single level inheritance is used
b) No, only multilevel inheritance is used
c) Yes, because 3 classes are involved
d) Yes, because more than 1 classes are being derived
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
we won’t be having the capability to have instances. This will restrict the use of multiple inheritance.
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Binding
d) Abstraction
nt
Answer: b
ua
Explanation: Using inheritance we can have the security of the class being inherited. The subclass can access the members of
parent class. And have more feature than a nested class being used.
_Q
3. How many categories are nested classes divided into?
ks
a) 2
b) 3
c) 4
d) 5
oo
_B
Answer: a
es
Explanation: The nested classes are divided into two main categories. Namely, Static and non-static. The categories define how
the classes can be used inside another class.
ot
_N
b) Protected members
c) Public members
d) All the members
K
A
Answer: d
Explanation: The non-static nested class can access all the members of the enclosing class. All the data members and member
e/
functions can be accessed from the nested class. Even if the members are private, they can be accessed.
t.m
b) Protected members
c) Public members
tp
Answer: d
Explanation: The static nested class doesn’t have access to any other members of the enclosing class. This is a rule that is
made to ensure that only the data which can be common to all the object is being accessed by the static nested class.
6. The nested class can be declared
a) Public
b) Private
c) Protected
d) Public, Protected, Private or Package private
Answer: d
Explanation: The nested class can be declared with any specifier, unlike the outer classes which can only be declared public or
package private. This is flexibility given for the nested class being a member of enclosing class.
7. Use of nested class encapsulation.
a) Increases
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
d) OuterClass[StaticNestedClass]
Answer: a
nt
Explanation: Like any other member of the class, the static nested class uses the dot operator to be accessed. The reason
ua
behind is, the static classes can’t work with instances, hence we use enclosing class name to access static nested class.
_Q
10. A nested class can have its own static members.
a) True
ks
b) False
Answer: b oo
Explanation: The nested classes are associated with the object of the enclosing class. Hence have direct access to the
_B
members of that object. Hence the inner class can’t have any static members of its own. Otherwise the rule of static members
would be violated using enclosing class instance.
es
Explanation: An instance of inner class can exist only within instance of outer class. To instantiate the inner class, one must
A
instantiate the outer class first. This can be done by the correct syntax above.
e/
{
public int a=1;
ht
void innermethod(int x)
{
System.out.println(“value of x = ” + x);
System.out.println(“value of this.x = ” + this.x);
System.out.println(“value of Test.this.x = ” + Test.T=this.x);
}
}
}
public static void main( String args[] )
{
Test t=new Test();
Test.innerClass im=t.new innerClass();
im.innermethod(55);
}
a)
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/t.m
s:/
tp
ht
value of x = 1
value of this.x = 0
value of Test.this.x = 55
c)
value of x = 55
value of this.x = 1
value of Test.this.x = 0
d)
value of x = 0
value of this.x = 55
um
value of Test.this.x = 1
Answer: c
nt
Explanation: The variable x denotes the parameter of the function. And this.x is the variable of the inner class. Test.this.x is the
ua
variable of the outer class. Hence we get this output.
_Q
13. Instance of inner class can exist only enclosing class.
a) Within
ks
b) Outside
c) Private to
d) Public to
oo
_B
Answer: a
es
Explanation: The class defined inside another class is local to the enclosing class. This means that the instance of inner class
will not be valid outside the enclosing class. There is no restriction for instance to be private or public always.
ot
14. If a declaration of a member in inner class has the same name as that in the outer class, then enclosing
_N
scope.
a) Outer declaration shadows inner declaration in
TU
Answer: b
e/
Explanation: The inner class will have more preference for its local members than those of the enclosing members. Hence it will
t.m
Answer: a
Explanation: Top level class encloses the other classes or have same preference as that of other top level classes. Having a
class inside the top level class is indirectly having a top level class which higher degree of encapsulation.
um
c) Add new vtable slot entries
d) Rearrange vtable slot entries
nt
Answer: c
ua
Explanation: The new keyword is used for adding new vtable slot entries. This is an additional feature in Microsoft C++. It can
use predefined class object for this work.
_Q
3. What happens when new fails?
ks
a) Returns zero always
b) Throws an exception always
c) Either throws an exception or returns zero
d) Terminates the program
oo
_B
Answer: c
es
Explanation: While creating new objects, the new operator may fail because of memory errors or due to permissions. At that
moment the new operator returns zero or it may throw an exception. The exception can be handled as usual.
ot
_N
4. If new throws an error, which function can be called to write a custom exception handler?
a) _set_handler
TU
b) _new_handler
c) _handler_setter
d) _set_new_handler
K
A
Answer: d
Explanation: If the default exception handler has to be replaced by a user defined handler, we can call _set_new_handler run-
e/
time library function with the function name as an argument. This lets the programmer to give a custom definition for handling new
t.m
operator failure.
5. In C++, if new operator is used, when is the constructor called?
/
s:/
d) Depends on code
Answer: b
Explanation: The constructor function is called after the allocation of memory. In C++ the feature works in a bit different way. The
memory for all the data members is allocated first and then the constructor function is called to finalize the memory allocated.
6. Which among the following is correct syntax to declare a 2D array using new operator?
a) char (*pchar)[10] = new char[][10];
b) char (pchar) = new char[][10];
c) char (*char) = new char[10][];
d) char (*char)[][10]= new char;
Answer: a
Explanation: The new operator usage to declare a 2D array requires a pointer and size of array to be declared. Data type and
then the pointer with size of array. The left index can be left blank or any variable can be assigned to it.
7. For declaring data by using new operator
Answer: d
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) New operator can allocate any type of functions
d) New operator is not applicable with functions allocation
nt
Answer: a
ua
Explanation: The new operator can’t allocate functions but can allocate pointer to the functions. This is a security feature as well
as to reduce the ambiguity in code. The new keyword is not given functionality to directly allocate any function.
_Q
10. Which among the following is added in grammar of new operator?
ks
a) Finalize
b) Arg
c) Initializer
d) Allocator
oo
_B
Answer: c
es
Explanation: The new operator grammar is added with an initializer field. This can be used to initialize an object with a user
defined constructor. Hence can allocate memory as intended by the programmer.
ot
_N
11. Initializers
a) Are used for specifying arrays
TU
Answer: c
Explanation: The initializers can’t be specified for arrays. The initializers can create arrays of object if and only if the class has a
e/
default constructor. That is a zero argument constructor so that it can be called without any argument.
t.m
Answer: b
Explanation: It is not necessary that the objects get destroyed when they go out of scope if allocated by using new operator. This
is because new operator returns a pointer to object that it had allocated. A suitable pointer with proper scope should be defined
by the programmer explicitly.
13. The new operator
a) Invokes function operator new
b) Doesn’t invoke function operator new
c) Invokes function operator only if required
d) Can’t invoke function operator new implicitly
Answer: a
Explanation: The new operator invokes function operator new. This is done to allocate the storage to an object. ::operator new is
called for storage allocation implicitly.
14. If a new operator is defined for a class and still global new operator have to be used, which operator should be used with the
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) All the objects should be of same class
d) All the objects should have different data
nt
Answer: c
ua
Explanation: The objects of an array must be of same class. This is mandatory because array is set of same type of elements.
The objects of same class are considered to be of same type.
_Q
3. What is the type of elements of array of objects?
ks
a) Class
b) Void
c) String
d) Null
oo
_B
Answer: a
es
Explanation: The class itself is the type of elements of array of objects. All the objects possess the same properties. Like any
other primitive data type, the objects are of their respective class type.
ot
_N
Class_name arrayName[size];
TU
Answer: b
Explanation: If the syntax given, is used to declare the array of objects, then the objects can’t be initialized individually. All the
objects will have to be initialized after this declaration.
/
s:/
5. Which is the condition that must be followed if the array of objects is declared without initialization, only with size of array?
tp
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
9. The objects in an object array
a) Can be created without use of constructor
b) Can be created without calling default constructor
nt
c) Can’t be created with use of constructor
ua
d) Can’t be created without calling default constructor
_Q
Answer: b
Explanation: The objects need some constructor to get the memory spaced reserved for those. If the default constructor is not
ks
used then we can use some arguments constructor which will reserve the memory for the objects. The objects can be passed
with constructor arguments during declaration.
10. The Object array is created in
oo
_B
a) Heap memory
b) Stack memory
es
c) HDD
d) ROM
ot
_N
Answer: a
Explanation: If the object arrays are declared dynamically, then the memory will be reserved on heap. The memory for objects will
be on stack only if some constructor or some call and return tasks are happening. The program doesn’t run on HDD and ROM is
TU
11. If an array of objects is of size 10 and a data value have to be retrieved from 5th object then syntax
A
should be used.
a) Array_Name[4].data_variable_name;
e/
b) Data_Type Array_Name[4].data_variable_name;
t.m
c) Array_Name[4].data_variable_name.value;
d) Array_Name[4].data_variable_name(value);
/
s:/
Answer: a
Explanation: The array name with the index of fifth element is called, i.e. index 4. Then the dot operator is used to access the
tp
data member of that object. This Allows us to access the data members of all the objects in an object array.
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Actually a pointer to an object is used
d) Actually copy of object is used
nt
Answer: a
ua
Explanation: Whenever an object is assigned to a variable or passed to a method, we aren’t actually using objects there. Actually
the reference to the objects is used. The reference makes a lot of difference as the main object may or may not get affected
_Q
depending on the code.
ks
3. Does use of object reference in assignment or passing means copy of the object is being used?
a) No, because the copy would create a new temporary variable
b) No, because the copy would not help to make changes to main object
c) Yes, because the reference directly means using address
oo
_B
d) Yes, because the reference directly means the constructors are involved
es
Answer: c
Explanation: We can’t say that the reference involves constructors in passing the objects to some method. The reference is used
ot
to denote the addresses and hence to point to the main object itself. There is no copy involved.
_N
import java.awt.Point;
class Testing
K
{
A
Point p1,p2;
t.m
p1=new Point(100,100);
p2=p1;
p1.x=200;
/
s:/
p1.y=200;
System.out.println(“Point 1: ” + p1.x + ”, “ + p1.y);
tp
}
}
a)
Point 1: 100, 100
Point 2: 200, 200
b)
Point 1: 200, 200
Point 2: 100, 100
c)
Point 1: 100, 100
Point 2: 100, 100
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
5. Is there any explicit use of pointers in java that would be applicable to objects?
a) Yes, we use reference for this purpose
b) Yes, we use java arrays for this purpose
c) No, implicit pointing is possible
d) No, direct class names should be used
Answer: c
Explanation: The question clearly asks if there is any explicit use of pointers related to objects. Pointers are not applicable in
java first of all. Secondly, the pointing in java is achieved implicitly using the references and object arrays.
um
6. Can a super class object give reference to a subclass method?
a) No, it is not possible
nt
b) Maybe, it is possible
c) No, it’s not possible
ua
d) No, It’s not possible in few cases only
_Q
Answer: c
Explanation: The object of a super class can never refer to methods of a subclass. Whereas vice versa is possible. If there is an
ks
overridden function in subclass, then the object of super class will execute the method of itself and not from the subclass.
{
public static void main(String[] args)
ot
{
_N
Point t1,t2,t3;
t1=new Point(100,100);
TU
t2=t1;
t3=t1;
t1.x=200;
K
t1.y=200;
A
t2.x=300;
t3.y=500;
e/
}
}
/
s:/
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Many at a time
c) Many using array name
nt
d) 7 at max at same time
ua
Answer: a
Explanation: There should not be any confusion in how many references can be made from a single variable. A single variable
_Q
can only point to one object at a time. Even if it’s an array, the name of the array is used and is considered one object name only
(representing first array element).
ks
12. Java handles memory dynamically and references are deleted as soon as they are out of scope.
a) True
b) False
oo
_B
Answer: a
es
Explanation: In Java, it is inbuilt feature that handles all the memory dynamically. It is not necessary to free or destroy all the
references made from a function which is going out of scope. You can call destroy or free methods explicitly but there is no
ot
mandatory rule.
_N
Answer: c
e/
Explanation: The object referencing will point to the same address if variables are assigned. All the variables might have a
t.m
different name but they will point to the same memory location. This is most basic concept of references.
14. Invoking a method on a particular object is sending a message to that object.
/
s:/
a) Different from
b) Same as
tp
c) Somewhat similar
ht
d) Part of
Answer: b
Explanation: The methods invoked on a particular object is same as sending a message with same values to that object.
Message would contain values in a particular format that can be used by the object. And calling a method would be just another
way to do the same task.
15. Can reference to an object be returned from a method?
a) Yes, always possible
b) Yes, but not always
c) No, never possible
d) No, Not possible because referred element would be destroyed
Answer: b
Explanation: This is possible but not always, since the reference being returned may get destroyed with the return of method.
This is an undesirable condition, hence it is not always possible to return references. But it is always possible if the referred
element is not local to the method.
um
c) 1
d) As many as you want
nt
Answer: d
ua
Explanation: You can create as many objects of a specific class as you want, provided enough memory is available.
_Q
3. Which among the following is false?
a) Object must be created before using members of a class
ks
b) Memory for an object is allocated only after its constructor is called
c) Objects can’t be passed by reference
d) Objects size depends on its class data members oo
_B
Answer: c
Explanation: Objects can be passed by reference. Objects can be passed by value also. If the object of a class is not created,
es
Answer: c
Explanation: The array must be specified with a size. You can’t declare object array, or any other linear array without specifying
A
a) Passed by reference
b) Passed by value
/
s:/
c) Passed by copy
d) Passed as function
tp
Answer: d
ht
Explanation: Object can’t be passed as function as it is an instance of some class, it’s not a function. Object can be passed by
reference, value or copy. There is no term defined as pass as function for objects.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) Object can be used/accessed/declared locally in that function
Answer: d
nt
Explanation: For an object which belongs to a local class, it is mandatory to declare and use the object within the function
ua
because the class is accessible locally within the class only.
_Q
10. Which among the following is wrong?
a) class student{ }; student s;
ks
b) abstract class student{ }; student s;
c) abstract class student{ }s[50000000];
d) abstract class student{ }; class toppers: public student{ }; topper t; oo
_B
Answer: b
Explanation: We can never create instance of an abstract class. Abstract classes doesn’t have constructors and hence when an
es
instance is created there is no facility to initialize its members. Option d is correct because topper class is inheriting the base
abstract class student, and hence topper class object can be created easily.
ot
_N
Answer: c
Explanation: The object declared in main() have local scope inside main() function only. It can’t be used outside main() function.
e/
d) Object are returned implicitly, we can’t say how it happens inside program
ht
Answer: a
Explanation: A temporary object is created to return the value. It is created because the object used in function is destroyed as
soon as the function is returned. The temporary variable returns the value and then gets destroyed.
13. Which among the following is correct?
a) class student{ }s1,s2; s1.student()=s2.student();
b) class student{ }s1; class topper{ }t1; s1=t1;
c) class student{ }s1,s2; s1=s2;
d) class student{ }s1; class topper{ }t1; s1.student()=s2.topper();
Answer: c
Explanation: Only if the objects are of same class then their data can be copied from to another using assignment operator. This
actually comes under operator overloading. Class constructors can’t be assigned any explicit value as in option class student{
}s1; class topper{ }t1; s1=t1; and class student{ }s1; class topper{ }t1; s1.student()=s2.topper();.
14. Which among following is correct for initializing the class below?
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
15. Object can’t be used with pointers because they belong to user defined class, and compiler can’t decide the type of data
may be used inside the class.
a) True
um
b) False
Answer: b
nt
Explanation: The explanation given is wrong because object can always be used with pointers like with any other variables.
ua
Compiler doesn’t have to know the structure of the class to use a pointer because the pointers only points to a memory
address/stores that address.
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
class student
{
um
int marks;
}
student s1;
nt
student s2=2;
ua
a) Object s1 should be passed with argument
_Q
b) Object s2 should not be declared
c) Object s2 will not be created, but program runs
ks
d) Program gives compile time error
Answer: d oo
Explanation: The object s2 can be assigned with one value only if a single argument constructor is defined in class, but here, it
_B
can’t be done as no constructor is defined. Hence every object must be declare or created without using arguments.
es
b) Parameterized
_N
c) Copy
d) Direct assignment is used
TU
Answer: c
Explanation: Copy constructor is used while an object is assigned with another. This is mandatory since we can’t decide which
K
member should be assigned to which member value. By using copy constructor, we can assign the values in required form.
A
Answer: a
tp
Explanation: Object must be passed by reference to copy constructor because constructor is not called in pass by reference.
Otherwise, in pass by value, a temporary object will be created which in turn will try to call its constructor that is already being
ht
used. This results in creating infinite number of objects and hence memory shortage error will be shown.
5. Which specifier applies only to the constructors?
a) Public
b) Protected
c) Implicit
d) Explicit
Answer: d
Explanation: The keyword explicit can be used while defining the constructor only. This is used to suppress the implicit call to the
constructor. It ensures that the constructors are being called with the default syntax only (i.e. only by using object and constructor
name).
6. Which among the following is true?
a) Default constructor can’t be defined by the programmer
b) Default parameters constructor isn’t equivalent to the default constructor
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: a
nt
Explanation: Static constructors help in initializing the static members of the class. This is provided because the static members
are not considered to be property of the object, rather they are considered as the property of class.
ua
9. When and how many times a static constructor is called?
_Q
a) Created at time of object destruction
b) Called at first time when an object is created and only one time
ks
c) Called at first time when an object is created and called with every new object creation
d) Called whenever an object go out of scope
Answer: b
oo
_B
Explanation: Those are called at very first call of object creation. That is called only one time because the value of static
members must be retained and continued from the time it gets created.
es
Explanation: Static constructors can’t be parameterized constructors. Those are used to initialize the value of static members
A
only. And that must be a definite value. Accepting arguments may make it possible that static members loses their value with
every new object being created.
e/
t.m
Answer: a
tp
Explanation: Since the static constructors are can’t be parameterized, they can’t be overloaded. Having this case, only one
ht
constructor will be possible to be created in a local scope, because the signature will always be same and hence it will not be
possible to overload static constructor.
12. Default constructor initializes all data members as
a) All numeric member with some garbage values and string to random string
b) All numeric member with some garbage values and string to null
c) All numeric member with zero and strings to random value
d) All numeric member with zero and strings to null
Answer: d
Explanation: Default constructor, which even the programmer doesn’t define, always initialize the values as zero if numeric and
null if string. This is done so as to avoid the accidental values to change the conditional statements being used and similar
conditions.
13. When is the static constructor called?
a) After the first instance is created
b) Before default constructor call of first instance
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
15. Which among the following is correct, based on the given code below?
class student
{
um
int marks;
public : student()
{
nt
cout<<”New student details can be added now”;
ua
}
};
_Q
student s1;
ks
a) Cout can’t be used inside the constructor
b) Constructor must contain only initializations
c) This program works fine
d) This program produces errors
oo
_B
Answer: c
es
Explanation: This program will work fine. This is because it is not mandatory that a constructor must contain only initialization
only. If you want to perform a task on each instance being created, that code can be written inside the constructor.
ot
_N
To practice all areas of Object Oriented Programming using C++ for online Quizzes, .
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) Scope of an object
Answer: c
nt
Explanation: A class is Blueprint of an object which describes/ shows all the functions and data that are provided by an object of
ua
a specific class. It can’t be called as parent or instance of an object. Class in general describes all the properties of an object.
_Q
3. Who invented OOP?
a) Alan Kay
ks
b) Andrea Ferro
c) Dennis Ritchie
d) Adele Goldberg oo
_B
Answer: a
Explanation: Alan Kay invented OOP, Andrea Ferro was a part of SmallTalk Development. Dennis invented C++ and Adele
es
Goldberg was in team to develop SmallTalk but Alan actually had got rewarded for OOP.
ot
a) Data members
b) Member functions
TU
Answer: b
A
Explanation: Member functions are allowed inside a class but were not present in structure concept. Data members, static data
and public access specifiers were present in structures too.
e/
t.m
c) Duplicate/Redundant data
d) Efficient Code
tp
Answer: c
ht
Explanation: Duplicate/Redundant data is dependent on programmer and hence can’t be guaranteed by OOP. Code reusability
is done using inheritance. Modularity is supported by using different code files and classes. Codes are more efficient because
of features of OOP.
6. Pure OOP can be implemented without using class in a program. (True or False)
a) True
b) False
Answer: b
Explanation: It’s false because for a program to be pure OO, everything must be written inside classes. If this rule is violated, the
program can’t be labelled as purely OO.
7. Which Feature of OOP illustrated the code reusability?
a) Polymorphism
b) Abstraction
c) Encapsulation
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: d
Explanation: Any number of classes can be defined inside a program, provided that their names are different. In java, if public
nt
class is present then it must have the same name as that of file.
ua
10. When OOP concept did first came into picture?
a) 1970’s
_Q
b) 1980’s
c) 1993
ks
d) 1995
Answer: a oo
Explanation: OOP first came into picture in 1970’s by Alan and his team. Later it was used by some programming languages
_B
and got implemented successfully, SmallTalk was first language to use pure OOP and followed all rules strictly.
es
Answer: a
Explanation: As Java supports usual declaration of data variables, it is partial implementation of OOP. Because according to
K
rules of OOP, object constructors must be used, even for declaration of variables.
A
Answer: b
tp
Explanation: In C++, it’s not necessary to use classes, and hence codes can be written without using OOP concept. Classes
may or may not contain member functions, so it’s not a necessary condition in C++. And, an object can only be declared in a
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
2. If a function can perform more than 1 type of tasks, where the function name remains same, which feature of OOP is used
here?
a) Encapsulation
um
b) Inheritance
c) Polymorphism
nt
d) Abstraction
ua
Answer: c
Explanation: For the feature given above, the OOP feature used is Polymorphism. Example of polymorphism in real life is a kid,
_Q
who can be a student, a son, a brother depending on where he is.
ks
3. If different properties and functions of a real world entity is grouped or embedded into a single element, what is it called in
OOP language?
a) Inheritance
b) Polymorphism
oo
_B
c) Abstraction
d) Encapsulation
es
Answer: d
ot
Explanation: It is Encapsulation, which groups different properties and functions of a real world entity into single element.
_N
Abstraction, on other hand, is hiding of functional or exact working of codes and showing only the things which are required by
the user.
TU
b) Inheritance
A
Answer: c
Explanation: Data must be declared using objects. Object usage is mandatory because it in turn calls its constructors, which in
turn must have a class defined. If object is not used, it is a violation of pure OOP concept.
/
s:/
a) Platform independent
b) Data binding
ht
c) Message passing
d) Data hiding
Answer: a
Explanation: Platform independence is not feature of OOP. C++ supports OOP but it’s not a platform independent language.
Platform independence depends on programming language.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: a
nt
Explanation: There are 7 basic features that define whether a programing language is pure OOP or not. The 4 basic features are
inheritance, polymorphism, encapsulation and abstraction. Further, one is, object use is must, secondly, message passing and
ua
lastly, Dynamic binding.
_Q
9. The feature by which one object can interact with another object is
a) Data transfer
ks
b) Data Binding
c) Message Passing
d) Message reading oo
_B
Answer: c
Explanation: The interaction between two object is called the message passing feature. Data transfer is not a feature of OOP.
es
a) Nested class
b) Enclosing class
TU
c) Inline function
d) Virtual Function
K
Answer: d
A
Explanation: Virtual Functions can be defined in any class using the keyword virtual. All the classes which inherit the class
containing the virtual function, define the virtual function as required. Redefining the function on all the derived classes according
e/
11. Which feature in OOP is used to allocate additional function to a predefined operator in any language?
a) Operator Overloading
/
s:/
b) Function Overloading
c) Operator Overriding
tp
d) Function Overriding
ht
Answer: a
Explanation: The feature is operator overloading. There is not a feature named operator overriding specifically. Function
overloading and overriding doesn’t give addition function to any operator.
12. Which among doesn’t illustrates polymorphism?
a) Function overloading
b) Function overriding
c) Operator overloading
d) Virtual function
Answer: b
Explanation: Function overriding doesn’t illustrate polymorphism because the functions are actually different and theirs scopes
are different. Function and operator overloading illustrate proper polymorphism. Virtual functions show polymorphism because
all the classes which inherit virtual function, define the same function in different ways.
13. Exception handling is a feature of OOP.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) It’s vice-versa is true
Answer: a
nt
Explanation: It is always true as we have the facility of private and protected access specifiers. Also, only the public and global
ua
data are available globally or else the program should have proper permission to access the private data.
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) No, programmer can’t do it
d) No, never
nt
Answer: d
ua
Explanation: The constructor must be having the same name as that of a class. Hence a constructor of one class can’t even be
defined in another class. Since the constructors can’t be defined in derived class, it can’t be overloaded too, in derived class.
_Q
3. Does constructor overloading include different return types for constructors to be overloaded?
ks
a) Yes, if return types are different, signature becomes different
b) Yes, because return types can differentiate two functions
c) No, return type can’t differentiate two functions
d) No, constructors doesn’t have any return type
oo
_B
Answer: d
es
Explanation: The constructors doesn’t have any return type. When we can’t have return type of a constructor, overloading based
on the return type is not possible. Hence only parameters can be different.
ot
_N
Answer: a
Explanation: All the constructors defined in a class must have a different signature in order to be overloaded. Here one default
e/
and other parameterized constructors are used, wherein one is of only one parameter and other accepts two. Hence overloading
t.m
is possible.
5. Which constructor will be called from the object created in the code below?
/
s:/
class A
tp
{
int i;
ht
A()
{
i=0; cout<<i;
}
A(int x=0)
{
i=x; cout<<I;
}
};
A obj1;
a) Default constructor
b) Parameterized constructor
c) Compile time error
d) Run time error
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: d
nt
Explanation: The constructor is called as soon as the object is created. The overloading comes into picture as to identify which
constructor have to be called depending on arguments passed in the creation of object.
ua
8. Which among the following function can be used to call default constructor implicitly in java?
_Q
a) this()
b) that()
ks
c) super()
d) sub()
Answer: a
oo
_B
Explanation: The function this() can be used to call the default constructor from inside any other constructor. This helps to further
reuse the code and not to write the redundant data in all the constructors.
es
Explanation: The constructors are overloaded to initialize the objects of a class in different ways. This allows us to initialize the
A
object with either default values or used given values. If data members are not initialized then program may give unexpected
results.
e/
t.m
Answer: a
Explanation: When the programmer doesn’t specify any default constructor and only defines some parameterized constructor.
The compiler doesn’t provide any default constructor implicitly. This is because it is assumed that the programmer will create the
objects only with constructors.
11. Which among the following is not valid in java?
a) Constructor overloading
b) Recursive constructor call
c) Default value constructors
d) String argument constructor
Answer: b
Explanation: Java doesn’t provide the feature to recursively call the constructor. This is to eliminate the out of memory error in
some cases that arises unexpectedly. That is an predefined condition for constructors in java.
12. Which constructor will be called from the object obj2 in the following program?
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
b) A(int y)
c) A(int y, int x)
nt
d) A(int y; int x)
ua
Answer: c
_Q
Explanation: The two argument constructor will be called as we are passing 2 arguments to the object while creation. The
arguments will be passed together and hence compiler resolves that two argument constructor have to be called.
ks
13. What are we only create an object but don’t call any constructor for it in java?
a) Implicit constructor will be called
b) Object is initialized to some null values oo
_B
c) Object is not created
d) Object is created but points to null
es
Answer: d
ot
Explanation: The object becomes a reference object which can be initialized will another object. Then this object will indirectly
become another name of the object being assigned. If not assigned, it simply points to null address.
_N
Answer: a
e/
Explanation: Kotlin language allows constructor overloading. This is a basic feature for the constructors. The constructor
t.m
um
c) this pointer is passed with help of pointer member functions are called
d) this pointer is passed with help of void pointer member functions are called
nt
Answer: a
ua
Explanation: When an object calls some member function, it implicitly passes itself as an argument. This allows the compiler to
know which member should be used for the purposes. This also allows to reduce the ambiguity among the variable and data
_Q
member names.
ks
3. The this pointer is accessible
a) Within all the member functions of the class
b) Only within functions returning void
c) Only within non-static functions
oo
_B
d) Within the member functions with zero arguments
es
Answer: c
Explanation: The this pointer is available only within the non-static member functions of a class. If the member function is static, it
ot
will be common to all the objects and hence a single object can’t refer to those functions independently.
_N
Answer: d
e/
Explanation: The object’s this pointer being called are not part of the object itself. This can be cross verified by checking that it
t.m
Answer: c
Explanation: The space taken by this pointer is not reflected in by the sizeof() operator. This is because object’s this pointer is
not part of object itself. This is a cross verification for the concept stating that this pointer doesn’t take any space in the object.
6. Whenever non-static member functions are called
a) Address of the object is passed implicitly as an argument
b) Address of the object is passed explicitly as an argument
c) Address is specified globally so that the address is not used again
d) Address is specified as return type of the function
Answer: a
Explanation: The address is passed implicitly as an argument to the function. This doesn’t have to be passed explicitly. The
address is passed, of the object which is calling the non-static member function.
7. Which is the correct interpretation of the member function call from an object, object.function(parameter);
Answer: d
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) This pointer can be used to guard from other pointers
d) This pointer can be used to guard from parameter referencing
nt
Answer: b
ua
Explanation: The this pointer can be used to guard itself whenever self-reference is used. This allows accidental address
access. And accidental modification of data.
_Q
10. Which syntax doesn’t execute/is false when executed?
ks
a) if(&object != this)
b) if(&function !=object)
c) this.if(!this)
d) this.function(!this)
oo
_B
Answer: a
es
Explanation: The condition becomes false when executed and hence doesn’t executes. This is the case where this pointer can
guard itself from the self-reference. Here if the address of the object doesn’t match with this pointer that means the object
ot
d) Are non-modifiable
A
Answer: d
e/
Explanation: The this pointer is non modifiable. This is because the address of any object remains constant throughout its life
t.m
time. Hence the address must not be changed otherwise wrong members of invalid addresses might get accessed.
12. Earlier implementations of C++
/
s:/
Answer: c
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Object-based language
d) If classes are supported, polymorphism will always be supported
nt
Answer: c
ua
Explanation: The languages which support classes but doesn’t support polymorphism, are known as object-based languages.
Polymorphism is such an important feature, that is a language doesn’t support this feature, it can’t be called as a OOP language.
_Q
3. Which among the following is the language which supports classes but not polymorphism?
ks
a) SmallTalk
b) Java
c) C++
d) Ada
oo
_B
Answer: d
es
Explanation: Ada is the language which supports the concept of classes but doesn’t support the polymorphism feature. It is an
object-based programming language. Note that it’s not an OOP language.
ot
_N
4. If same message is passed to objects of several different classes and all of those can respond in a different way, what is this
feature called?
a) Inheritance
TU
b) Overloading
c) Polymorphism
K
d) Overriding
A
Answer: c
e/
Explanation: The feature defined in question defines polymorphism features. Here the different objects are capable of
t.m
{
public : int marks;
ht
calc_grade();
}
class topper:public student
{
public : calc_grade()
{
return 10;
}
};
class average:public student
{
public : calc_grade()
{
return 20;
}
};
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
we are not sure about all these, we can’t say whether it can show polymorphism or not.
7. In case of using abstract class or function overloading, which function is supposed to be called first?
nt
a) Local function
ua
b) Function with highest priority in compiler
c) Global function
_Q
d) Function with lowest priority because it might have been halted since long time, because of low priority
ks
Answer: b
Explanation: Function with highest priority is called. Here, it’s not about the thread scheduling in CPU, but it focuses on whether
oo
the function in local scope is present or not, or if scope resolution is used in some way, or if the function matches the argument
signature. So all these things define which function has the highest priority to be called in runtime. Local function could be one of
_B
the answer but we can’t say if someone have used pointer to another function or same function name.
es
Answer: a
Explanation: Static member functions are not property of any object. Hence it can’t be considered for overloading/overriding. For
K
class student
{
public : int marks;
/
s:/
void disp()
{
tp
};
class topper:public student
{
public :
void disp()
{
cout<<”Its derived class”;
}
}
void main() { student s; topper t;
s.disp();
t.disp();
}
a) Its base classIts derived class
b) Its base class Its derived class
c) Its derived classIts base class
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
class education
{
um
char name[10];
public : disp()
{
nt
cout<<”Its education system”;
ua
}
class school:public education
_Q
{
public: void dsip()
ks
{
cout<<”Its school education system”;
}
};
oo
_B
void main()
{
es
school s;
ot
s.disp();
}
_N
}
TU
Answer: a
e/
Explanation: Notice that the function name in derived class is different from the function name in base class. Hence when we call
t.m
the disp() function, base class function is executed. No polymorphism is used here.
/
a) True
b) False
tp
ht
Answer: a
Explanation: It is possible to implement polymorphism in C language, even though it doesn’t support class. We can use
structures and then declare pointers which in turn points to some function. In this way we simulate the functions like member
functions but not exactly member function. Now we can overload these functions, hence implementing polymorphism in C
language.
13. Which problem may arise if we use abstract class functions for polymorphism?
a) All classes are converted as abstract class
b) Derived class must be of abstract type
c) All the derived classes must implement the undefined functions
d) Derived classes can’t redefine the function
Answer: c
Explanation: The undefined functions must be defined is a problem, because one may need to implement few undefined
functions from abstract class, but he will have to define each of the functions declared in abstract class. Being useless task, it is
a problem sometimes.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
15. If 2 classes derive one base class and redefine a function of base class, also overload some operators inside class body.
Among these two things of function and operator overloading, where is polymorphism used?
a) Function overloading only
b) Operator overloading only
c) Both of these are using polymorphism
d) Either function overloading or operator overloading because polymorphism can be applied only once in a program
Answer: d
Explanation: Both of them are using polymorphism. It is not necessary that polymorphism can be used only once in a program, it
can be used anywhere, any number of times in a single program.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
1. If a function has to be called only by using other member functions of the class, what should be the access specifier used for
that function?
a) Private
b) Protected
c) Public
d) Default
Answer: a
Explanation: The function should be made private. In this way, the function will be available to be called only from the class
member functions. Hence the function will be secure from the outside world.
2. Which among the following is correct for the code given below?
um
class student
{
private: student()
nt
{
ua
}
public : student( int x)
_Q
{
marks =x;
ks
}
};
a) The object can never be created
oo
_B
b) The object can be created without parameters
c) Only the object with only 1 parameter can be created
es
Answer: c
_N
Explanation: For creating object without parameters, the default constructor must be defined in public access. But here, only
parameterized constructor is public, hence the objects being created with only one parameter will only be allowed.
TU
3. Which among the following is true for the code given below?
K
class A
{
A
public :
t.m
A(int x=100)
{
marks=x;
/
s:/
}
};
tp
ht
5. If private members have to be accessed directly from outside the class but the access specifier must not be changed, what
should be done?
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Explanation: The private members are most secure in inheritance. The default members can still be in inherited in special cases,
but the private members can’t be accessed in any case.
nt
7. Choose the correct option for the code given below.
ua
class A{ static int c=0; public: A(){ c++; } };
a) Constructor will make c=1 for each object created
_Q
b) Constructor will make c=0 for each object created
c) Constructor will keep number of objects created
ks
d) Constructor will just initialize c=0 then increment by 1
Answer: c oo
Explanation: The constructor is using a static member to keep the count of the number of objects created. This is done because
_B
the variable c is static and hence the value will be common for all the objects created.
es
class A
_N
{
private : int sum(int x, int y)
{
TU
return x+y;
}
K
public: A()
A
{
}
e/
A(int x, int y)
t.m
{
cout<<sum(x,y);
/
}
s:/
};
tp
b) Constructor prints sum, if two parameters are passed with object creation
c) Constructor will give error if float values are passed
d) Constructor will take 0 as default value of parameters if not passed
Answer: d
Explanation: Constructor is not having any default arguments hence no default value will be given to any parameters. Only integer
values must be passed to the constructor if we need the sum as output, otherwise if float values are passed, type mismatch will
be shown as error.
class A()
{
int marks; char name[20];
public : A()
{
marks=100;
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: a
Explanation: The private functions can also be overloaded. This can be done in usual way by having the same name of the
member function and having different signature. Only thing is, they must be accessed from members of class only.
nt
ua
11. Which among the following is true?
a) Private member functions can’t be overloaded
_Q
b) Private member functions can be overridden
c) Private member functions can’t be overloaded with a public member
ks
d) Private member function can’t be overridden
Answer: d oo
Explanation: The private member functions can be overloaded but they can’t be overridden. This is because, overriding means a
_B
function with same name in derived class, gets more priority when called from object of derived class. Here, the member function
is private so there is no way that it can be overridden.
es
12. Which data member in following code will be used whenever an object is created?
ot
_N
Class A
{
int x; int y; int z;
TU
public : A()
{
K
y=100; x=100*y;
A
}
};
e/
t.m
a) x will be used
b) y will be used
c) z will be used
/
s:/
Answer: c
Explanation: Whenever an object will be created, the constructor will be called. Inside constructor we are using the data
ht
members x and y. Hence these two will always be used with each object creation.
13. Which member can be considered most secure in the code below?
class A()
{
int a;
private : int b;
protected : int c;
public : int d;
};
a) a
b) b
c) c
d) d
14. Which among the following is correct for the code given below?
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: a
nt
Explanation: The program will be giving a compile time error as the default constructor is private in class. And, the logical errors
are usually runtime so we can’t say that the program will give logical error. The program will not run.
ua
15. Which among the following is correct?
_Q
a) Private specifier must be used before public specifier
b) Private specifier must be used before protected specifier
ks
c) Private specifier must be used first
d) Private specifier can be used anywhere in class
Answer: d
oo
_B
Explanation: The private specifier can be used anywhere in the class as required. It is not a rule to mention the private members
first and then others. It is just followed to write first for better readability.
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
1. Which among the following is true for the code given below?
class A
{
int marks;
public : disp()
{
cout<<marks;
}
}
class B: protected A
{
char name[20];
um
}
A a; a.disp();
nt
B b; b.disp();
ua
a) Only object of class A can access disp() function
b) Only object of class B can access disp() function
_Q
c) Both instances can access disp() function
d) Accessing disp() outside class is not possible
ks
Answer: a
oo
Explanation: The object of class A can access the disp() function. This is because the disp() function is public in definition of
class A. But it can’t be accessed from instance of class B because the disp() function is protected in class B, since it was
_B
inherited as protected.
es
2. If the members have to be accessed from anywhere in the program and other packages also, which access specifier should
ot
be used?
a) Public
_N
b) Private
c) Protected
TU
d) Default
Answer: a
K
Explanation: The access specifier must be public so as to access the members outside the class and anywhere within the
A
program without using inheritance. This is a rule, predefined for the public members.
e/
3. Which among the following have least security according to the access permissions allowed?
t.m
a) Private
b) Default
/
c) Protected
s:/
d) Public
tp
Answer: d
ht
Explanation: The public members are available to the whole program. This makes the members most vulnerable to accidental
changes, which may result in unwanted modification and hence unstable programming.
4. Which among the following can be used for outermost class access specifier in java?
a) Private
b) Public
c) Default
d) Default or Public
Answer: d
Explanation: Either default or public access specifier must be used for outermost classes. Private can be used with inner
classes. This is done so that all the members can access and use the utmost class and that program execution can be done
from anywhere. Inner classes can be made private for security.
5. We can reduce the visibility of inherited methods.
a) True
b) False
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: a
Explanation: There can be only one public class in a java program. The public class name must match the name of file. And there
can’t be more than one class with same name in a single program in same scope. Hence it is not possible to have more than
nt
one public class in java program.
ua
8. What is the output of the following code?
_Q
package pack1;
ks
class A
{
public A()
{
oo
_B
System.out.print(“object created”);
}
es
}
ot
package pack2;
import pack1.*;
_N
class B
{
TU
A a=new A();
}
K
Answer: c
/
Explanation: The program will give compile time error. Class A is defined with default access specifier. This directly means that
s:/
class A will be available within package only. Even if the constructor is public, the object will not be created.
tp
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
13. If a class doesn’t have public members, then
a) None of its members will be able to get inherited
nt
b) None of its instance creation will be allowed
ua
c) None of its member function can be called outside the class
d) None of its data members will be able to get initial value
_Q
Answer: c
ks
Explanation: According to rule of private, protected and default access specifiers, none of the members under these specifiers
will be able to get invoked outside the class. We are not sure about the members of class specifically so other options doesn’t
give a fixed answer. oo
_B
14. In multi-level inheritance(all public), the public members of parent/superclass will
a) Will continue to get inherited subsequently
es
Answer: a
TU
Explanation: The public inheritance makes the public members of the base class, public in derived classes. This can be used
when the same feature have to be redefined with each new class inheriting the base class.
K
15. Which specifier allows to secure the public members of base class in inherited classes?
A
a) Private
b) Protected
e/
c) Public
t.m
Explanation: Both the private and protected specifiers can make the public members of the base class more secure. This is
useful if we stop using the parent class members and use the classes which inherited the parent class, so as to secure data
tp
better.
ht
um
c) Public member functions are declared outside the class
d) Public member functions can be called using object of class
nt
Answer: d
ua
Explanation: The public member functions can be called using object of the class. The members can’t be declared outside the
class as those would become non-member functions of the class. The functions have security as those can be accessed using
_Q
the class object only.
ks
3. Which type of member functions get inherited in the same specifier in which the inheritance is done? (If private inheritance is
used, those become private and if public used, those become public)
a) Private member functions
b) Protected member functions
oo
_B
c) Public member functions
d) All member functions
es
Answer: c
ot
Explanation: The public member functions gets into the same specifier in which the inheritance is done. If protected members
_N
are involved in public inheritance, still those remain protected in the derived class but public members become public on public
inheritance and protected in protected inheritance.
TU
4. Which syntax among the following is correct for public member functions?
a) public::void functionName(parameters)
K
c) public(void functionName(parameters))
d) public:-void functionName(Parameters)
e/
t.m
Answer: b
Explanation: The public member functions declaration must be mentioned with the keyword public. The syntax given is used in
java. Keyword public is followed by the usual function declaration.
/
s:/
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
generated.
9. Which call is correct for public members of a nested class?
nt
a) Can be called from object of enclosing class
ua
b) Can be called within enclosing class only with direct names
c) Direct names should be used for the nested classes
_Q
d) Only with help of nested class object pointer
ks
Answer: a
Explanation: The closest definition is that any public member function of the nested class can be accessed with the help of
oo
enclosing class object. The nested class object pointer can be used only within the enclosing class. It’s not mandatory to use the
members of nested class only within the enclosing class.
_B
10. Which public function call among the following is correct outside the class, if return type is void (C++)?
es
a) object.void functionName(parameters);
b) object.functionName(parameters);
ot
d) object.void functionName();
TU
Answer: b
Explanation: The condition given says that there is no return type hence we can call the function directly. The object name should
be mentioned with a dot operator to access its class members. Then the function name with parameters, if required, can be
K
given.
A
11. If public members are to be restricted from getting inherited from the subclass of the class containing that function, which
e/
alternative is best?
t.m
Answer: b
ht
Explanation: If private inheritance is used then the class containing the function will be able to use the function with rules of
whichever specifier is used. Then the derived class makes those function the private members of itself. This restricts the public
members of parent class from further inheritance.
12. A derived class object can access the public members of the base class.
a) True
b) False
Answer: b
Explanation: The public members of the base class can be accessed from the derived class object only if public inheritance is
used. If protected or private inheritance is used then those members become public/protected in derived class and hence won’t
be able to be called from object of the derived class.
13. If a class have a public member function and is called directly in the main function then
a) Undeclared function error will be produced
b) Out of memory error is given
c) Program gives warning only
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: d
Explanation: The public member function can access any private, protected and public member of its class. Not only public
nt
member function, any member function of a class can access each and every other member declared inside the class. Hence
ua
are flexible to program.
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
2. Which keyword must be used to declare a member function as a constant member function?
a) Constant
b) Const
um
c) FunctionConst
d) Unchanged
nt
Answer: b
ua
Explanation: The keyword const is provided in most of the programming languages. This indicates that the member on which it is
specified remains constant with the respective values of members. The keyword must be mentioned so as to declare a member
_Q
function to be constant.
ks
3. Which objects can call the const functions?
a) Only const objects
b) Only non-const objects
c) Both const and non-const objects
oo
_B
d) Neither const not non-const objects
es
Answer: c
Explanation: All the objects of a class can call const functions for its use. Const objects can call the const functions to since those
ot
values are already constant. And the non- const objects can call the const functions to keep their values constant.
_N
4. Non-const functions
TU
Answer: a
e/
Explanation: The non-const functions are able to modify the values of object which called the function. So only the non-const
t.m
functions can be called. If const object is used then the compiler produces an error as the const object is being given to a
function which can modify its values.
/
s:/
c) Const member functions can call only the functions which are neither const nor non-const
d) Const member functions can call only data members of call not member functions
Answer: a
Explanation: The const member functions are restricted to call any other non-const member functions. This is to ensure that the
const function doesn’t have any code that might modify the calling object.
6. If a const object calls a non-const member function then
a) Run time error may get produced
b) Compile time error may get produced
c) Either compile time or run time error is produced
d) The program can’t be compiled
Answer: b
Explanation: The program gets compiled but produces an error. The error is produced because a constant value is being
changed. Even if there is no code that can change any object value, but non-const member functions are assumed to change the
values.
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Function prototyping
c) Function overloading
d) Function declaring
nt
ua
Answer: c
Explanation: The functions can be declared const and non-const in the same program. The technique used is function
_Q
overloading. We can define a const function and then a non-const version of same function using overloading.
ks
10. When both the const and non-const version of functions are required?
a) Return value have to be different in const
b) Return value have to be same in const
c) Return values have to be ignored
oo
_B
d) Return values have to be suppressed
es
Answer: a
Explanation: The return values can help to overload the functions. Also, this will allow us to use a non-const function to be called
ot
d) const (functionName(parameters));
A
Answer: b
e/
Explanation: The function declaration must contain the keyword const. The const keyword makes the function const type. The
t.m
usual function declaration can be given followed by the keyword. The keyword const can be given after the declaration of function
and before definition.
/
s:/
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Temporary object may or may not be created
d) New permanent object is created
nt
Answer: a
ua
Explanation: A temporary object is created when an object is returned by value. The temporary object is used to copy the values
to another object or to be used in some way. The object holds all the values of the data members of the object.
_Q
3. Where the temporary objects (created while return by value) are created?
ks
a) Outside the function scope
b) Within the function
c) Inside the main function
d) Inside the calling function
oo
_B
Answer: b
es
Explanation: The temporary object are created within the function and are intended to return the value for specific use. Either the
object can be assigned to another object or be used directly if possible.
ot
_N
b) object functionName( ) { }
c) class object functionName( ) { }
d) ClassName functionName ( ){ }
K
A
Answer: d
Explanation: The class name itself should be the return type of the function. This notifies that the function will return an object of
e/
5. Which is the correct syntax for defining a function which passes an object by reference?
a) className& functionName ( )
/
s:/
b) className* functionName( )
c) className-> functionName( )
tp
d) &className functionName()
ht
Answer: a
Explanation: The function declaration must contain the class name as return type. But, a & symbol should be followed by the
class name. & indicates that the object being returned will be returned by reference.
6. If an object is declared inside the function then outside the function.
a) It can be returned by reference
b) It can’t be returned by reference
c) It can be returned by address
d) It can’t be returned at all
Answer: b
Explanation: The object which is declared inside the class can never be returned by reference. This is because the object will be
destroyed as it goes out of scope when the function is returned. The local variables get destroyed when function is returned
hence the local objects can’t be returned by reference.
7. How many independent objects can be returned at same time from a function?
Answer: a
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
c) Temporary object is created for few seconds
d) Temporary object is not created
nt
Answer: d
ua
Explanation: The temporary object is not created. If object is returned by reference, a particular memory location will be denoted
with another name and hence same address values will be used.
_Q
10. Which among the following is correct?
ks
a) Individual data members can’t be returned
b) Individual data members can be returned
c) Individual member functions can be returned from another function
d) Individual data members can only be passed by reference
oo
_B
Answer: b
es
Explanation: It is not mandatory to return the whole object. Instead we can return a specific data member value. But the return
type given must match with the data type of the data being returned.
ot
_N
Answer: a
Explanation: The Object array can be returned from a function. This can be done by putting a className* as the return type of
e/
the function. This makes the return type to accept an array of objects in return.
t.m
b) False
tp
Answer: b
Explanation: It is not compulsory to return the object in the same way as it was passed. If the object is passed by reference then
ht
there is actually no need to return the object. Because the changes made inside the function will be visible on the original object
of caller function also.
13. Which among the following is true?
a) Two objects can point to the same memory location
b) Two objects can never point to the same memory location
c) Objects not allowed to point at a location already occupied
d) Objects can’t point to any address
Answer: a
Explanation: When an object is created and instead of calling a constructor, another object is assigned to it. Both the objects
point to the same memory location. This can be illustrated with help of return by reference.
14. If an object is being returned by value then
a) Its member values are made constant
b) Its member values have to be copied individually
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Those is enclosing class
d) Those are all independent classes
nt
Answer: a
ua
Explanation: Since class A is derived from class C and then class B is derived from class D, there are two pairs of classes
which shows single inheritance. Those two pairs are independent of each other though.
_Q
3. If single inheritance is used, program will contain
ks
a) At least 2 classes
b) At most 2 classes
c) Exactly 2 classes
d) At most 4 classes
oo
_B
Answer: a
es
Explanation: The program will contain at least 2 classes in the sense of base and derived classes. At least one base class and
one derived class must be there. Types of inheritance remains the same though.
ot
_N
b) Compile time
c) Multiple inheritance
d) Language independency
K
A
Answer: a
Explanation: The runtime inheritance is done when object of a class is created to call a method. At runtime the function is
e/
searched if it is in class of object. If not, it will search in its parent classes and hierarchy for that method.
t.m
class A
{
tp
protected int a, b;
public: void show()
ht
{
cout<<a<<b;
}
};
class B: public A
{
public: void disp()
{
cout<<a++<<b++;
}
};
class C: private A, public B
{
void avg()
{
cout<<(a+b)/2;
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
6. If single level inheritance is used and an abstract class is created with some undefined functions, can its derived class also
skip some definitions?
a) Yes, always possible
b) Yes, possible if only one undefined function
c) No, at least 2 undefined functions must be there
d) No, the derived class must implement those methods
Answer: d
Explanation: The derived class must implement those methods. This is because the parent class is abstract and hence will have
um
some undefined functions which has to be defined in derived classes. Since we are using single level inheritance, if derived
class doesn’t implement those functions then one more class has to be there which will become multi-level inheritance.
nt
7. Which among the following is false for single level inheritance?
ua
a) There can be more than 2 classes in program to implement single inheritance
b) There can be exactly 2 classes to implement single inheritance in a program
_Q
c) There can be more than 2 independent classes involved in single inheritance
d) The derived class must implement all the abstract method if single inheritance is used
ks
Answer: c
oo
Explanation: If more than 2 independent classes are involved to implement the single level inheritance, it won’t be possible as
there must be only one child and one parent class and none other related class.
_B
8. Which concept will result in derived class with more features (consider maximum 3 classes)?
es
a) Single inheritance
b) Multiple inheritance
ot
c) Multilevel inheritance
_N
d) Hierarchical inheritance
TU
Answer: b
Explanation: If single inheritance is used then only feature of a single class are inherited, and if multilevel inheritance is used, the
2nd class might have use private inheritance. Hence only multiple inheritance can result in derived class with more features. This
K
is not mandatory but in a case if we consider same number of features in each class, it will result the same.
A
a) Multiple inheritance
t.m
b) Interfaces
c) Implementations
d) Extensions
/
s:/
Answer: a
tp
Explanation: Interfaces also represent a way of inheritance but is a wide word to decide which inheritance we are talking about in
it, hence can’t be considered. Implementation and extensions also doesn’t match that level of specific idea. And multiple
ht
class A
{
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
class A
{
nt
float sal=40000;
ua
}
class B extends A
_Q
{
int salBonus=10000;
ks
public static void main(String args[])
{
B p=new B();
System.out.println("B salary is:"+p.sal);
oo
_B
System.out.println("Bonus of B is:"+p.bonus);
}
es
}
ot
a)
_N
b)
K
A
B salary is 10000
Bonus of B is: 4000.0
e/
t.m
Answer: a
Explanation: The program gives output as in option a. The program have used single level inheritance and hence have access to
tp
the parent class methods and variables. This program simply prints the value from parent class and from the child class.
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) common
d) const
nt
Answer: a
ua
Explanation: The keyword used to declare static variables is static. This is must be used while declaring the static variables. The
compiler can make variables static if and only if they are mentioned with static keyword.
_Q
3. Any changes made to static data member from one member function
ks
a) Is reflected to only the corresponding object
b) Is reflected to all the variables in a program
c) Is reflected to all the objects of that class
d) Is constant to that function only
oo
_B
Answer: c
es
Explanation: The changes made from any function to static data member will be a common change for all the other objects also.
If the change is made with respect to one object and change is printed from another object, the result will be same.
ot
_N
Answer: d
Explanation: The syntax must firstly be mentioned with the keyword static. Then the data type of the member followed by the
e/
member name should be given. This is general form of declaring static data members.
t.m
Answer: b
Explanation: The static data members must be defined outside the class. Since these are common to all the objects and should
be created only once, they must not be defined in the constructor.
6. The syntax for defining the static data members is
a) dataType className :: memberName = value;
b) dataType className : memberName = value;
c) dataType className . memberName = value;
d) dataType className -> memberName =value;
Answer: a
Explanation: The syntax doesn’t contain the static keyword. Since it is already been declared as static inside the class. The data
type and the corresponding class name must be there to allocate the variable to a class. The value is assigned using scope
resolution operator for the member name.
7. If static data members have to be used inside a class, those member functions
Answer: c
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) className : staticDataMember;
d) className . staticDataMember;
nt
Answer: b
ua
Explanation: For accessing the static data members without using the static member functions, the class name can be used. The
class name followed by scope resolution, indicating that static data members is member of this class, and then the data member
_Q
name.
ks
10. Which data members among the following are static by default?
a) extern
b) integer
c) const
oo
_B
d) void
es
Answer: c
Explanation: The const data members of any class are made static by default. This is an implicit meaning given by the compiler
ot
to the member. Since const values won’t change from object to object, hence are made static instead.
_N
class Test
{
K
}
};
int Test :: x =20;
/
s:/
void main()
{
tp
Test x;
ht
x.fun();
x.fun();
}
a) 20 22
b) 20 21
c) 21 22
d) 22 23
Answer: c
Explanation: The static member is initialized with 20. Then the function is called which used pre-increment and printed value of x.
The function is called twice. Hence we get 21 22 as output.
12. Whenever any static data member is declared in a class
a) Only one copy of the data is created
b) New copy for each object is created
c) New memory location is allocated with each object
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
class Test
{
public: Test()
{
um
cout << "Test's Constructor is Called " << endl;
}
nt
};
ua
class Result
{
_Q
static Test a;
public:
ks
Result()
{
cout << "Result's Constructor is Called " << endl; oo
_B
}
};
es
void main()
ot
{
Result b;
_N
}
TU
Answer: b
Explanation: The output is the message printed from the constructor of class Result. There is no inheritance used hence only one
t.m
constructor is called. Since static members are declared once in class declaration and are not defined. The constructor of class
Test will not be called.
/
s:/
15. Which among the following is wrong syntax related to static data members?
a) className :: staticDataMember;
tp
um
c) Have access to only the static members of a class
d) Have direct access to all other class members also
nt
Answer: c
ua
Explanation: The static member functions are common for all the objects. These functions can use only the static members of a
class in which those are defined. This is because other members change with respect to each object created.
_Q
3. The static member functions
ks
a) Can be called using class name
b) Can be called using program name
c) Can be called directly
d) Can’t be called outside the function
oo
_B
Answer: a
es
Explanation: The static members can be accessed using class name also. This is because the static members remain common
to all the objects. Hence objects are not required.
ot
_N
4. Which is correct syntax to access the static member functions with class name?
a) className . functionName;
TU
Answer: d
Explanation: The scope resolution operator must be used to access the static member functions with class name. This indicates
e/
5. Which among the following is not applicable for the static member functions?
a) Variable pointers
/
s:/
b) void pointers
c) this pointer
tp
d) Function pointers
ht
Answer: c
Explanation: Since the static members are not property of objects, they doesn’t have this pointer. Every time the same member
is referred from all the objects, hence use of this pointer is of no use.
6. Which among the following is true?
a) Static member functions can’t be virtual
b) Static member functions can be virtual
c) Static member functions can be declared virtual if it is pure virtual class
d) Static member functions can be used as virtual in Java
Answer: a
Explanation: The static member functions can’t be virtual. This is a restriction on static member functions, since the definition
should not change or should not be overridden by any other function of derived class. The static members must remain same for
all the objects.
7. The static members are
Answer: d
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Can’t be declared const or volatile
d) Can’t be declared const, volatile or const volatile
nt
Answer: d
ua
Explanation: The static member functions can’t be made const, since any object or class itself should be capable of making
changes to the function. And the function must retain all changes common to all the objects.
_Q
10. Which keyword should be used to declare the static member functions?
ks
a) static
b) stat
c) const
d) common
oo
_B
Answer: a
es
Explanation: The member functions which are to be made static, must be preceded with the keyword static. This indicates the
compiler to make the functions common to all the objects. And a new copy is not created with each of the new object.
ot
_N
b) With declaration inside class and not with definition outside the class
c) With declaration and definition wherever done
d) With each call to the member function
K
A
Answer: b
Explanation: The keyword is used only inside the class while declaring the static member. Outside the class, only definition with
e/
proper syntax is given. There is no need of specifying the keyword static again.
t.m
12. Which among the following can’t be used to access the members in any way?
a) Scope resolution
/
s:/
b) Arrow operator
c) Single colon
tp
d) Dot operator
ht
Answer: c
Explanation: The single colon can’t be used in any way in order to access the static members of a class. Other symbols can be
used according to the code and need.
13. We can use the static member functions and static data member
a) Even if class object is not created
b) Even if class is not defined
c) Even if class doesn’t contain any static member
d) Even if class doesn’t have complete definition
Answer: a
Explanation: The static members are property of class as a whole. There is no need of specific objects to call static members.
Those can be called directly or with class name.
14. The static data member
a) Can be mutable
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) String object_name= new value;
d) String object_name= value new;
nt
Answer: a
ua
Explanation: The class name String is given. And then the object name is mentioned. There are two ways to declare and
initialize the string. Either by giving direct string value or by using new keyword. But if new operator is used, constructor of String
_Q
class have to be called. From the given options, the direct string value declaration is correct.
ks
3. What does function length do in String class?
a) Returns length of string including null character
b) Returns length of string excluding null character
c) Returns length of substring
oo
_B
d) Returns size of string in bytes
es
Answer: b
Explanation: The length function returns the length of string. The length is the number of characters in the string but the last null
ot
character is not counted. The string length can be used to loop through each character in the string.
_N
4. Which is the function to get the character present at a particular index in the string?
a) char charAt(index);
TU
b) char charIn(StringName);
c) char charAt(StringName);
K
d) char charIn(index);
A
Answer: a
e/
Explanation: The function can be called using dot operator with the string object. Char is the return type of the function to return
t.m
the character at specified position. The index must be an integer value, less than the length of string.
5. If only one parameter is passed to substring function then
/
s:/
d) It returns the string from starting of string till the specified index
Answer: c
Explanation: The substring function returns a string value. The string is the substring starting from the specified index till the end.
The substring function have to be called with the object of string class.
6. If two index are given as argument to substring function then
a) String of length equal to sum of two arguments is returned
b) String starting from first index and of length equal to send argument
c) String starting from first index and of length equal to sum of two arguments
d) String starting from first index and ending at second index position
Answer: d
Explanation: A value of string type is returned from this function. The returned string is a substring that starts from the first
argument position, till the second index position. The indices must be less than the length of actual string.
7. String class have a concat() function that is used to
Answer: c
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) Case sensitive, case sensitive
d) Case insensitive, case sensitive
nt
Answer: b
ua
Explanation: Both the functions return Boolean value. The function equal() is case sensitive and returns false even if a single
character is case different in two strings. The other function ignores the case sensitivity and only checks if the spellings are
_Q
same.
ks
10. The compareTo() function is used to
a) Compare strings value to string object
b) Compare string value to string value
c) Compare string object to another string object
oo
_B
d) Compare string object to another string value
es
Answer: c
Explanation: The source and target must be objects of the string class. The compare is always case sensitive. To compare two
ot
string objects without case sensitivity then we can use compareToIgnoreCase() function.
_N
Answer: c
e/
Explanation: The function is used to convert each character of the string. If the character is already uppercase then it remains the
t.m
Answer: a
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
c) template <typename T> T named(T x, T y){ }
d) Template <typename T1, typename T2> T1 named(T1 x, T2 y){ }
nt
Answer: c
ua
Explanation: The syntax must start with keyword template, case sensitive. Then it should include the typename and a variable to
denote it. Then whenever that variable is used, it replaces it with the data type needed.
_Q
3. Can default arguments be used with the template class?
ks
a) Yes, in some special cases
b) Yes, always
c) No, it must satisfy some specific conditions first
d) No, it can’t be done
oo
_B
Answer: b
es
Explanation: The template class can use default arguments. This is used to specify the data type to be considered if it is not
specified while passing to the generic class. The default type will be used.
ot
_N
Answer: d
Explanation: The class specialization is creation of explicit specialization of a generic class. We have to use template<>
e/
constructor for this to work. It works in the same way as with explicit function specialization.
t.m
5. Which is the most significant feature that arises by using template classes?
a) Code readability
/
s:/
b) Ease in coding
c) Code reusability
tp
d) Modularity in code
ht
Answer: c
Explanation: The code reusability is the feature that becomes more powerful with the use of template classes. You can generate
a single code that can be used in variety of programming situations.
6. A template class defines the form of a class it will operate.
a) With full specification of the data on which
b) With full specification of the functions on which
c) Without full specification of the data on which
d) Without full specification of the functions on which
Answer: c
Explanation: The template classes can accept all types of data types. There is no need to specify the data on which the class
has to operate. Hence it gives us flexibility to code without worrying about the type of data that might be used in the code.
7. What are the two specializations of I/O template classes in C++?
a) 16-bit character and wide characters
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Integer
c) Digit
nt
d) Math
ua
Answer: a
Explanation: The string class is more specialized. Since the string must be able to store any kind of data that is given to the
_Q
string. Hence it needs maximum specialization.
ks
10. How is function overloading different from template class?
a) Overloading is multiple function doing same operation, Template is multiple function doing different operations
oo
b) Overloading is single function doing different operations, Template is multiple function doing different operations
c) Overloading is multiple function doing similar operation, Template is multiple function doing identical operations
_B
d) Overloading is multiple function doing same operation, Template is same function doing different operations
es
Answer: c
Explanation: The function overloading is multiple functions with similar or different functionality but generic class functions
ot
Answer: b
e/
Explanation: The generic class have a special case with static members. Each instance will have its own static member. The
t.m
void main()
{
test<int> (2);
test<int>(2);
test<double>(2.2);
}
a)
x = 2 count = 0
b)
x = 2 count = 0
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
c)
x = 2 count = 0
x = 2 count = 1
x = 2.2 count = 0
d)
x = 2 count = 0
x = 2 count = 1
x = 2.2 count = 2
Answer: c
um
Explanation: For each new type, the class will have separate instance. Here two instances will be created and hence counter for
integer goes to 1. And for float value, the count remains 0 for the output.
nt
ua
13. If template class is defined, is it necessary to use different types of data for each call?
a) No, not necessary
_Q
b) No, but at least two types must be there
c) Yes, to make proper use of template
ks
d) Yes, for code efficiency
Answer: a oo
Explanation: It is not necessary to use different type with each call to the generic function. Data may be of same type with each
_B
call but still the function works. We don’t consider other properties like efficiency with this concept because it is made generic to
all data type, hence always works.
es
14. How many generic types can be given inside a single template class?
ot
a) Only 1
_N
b) Only 3
c) Only 7
d) As many as required
TU
Answer: d
K
Explanation: There is no restriction on the number of types to be used for making the class generic. There can be any number of
generic types with a single class. Hence giving flexibility to code with all the data types.
A
e/
a) True
b) False
/
Answer: b
s:/
Explanation: There is no mandatory condition to have static members inside template class. Not only template, it is not
tp
mandatory to have static members anywhere. We can use them as required in the code.
ht
um
d) ROM
Answer: c
nt
Explanation: The memory for the objects or any other data is allocated in RAM initially. This is while we run a program all the
ua
memory allocation takes place in some RAM segments. Arrays in heap and local members in stack etc.
_Q
3. When is the memory allocated for an object?
a) At declaration of object
ks
b) At compile time
c) When object constructor is called
d) When object is initialized to another object oo
_B
Answer: c
Explanation: The object memory allocation takes place when the object constructor is called. Declaration of an object doesn’t
es
mean that memory is allocated for its members. If object is initialized with another object, it may just get a reference to the
previously created object.
ot
_N
Answer: b
Explanation: The new is type safe because we don’t have to specify the type of data that have to be allocated with memory. We
e/
can directly use it with data name. Name of the data doesn’t matter though for type of memory allocation though.
t.m
5. Which of the following function can be used for dynamic memory allocation of objects?
a) malloc()
/
s:/
b) calloc()
c) create()
tp
Answer: d
Explanation: The malloc() function can be used to allocate dynamic memory for objects. Function calloc() can also be use. These
functions differ in the way they allocate memory for objects.
6. How much memory will be allocated for an object of class given below?
class Test
{
int mark1;
int mark2;
float avg;
char name[10];
};
a) 22 Bytes
b) 24 Bytes
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
Answer: b
nt
Explanation: Whenever an object goes out of scope, the deletion of allocation memory takes place. Actually the data is not
deleted, instead the memory space is flagged to be free for further use. Hence whenever an object goes out of scope the object
ua
members become useless and hence memory is set free.
_Q
9. Which among the following keyword can be used to free the allocated memory for an object?
a) delete
ks
b) free
c) either delete or free
d) only delete oo
_B
Answer: c
Explanation: The memory allocated for an object is usually automatically made free. But if explicitly memory has to be made free
es
then we can use either free or delete keywords depending on programming languages.
ot
a) Destructor function
b) Constructor function
TU
c) Delete function
d) Free function
K
Answer: a
A
Explanation: The destructor function of the class is called whenever an object goes out of scope. This is because the destructor
set all the resources, acquired by the object, free. This is an implicit work of compiler.
e/
t.m
c) sizeofobject(objectName)
d) sizedobject(objectName)
tp
ht
Answer: a
Explanation: The sizeof operator is used to get the size of an already created object. This operator must constail keyword
sizeof(objectName). The output will give the number of bytes acquired by a single object of some class.
12. The memory allocated for an object
a) Can be only dynamic
b) Can be only static
c) Can be static or dynamic
d) Can’t be done using dynamic functions
Answer: c
Explanation: The memory allocation for an object can be static or dynamic. The static memory allocation is when an object is
declared directly without using any function usually. And dynamic allocation is when we use some dynamic allocation function to
allocate memory for data member of an object.
13. If an object is declared in a user defined function
a) Its memory is allocated in stack
Answer: a
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) delete
c) Unallocate
nt
d) Collect
ua
Answer: b
Explanation: The delete operator in C++ can be used to free the memory and resources held by an object. The function can be
_Q
called explicitly whenever required. In C++ memory management must be done by the programmer. There is no automatic
memory management in C++.
ks
To practice all areas of Object Oriented Programming using C++ for tests, .
oo
_B
es
ot
_N
TU
K
A
e/
/t.m
s:/
tp
ht
um
b) Java supports multiple inheritance
c) Java doesn’t support multiple inheritance
d) Java doesn’t support inheritance
nt
ua
Answer: c
Explanation: Java doesn’t support multiple inheritance. This is done to avoid the diamond problem that sometimes arises with
_Q
inherited functions. Though, multiple inheritance can be implemented in java using interfaces.
ks
3. Which type of inheritance is illustrated by the following code?
a) Single level
_N
Explanation: It is hierarchical inheritance and single level inheritance. Since class topper is inheriting class student, it is single
A
level inheritance. And then average is inherited by section and overall, so it is hierarchical inheritance. But both of them are
separate. Hence it is not hybrid inheritance.
e/
t.m
Answer: d
ht
Explanation: If a class inherits more than one class, it is known as multiple inheritance. This should not be referred with only two
or three classes being inherited. But there must be one class which inherits more than one class to be called as multiple
inheritance.
5. How many types of inheritance can be used at a time in a single program?
a) Any two types
b) Any three types
c) Any 4 types
d) Any type, any number of times
Answer: d
Explanation: Any type of inheritance can be used in any program. There is no rule to use only few types of inheritance. Only thing
that matters is how the classes are inherited and used.
6. Which type of inheritance results in the diamond problem?
a) Single level
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
class A
um
{
public : class B
{
nt
public : B(int i): data(i)
ua
{
}
_Q
int data;
}
ks
};
class C: public A
{
class D:public A::B{ };
oo
_B
};
es
d) Single level inheritance is used, with both enclosing and nested classes
TU
Answer: d
Explanation: Class C is inheriting Class A. Class D is inheriting class B, both are nested. Hence it is single inheritance. For
multiple inheritance, class C or D should have inherited both class A and class B.
K
A
c) Hierarchical inheritance involves inheriting same class into more than one classes
d) Hybrid inheritance can involve any types of inheritance together
/
s:/
Answer: b
Explanation: It is not necessary to have multiple inheritance in hybrid type. It can have any type together. This doesn’t have to be
tp
10. If class A has two nested classes B and C. Class D has one nested class E, and have inherited class A. If E inherits B and
C, then
a) It shows multiple inheritance
b) It shows hierarchical inheritance
c) It shows multiple inheritance
d) Multiple inheritance among nested classes, and single level for enclosing classes
Answer: d
Explanation: This involves the same concept of inheritance, where the nested classes also follow the inheritance rules. The
Enclosing classes are having single inheritance. Nested classes involves multiple.
11. In hierarchical inheritance, all the classes involve some kind of inheritance.
a) True
b) False
Answer: b
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
single class.
14. How many classes can be inherited by a single class in java?
nt
a) Only 1
ua
b) Only 27
c) Only 255
_Q
d) Only 1024
ks
Answer: a
Explanation: Since java doesn’t support multiple inheritance, it is not possible for a class to inherit more than 1 class in java. This
is the same case in C# also. oo
_B
15. If multi-level inheritance is used, First class B inherits class A, then C inherits B and so on. Till how many classes can this go
on?
es
d) There is no limit
TU
Answer: d
Explanation: In this case, there is no limit. All the classes going on like this will inherit the members of base class, and hence the
upper level inheritance won’t affect the number of classes that can go on inheriting in this pattern.
K
A
e/
/ t.m
s:/
tp
ht
um
c) Either upward or downward
d) Doesn’t apply on inheritance
nt
Answer: b
ua
Explanation: The upcasting concept in inheritance is always applied upward the inheritance tree. The derived class objects can
be type casted to any of its parent class type. Since is a relationship applies in general inheritance.
_Q
3. Which among the following is safe?
ks
a) Upcasting
b) Downcasting
c) Both upcasting and downcasting
d) If upcasting is safe then downcasting is not, and vice versa
oo
_B
Answer: a
es
Explanation: The upcasting is always safe since the derived type or the smaller type is converted into the base type or the larger
size. This results in allocating a smaller size data into bigger type data. No data is lost in casting, hence safe.
ot
_N
Answer: b
Explanation: When a general code has to be written where we use only the supertype object or the data of bigger size, then
e/
upcasting would be the best option. Since the whole code will require only the supertype name references.
t.m
b) Code efficiency
c) Complex code simple syntax
tp
d) Encapsulation
ht
Answer: c
Explanation: The code written using upcasting mostly shows complex code in simpler syntax features. This is because the
upcasting concept can be applied as polymorphism and to group the similar type of objects.
6. Upcasting and downcasting objects are the same as casting primitive types.
a) True
b) False
Answer: b
Explanation: It is a bit confusing concept since both casting concepts are different. Primitive casting depends on the type and
size of data being typecast. Whereas in objects casting, the classes and inheritance order plays a big role.
7. Which casting among the following is allowed for the code given below?
class A
{
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
a) Upcast to first base class listed in inheritance
b) Upcast to send base class listed in inheritance
nt
c) Upcast to any base class
d) Upcast is not possible
ua
Answer: c
_Q
Explanation: The upcasting of derived class object is possible to any base class. This is because the base class object can
represent any of its derived classes using upcasting.
ks
9. If class C inherits class B and class B inherits class A
a) Class C object can be upcasted to object of class B only
b) Class C object can be upcasted to object of class A only
oo
_B
c) Class C object can be upcasted to object of either class A or B
d) Class C object can’t be upcasted
es
Answer: c
ot
Explanation: Both class A and B are parent classes of class C. Class C object hence can be upcasted to any of those class
_N
d) Not allowed
e/
Answer: a
t.m
Explanation: The public inheritance shows the most flexible is-a relationship. Hence explicit type casting is not required. Implicit
type casting is done by the compiler.
/
s:/
b) Dynamic binding
ht
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
b) Upcasting is possible only for multilevel inheritance
c) Upcasting is possible only for multiple inheritance
nt
d) Upcasting is possible for any type of inheritance
ua
Answer: d
Explanation: The type of inheritance doesn’t matter with the upcasting concept. Upcasting applies to all types of inheritance. Any
_Q
derived class object can be upcasted to any of its base class object.
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
um
d) It’s instance can be created inside the parent class only
Answer: a
nt
Explanation: The instances will be allowed to be created only inside the sub classes. This is because the protected members will
ua
be inherited and hence the constructor too. This will allow the subclasses to call the constructor whenever an object is created.
_Q
3. For the following code, choose the correct option.
ks
class A
{
int marks;
protected : A()
oo
_B
{
marks=100;
es
}
public : A( int x)
ot
{
_N
marks=x;
}
TU
};
a) The instances can be created only in subclasses
K
Answer: d
Explanation: The instances can be created anywhere in the program. The only restriction will be on which constructor will have to
be called. The instances with zero arguments will be allowed to be created only inside the subclasses, but the instances with one
/
s:/
4. If the protected members are to be made accessible only to the nearest subclass and no further subclasses, which access
ht
5. What will be the output of the following code (all header files and required things are included)?
class A
{
int marks;
protected : A(int x)
{
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht
um
d) Program gives logical error
nt
Answer: c
Explanation: The objects being created with assignment value are allowed, if the constructor accepts only 1 argument. But main()
ua
function will not be able to create the object here with assignment, as the constructor which accepts one argument is in protected
_Q
mode in the class.
6. Which among the following is true for the given code below?
ks
class A
{
protected : int marks;
oo
_B
public :
A()
es
{
ot
marks=100;
}
_N
disp()
{
TU
cout<<”marks=”<<marks;
}
};
K
class B: protected A
A
{
e/
};
B b;
t.m
b.disp();
/
Answer: a
Explanation: The object of class B can’t access the members of A outside the class. This is because the class is being inherited
in protected access, so all the members will become protected in subclass B.
7. Protected members differ from default members as
a) Protected members can be accessed outside package using inheritance, but default can’t
b) Default members can be accessed outside package using inheritance, but protected can’t
c) Protected members are allowed for inheritance but Default members are not allowed
d) Both are same
Answer: a
Explanation: The protected members are allowed in the same package but can also be accessed in other packages using
inheritance. But the default members can never be accessible in other packages.
8. If all the members are defined in protected specifier then? (Constructors not considered)
a) Instance of class can’t be created
****** Telegram:- @AKTU_Notes_Books_Quantum ******
@AKTU_Notes_Books_Quantum
b) Instance of class can be created anywhere
c) Instance of class can be created only in subclasses
d) Instance of class can be created only in main() function
Answer: b
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
class A
{
private: int marks;
A()
{
}
Public : disp()
{
cout<< marks;
}
um
};
class B: public A
nt
{
}
ua
B b;
_Q
a) Instance of B will not be created
b) Instance of B will be created
ks
c) Program gives compile time error
d) Program gives runtime error
Answer: a
oo
_B
Explanation: Instance of B will not be created. When you try to create an instance of B, First the constructor of parent class will be
called, but the parent class constructor is private, hence it won’t be able to initialize and allocate memory for parent class
es
Answer: d
A
Explanation: The protected and public members of the parent class will become the protected members in subclass. This is
e/
predefined rule of inheritance. The reason behind is to maintain the level of security in subclass too.
t.m
11. If protected members are to be accessed from outside the class then
a) Members must be inherited publicly in subclass
/
Answer: d
Explanation: The members must be made public, otherwise it is not possible. In every case, the protected members will act as
private members if it’s about access specifier. It will only be inherited, that too will lead to make those members protected again,
in subclasses.
12. Which among the following can use protected access specifier?
a) Members which may be used in other packages
b) Members which have to be secure and should be used by other packages/subclass
c) Members which have to be accessed from anywhere in the program
d) Members which have to be as secure as private but can be used by main() function
Answer: b
Explanation: The members which have to be secure and might get used in other packages or subclasses can use protected
access. This also allows the members to be safe from accidental modification.
13. Protected access is same as default access that is given implicitly in java if no specifier is mentioned.
a) True
um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht
class A
{
Public : A(int a=0)
um
{
cout<<”new A”;
nt
}
};
ua
A a;
A b;
_Q
A c;
ks
a) new A new A new A
b) newAnewAnewA
c) new Anew Anew A
d) new A new Anew A
oo
_B
Answer: c
es
Explanation: The constructor has a default argument. Whenever the object is created, the constructor will be called and print the
ot
message in its definition. Since the argument is default valued, it is not mandatory to pass anything to the new object.
_N
WEB TECHNOLOGY
Web Technology
Course Outcome ( CO)
At the end of course , the student will be
able to understand
CO 1 Explain web development Strategies and Protocols governing Web..
CO 5 Building enterprise level applications and manipulate web databases using JDBC
Unit Topic
Introduction: Introduction and Web Development Strategies, History of Web and Internet,
Protocols Governing Web, Writing Web Projects, Connecting to Internet, Introduction to
I Internet services and tools, Introduction to client-server computing. Core Java: Introduction,
Operator, Data type, Variable, Arrays, Methods & Classes, Inheritance, Package and Interface,
Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event
handling, Introduction to AWT, AWT controls, Layout managers
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type
II definition, XML: DTD, XML schemes, Object Models, presenting and using XML, Using
XML Processors: DOM and SAX, Dynamic HTML
Scripting: Java scriAJAXpt: Introduction, documents, forms, statements, functions, objects;
introduction to Networking : Internet Addressing, InetAddress, Factory Methods, Instance
III Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle,
V Handling HTTP get Requests, Handling HTTP post Requests, Redirecting Requests to Other
Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page
Example, Implicit Objects, Scripting, Standard Actions, Directives, Custom Tag Libraries.
1 University Academy
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Solved MCQ
Topic Page
2 University Academy
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
WEB TECHNOLOGY 2020-21
6 University Academy
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
WEB TECHNOLOGY 2020-21
14 University Academy
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
WEB TECHNOLOGY 2020-21
18 University Academy
WEB TECHNOLOGY 2020-21
19 University Academy
WEB TECHNOLOGY 2020-21
20 University Academy
WEB TECHNOLOGY 2020-21
21 University Academy
WEB TECHNOLOGY 2020-21
22 University Academy
WEB TECHNOLOGY 2020-21
23 University Academy
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
WEB TECHNOLOGY 2020-21
25 University Academy
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
WEB TECHNOLOGY 2020-21
28 University Academy
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21
38 University Academy
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
WEB TECHNOLOGY 2020-21
45 University Academy
WEB TECHNOLOGY 2020-21
46 University Academy
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
WEB TECHNOLOGY 2020-21
49 University Academy
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
WEB TECHNOLOGY 2020-21
51 University Academy
WEB TECHNOLOGY 2020-21
52 University Academy
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
WEB TECHNOLOGY 2020-21
54 University Academy
WEB TECHNOLOGY 2020-21
55 University Academy
WEB TECHNOLOGY 2020-21
56 University Academy
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
WEB TECHNOLOGY 2020-21
59 University Academy
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Unit 1st Web Technology (KCS-602)
Multi Choice Questions (MCQ)
Q1. The communication protocol used by the Internet to transfer hypertext
documents is ___
(A) Hyper Text Internet Protocol
(B) Hyper Text Transfer Protocol
(C) Internet protocol
(D) File Transfer Protocol
Ans: B
Q2. The _____ attribute is used to specify the value to be stored in the
variable if an option is selected.
(A) SIZE
(B) VALUE
(C) CHECKED
(D) TYPE
Ans: B
Q3. Transferring your HTML code from one machine to server is known as
___
(A) Indexing
(B) Hosting
(C) Serving
(D) Sorting
Ans: B
Q8. Which program is used by web clients to view the web pages?
(A) Web browser
(B) Protocol
(C) Web server
(D) Search Engine
Ans: A
Q9. What is the name of the location address of the hypertext documents?
(A) Uniform Resource Locator
(B) Web server
(C) File
(D) Web address
Ans: A
Q13. Who send the requisition for web pages to the web servers?
(A) Node
(B) System
(C) Web clients
(D) Web customer
Ans: C
Q14. Name any one text editor program.
(A) HTML
(B) FrontPage
(C) Notepad
(D) MS Paint
Ans: C
Q15. Implement the Listener interface and overrides its methods is required to perform in
event handling.
A. True
B. False
Ans: A
Q16. When we invoke repaint() for a java.awt.Component object, the AWT invokes the
method:
A. draw()
B. show()
C. update()
D. paint()
Ans: D
Q19. Which of these packages contains all the classes and methods required for even
handling in Java?
A. java.applet
B. java.awt
C. java.awt.event
D. java.event
Ans: C
Q25. FileNotFoundException
A. Is a subclass/extends IOException
B. Is a Compile time exception
C. Found in java.io package
D. All
Ans D
Q26. IOException
A. Found in java.io package
B. Is a Compile time exception
C. Is a subclass/extends Exception
D. All
Ans D
Q30. In Servlet Terminology what provides runtime environment for JavaEE (j2ee)
applications. It performs many operations that are given below:
Q33. Applets cannot make network connection exception to the server host from which it
originated.
a. True
b. False
ANSWER: True
Q36. Internet access by transmitting digital data over the wires of a local telephone network is
provided by _______
a) leased line
b) digital subscriber line
c) digital signal line
d) digital leased line
Answer: b
Q38. Which one of the following is not an application layer protocol used in internet?
a) remote procedure call
b) internet relay chat
c) resource reservation protocol
d) local procedure call
Answer: c
Q39. Which one of the following is not used in media access control?
a) ethernet
b) digital subscriber line
c) fiber distributed data interface
d) packet switching
Answer: d
Q40. The process of transferring files from a computer on the Internet to your computer is
called
A.Uploading
B.Forwarding
C.FTP
D.Downloading
Answer :D. Downloading
Q41. The facilities available in the internet are
(i) electronic mail
(ii) remote login
(iii)file transfer
(iv)word processing
a. i, ii
b. i, ii, iii
c. i, ii, iv
d. ii, iii and iv
Ans: b
Q47. What will happen if two thread of the same priority are called to be processed
simultaneously?
a) Anyone will be executed first lexographically
b) Both of them will be executed simultaneously
c) None of them will be executed
d) It is dependent on the operating system
Answer: d
Q50. What is the name of the thread in the following Java Program?
class multithreaded_programing
{
public static void main(String args[])
{
Thread t = Thread.currentThread();
System.out.println(t);
}
}
a) main
b) Thread
c) System
d) None of the mentioned
Answer: a
Unit 2nd Web Technology (KCS-602)
Multi Choice Questions (MCQ)
Q1. The advantages of XML over HTML are
(i) It allows processing of data stored in web-pages
(ii) It uses meaningful tags which aids in understanding the nature of a document
(iii)Is simpler than HTML
(iv)It separates presentation and structure of document
a. (i),(ii) and (iii)
b. (i),(ii) and(iv)
c. (ii),(iii) and (iv)
d. (i),(iii) and (iv)
Ans: b
Q2. A …….. include the protocol the browser uses to access the file, server to domain name, the
relative path and the file name.
A. complete URL
B. incomplete URL
C. site URL
D. Web URL
Ans: A. complete URL
Q6. Your web browser may be able to play some types of files directly. Whenever your web browser
encounters a file it cannot play.
A. It does not execute the file
B. It displays an error message
C. It copies the files to your computer and runs the helper application.
D. None of the above
Ans: C. It copies the files to your computer and runs the helper application.
Q7. Which of the following tags do not require a terminator.
A. <U>
B. <BR>
C. <B>
D. None of the above
Ans: B. <BR>
Q9. The TCP/IP is an implied suite of protocols that has been made standard by
A. UN Secretary of Defense
B. International Standard Organization(ISO)
C. The Internet Engineering Task Force
D. None of the above
Ans: A. UN Secretary of Defense
Q12. What do you think is not correct in regard to the E-mail system?
A. Using encryption you could electronically deliver confidential documents saving time and money
B. Limited only to Local Area Network
C. Cost of sending messages across the world is same as that of sending across the city.
D. If the recipient is not around, the message is delivered to his mailbox.
Ans: B. Limited only to Local Area Network
Q13. The tag to give visual division between sections of the page, and which causes the browser
to draw an embossed line is
A. <HL>
B. <HR>
C. <UR>
D. None of the above
Ans: B. <HR>
Q14. The ……attribute specifies the relationship between the linked and current document.
A. rel
B. size
C. type
D. face
Ans: A. rel
Q15. The web relies on the following mechanisms to make its resource readily available
A. A uniform naming scheme
B. Protocols
C. Hypertext
D. All of the above
Ans: D. All of the above
Q16. What is the correct HTML for making a text input field?
A. <input type=”textfield”/>
B. <textinput type=”text”>
C. <textfield>
D. <input type=”text”/>
Ans: D. <input type=”text”/>
Q17. The XML format has a simpler set of …………………… than HTML.
A) loader rule
B) parsing rules
C) generator rule
D) logical rule
Ans: B) parsing rules
Q23. In XML the attribute value must always be quoted with ……………..
A) double quotes
B) single quotes
C) both a and b
D) name of attributes
Ans: A) double quotes
Q24. Elements from the HTML namespace are displayed as they would in …………………..
A) DHTML
B) XML
C) HTML
D) DXML
Ans: C) HTML
Q25. An ……………….. block can be to embed a CSS style sheet within an XML document.
A) <bk:Book>
B) <Element Type>
C) <HTML:STYLE>
D) <XML:STYLE>
Ans: C) <HTML:STYLE>
Q27. The symbol that identifies the “href” attribute as the name of a NAME anchor rather
than an address or file name is
A. “&”
B. “$”
C. “#”
D. “!”
Ans: C. “#”
Q28. The ………. tag defines the relationship between a document and an external resource.
A. <src>
B. <href>
C. <anchor>
D. <link>
Ans: D. <link>
Q29. The value of display property ………………….. create a block for the list box and an
inline box for items.
A) list-item
B) run-in
C) inline-block
D) block
Ans: A) list-item
Q30. State whether the following statements about CSS property are True or False.
i) The default value for “empty-cells” property is hidden.
ii) The default value for “float” property is none.
A) i-True, ii-True
B) i-False, ii-True
C) i-True, ii-False
D) i-False, ii-False
Ans: B) i-False, ii-True
Q31. Which of the following is/are the named values of the font-weight property.
i) normal ii) bold iii) none iv) lighter
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
Ans: C) i, ii and iv only
Q32. ………………….. property defines the minimum number of lines of a paragraph that
must be left at the bottom of a page.
A) Outline
B) Orphans
C) Overflow
D) Padding
Ans: B) Orphans
Q33. State whether the following statements are True or False for orphans property in CSS.
i) The default value is 2 if unspecified.
ii) Negative values may not be used in this property.
iii) It is really meaningful for print output.
A) True, True, False
B) False, True, False
C) False, True, True
D) True, True, True
Ans: D) True, True, True
Q34. ………………. property is similar to the align attribute available with (X)HTML block-
level tags such as <P>.
A) text-align
B) text-direction
C) text-layout
D) text-indent
Ans: A) text-align
Q35. The …………………. property is often used with the element and its associated pseudo-
classes to turn off link underlining or set different looks for hover or visited states.
A) text-align
B) text-decoration
C) text-layout
D) text-indent
Ans: B) text-decoration
Q36. Which of the following is/are the values of text-decoration properties.
i) blink ii) inherit iii) strike-through iv) over-line
A) i, ii and iii only
B) ii, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
Ans: C) i, ii and iv only
Q37. The default value of the text-indent property, which specifies the indent in the first line of
a block-level element is …………..
A) 0
B) 1
C) 2
D) 3
Ans: A) 0
Q38. The value of ………………… is used to override any inherited text-transform values.
A) default
B) none
C) inherit
D) override
Ans: B) none
Q39. The ……………….. value of white-space property collapses multiple white space
characters into single spaces and automatically wraps lines.
A) normal
B) auto
C) pre
D) wrap
Ans: A) normal
Q40. The ……………….. value of white-space property collapses white space, save new-lines,
which are preserved.
A) normal
B) pre
C) pre-line
D) pre-swrap
Ans: C) pre-line
Q41. The value of white-space property ………………… breaks newlines that would cause text
to break out of an element’s box.
A) normal
B) pre
C) pre-line
D) pre-wrap
Ans: D) pre-wrap
Q43. The ………………… property defines a laying or stacking context for positioned
elements.
A) X-index
B) Y-index
C) Z-index
D) index
Ans: C) Z-index
Q44. The ……………….. value used in Z-index property tries to determine the Z-placement of
an element automatically by its markup position in the document.
A) default
B) auto
C) inherit
D) auto-markup
Ans: B) auto
Q45. Which of the following provides options to parse XML, XPath and XSLT using Java
Collections Framework and provides support for DOM, SAX and JAXP?
A - XPath Parser
B - DOM4J Parser
C - JDOM Parser
D - StAX Parser
Ans: B
Q46. Which of the following is true about SAX parsing?
A - SAX parser reads an XML document from top to bottom, recognizing the tokens that make up
a well-formed XML document.
B - SAX parser reports the application program the nature of tokens that the parser has
encountered as they occur
C - The application program provides an 'event' handler that must be registered with the parser.
D - All of the above.
Ans: D
Q47. Consider a system which is memory & speed constraint. The application is to process
XML documents, sort the contents and mail them to a higher configuration machine for
transformation. Which is the best approach?
A. Use platform native language to process the docuements
B. Use DOM based approach.
C. Using SAX based approach is the best.
D. DOM and SAX must be used in this context.
Answer : b
A. <italic>
B. <it>
C. <i>
D. <il>
Ans: C
A. Curly
B. Round
C. Squart
D. Angle
Ans: D
Q51. How do you display a border like this: The top border = 10 pixels, The bottom
border = 5 pixels, The left border = 20 pixels and The right border = 1pixel?
A. border-width:10px 1px 5px 20px;
B. border-width:5px 20px 10px 1px;
C. border-width:10px 20px 5px 1px;
D. border-width:10px 5px 20px 1px;
Ans: A
Unit 3rd Web Technology (KCS-602)
Multi Choice Questions (MCQ)
A. Undefined
B. Number
C. Boolean
D. Float
Ans : D
2. Which company developed JavaScript?
A. Netscape
B. Bell Labs
C. Sun Microsystems
D. IBM
Ans : A
3. Inside which HTML element do we put the JavaScript?
A. <script>
B. <head>
C. <meta>
D. <style>
Ans : A
A. alert-box("Letsfindcourse");
B. confirm("Letsfindcourse");
C. msgbox("Letsfindcourse");
D. alert("Letsfindcourse");
Ans : D
A. Letsfindcourse 30
B. 30
C. Letsfindcourse30
D. Exception
Ans : C
A. Alert
B. Prompt
C. Confirm
D. All of the above
Ans : D
11. What is the full form of AJAX?
A. Asynchronous JavaScript and XML
B. Asynchronous JavaScript amount XML
C. Asynchronous JavaScript and HTML
D. None of these
Ans : A
25. The URLConnection class can be used to read and write data to the
specified resource referred by the URL?
A) True
B) False
Ans: A
27. In InetAddress class which method it returns the host name of the IP
Address?
A) public String getHostName()
B) public String getHostAddress()
C) public static InetAddress getLocalHost()
D) None of the above
Ans: A
32. Which of these methods is used to know the full URL of an URL
object?
a) fullHost()
b) getHost()
c) ExternalForm()
d) toExternalForm()
Ans: D
import java.net.*;
class networking
{
public static void main(String[] args) throws MalformedURLException
{
URL obj = new URL("https://www.sanfoundry.com/javamcq");
System.out.print(obj.getProtocol());
}
}
a) http
b) https
c) www
d) com
Ans: A
34. Which of these transfer protocol must be used so that URL can be
accessed by URLConnection class object?
a) http
b) https
c) Any Protocol can be used
d) None of the mentioned
Ans: A
35. Which class is message that can be sent or received. If you send
multiple packet, it may arrive in any order,Moreover, packet delivery is not
guaranteed?
A) DatagramPacket
B) DatagramSocket
C) Both A & B
D) None of the above
Ans: A
36. Which method of URL class represents a URL and has complete set of
methods to manipulate URL in Java?
A) java.net.URL
B) java.net.URLConnection
C) Both A & B
D) None of the above
Ans: A
38. The DatagramSocket and DatagramPacket classes are not used for
connection-less socket programming.
A) True
B) False
Ans: B
39. Which of these class must be used to send a datatgram packets over a
connection?
A. InetAdress
B. DatagramPacket
C. DatagramSocket
D. All of the mentioned
Ans: D
Ans: A
41. Which of these methods of httpd class is used to read data from the
stream?
A. getDta()
B. GetResponse()
C. getStream()
D. getRawRequest()
Ans: D
45. Which are the several reasons for using generator patterns?
a) Product Creation Control
b) Product Configuration Control
c) Client and Product Decoupling
d) All of the mentioned
Ans: D
47. In Java, local variables are stored in __ memory and instance variables
are stored in ___ memory.
A) Stack, Stack
B) Heap, Heap
C) Stack, Heap
D) Heap, Stack
Ans: C
a. Object-Oriented
b. Object-Based
c. Assembly-language
d. High-level
Ans: B
49. Which of the following is the correct output for the following JavaScript
code:
varx=5,y=1
var obj ={ x:10}
with(obj)
{
alert(y)
}
Ans: A
50. Which of the following is the correct output for the following JavaScript
code:
Int x=8;
if(x>9)
{
document.write(9);
}
else
{
document.write(x);
}
a. 9
b. 0
c. 8
d. Undefined
Ans: C
Unit 4th Web Technology (KCS-602)
Multi Choice Questions (MCQ)
1. Which services are provided to EJB components by the EJB container?
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
ANSWER: All mentioned above
2. Which case of a session bean obtains the UserTransaction object via the
EJBContext using the getUserTransaction() method in EJB transaction
management?
a. Bean-managed transactions
b. Container-managed transactions
c. Both A & B
d. None of the above
ANSWER: Bean-managed transactions
4. A message driven bean is like statefull session bean that encapsulates the business
logic and doesn't maintain state.
a. True
b. False
ANSWER: False
6. JMS is mainly used to send and receive message from one application to another.
a. True
b. False
ANSWER: True
7. Which session bean maintain their state between client invocations but are not
required to maintain their state across server crashes or shutdowns?
a. Transaction support
b. Persistence support
c. Naming support
d. All mentioned above
ANSWER: Naming support
9. EJB is a specification for J2EE server, not a product; Java beans may be a
graphical component in IDE.
a. True
b. False
ANSWER: True
10. A session bean represents a multiple clients inside the Application Server.
a. True
b. False
ANSWER: False
11. Which component does the Entity bean represent the persistent data stored in the
database?
a. Server-side component
b. Client-side component
c. server and client side component
d. None of the above
ANSWER: Server-side component
12. EJB is a specification for J2EE server, not a product; Java beans may be a
graphical component in IDE.
a. True
b. False
ANSWER: True
13. The life cycle of session bean is not maintained by the application server (EJB
Container).
a. True
b. False
ANSWER: False
14. What represents a persistent global data from the database?
a. Entity Bean
b. Session Bean
c. Both A & B
d. None of the above
ANSWER: Entity Bean
15. Which component does the Entity bean represents the persistent data stored in
the database?
a. Server-side component
b. Client-side component
c. server and client side component
d. None of the above
ANSWER: Server-side component
19. Which type of instances retain no data or conversational state for a specific
client?
a. Message-Driven Bean
b. Session Bean
c. Entity Bean
d. None of the above
ANSWER: Message-Driven Bean
20. Which session bean does the conversational state between multiple method calls
is not maintained by the container?
A. 1
B. 2
C. 3
D. 4
Ans : C (There are 3 types of session bean: Stateless Session Bean, Stateful Session
Bean and Singleton Session Bean)
(a) Atomicity
(b) Consistency
(c) Isolation
(d) Distributed
(e) Durability.
Ans : D
30. Which of the following method is used to perform DML statements in JDBC?
a) executeResult()
b) executeQuery()
c) executeUpdate()
d) execute()
Answer: c
31. Which of the following method is static and synchronized in JDBC API?
a) getConnection()
b) prepareCall()
c) executeUpdate()
d) executeQuery()
Answer: A
36. How does JDBC handle the data types of Java and database?
A - The JDBC driver converts the Java data type to the appropriate JDBC type
before sending it to the database.
B - It uses a default mapping for most data types.
C - Both of the above.
D - None of the above.
Answer : C
37. The JDBC API has always supported persistent storage of objects defined in the
Java programming language through the methods getObject and setObject.
a. True
b. False
ANSWER: True
38. Which JDBC type represents a "single precision" floating point number that
supports seven digits of mantissa?
a. REAL
b. DOUBLE
c. FLOAT
d. INTEGER
ANSWER: REAL
A. Connection.getConnection(url)
B. Driver.getConnection(url)
C. DriverManager.getConnection(url)
D. new Connection(url)
Ans: C
A. Driver
B. Connection
C. Statement
D. ResultSet
Ans: A
43. Which resources have their close() method called when this code runs?
A. One
B. Two
C. Three
D. Four
Ans: D
46. ________ is an open source DBMS product that runs on UNIX, Linux and
Windows.
A. MySQL
B. JSP/SQL
C. JDBC/SQL
D. Sun ACCESS
Ans: A
A. Type 1
B. Type 2
C. Type 3
D. Type 4
Ans: A
48. JDBC stands for:
a. setBatch()
b. deleteBatch()
c. removeBatch()
d. addBatch()
Ans: D
A : TRANSACTION_NONE
B : TRANSACTION_READ_COMMITTED
C : TRANSACTION_REPEATABLE_READ
D : TRANSACTION_NONREPEATABLE_READ
Ans: D
Unit 5th Web Technology (KCS-602)
Multi Choice Questions (MCQ)
1. When init() method of servlet gets called?
Answer : A
2. What is javax.servlet.http.HttpServlet?
A - interface
B - abstract class
C - concreate class
D - None of the above
Answer : B
3. Which object of HttpSession can be used to view and manipulate information about a
session?
a. session identifier
b. creation time
c. last accessed time
d. All mentioned above
ANSWER: All mentioned above
6. Which methods are used to bind the objects on HttpSession instance and get the
objects?
a. setAttribute
b. getAttribute
c. Both A & B
d. None of the above
ANSWER: Both A & B
7. Which type of ServletEngine is a server that includes built-in support for servlets?
a. Add-on ServletEngine
b. Embedded ServletEngine
c. Standalone ServletEngine
d. None of the above
ANSWER: Standalone ServletEngine
9. Which cookie it is valid for single session only and it is removed each time when the
user closes the browser?
a. Persistent cookie
b. Non-persistent cookie
c. All the above
d. None of the above
ANSWER: Non-persistent cookie
10. Sessions is a part of the SessionTracking and it is for maintaining the client state at
server side.
a. True
b. False
ANSWER: True
11. Web server is used for loading the init() method of servlet.
a. True
b. False
ANSWER: True
13. Which method is used to send the same request and response objects to another
servlet in RequestDispacher ?
a. forward()
b. sendRedirect()
c. Both A & B
d. None of the above
ANSWER: forward()
14. Which packages represent interfaces and classes for servlet API?
a. javax.servlet
b. javax.servlet.http
c. Both A & B
d. None of the above
ANSWER: Both A & B
15. Which class can handle any type of request so that it is protocol-independent?
a. GenericServlet
b. HttpServlet
c. Both A & B
d. None of the above
ANSWER: GenericServlet
17. Which object is created by the web container at time of deploying the project?
a. ServletConfig
b. ServletContext
c. Both A & B
d. None of the above
ANSWER: ServletContext
19. Which method in session tracking is used in a bit of information that is sent by a web
server to a browser and which can later be read back from that browser?
a. HttpSession
b. URL rewriting
c. Cookies
d. Hidden form fields
ANSWER: Cookies
20. Which of the following code is used to get an attribute in a HTTP Session object in
servlets?
a) session.getAttribute(String name)
b) session.alterAttribute(String name)
c) session.updateAttribute(String name)
d) session.setAttribute(String name)
Answer: a
26. Which of the following is true about Cleanup phase in JSP life cycle?
a. The destruction phase of the JSP life cycle represents when a JSP is being removed from
use by a container.
b. The jspDestroy() method is the JSP equivalent of the destroy method for servlets.
c. Both of the above.
d. None of the above.
Answer : C
Answer : A
29. Which attribute specifies a JSP page that should process any exceptions thrown but
not caught in the current page?
a. The ErrorPage Attribute
b. The IsErrorPage Attribute
c. Both A & B
d. None of the above
ANSWER: A
30. JavaServer Pages often serve the same purpose as programs implemented using the
Common Gateway Interface (CGI)
a. True
b. False
ANSWER: True
31. Which action tags are used in JSP for developing web application with Java Bean?
a. jsp:useBean
b. jsp:setProperty
c. jsp:getProperty
d. Both B & C
ANSWER: Both B & C
32. Which is the Microsoft solution for providing dynamic Web content?
a. ASP
b. JSP
c. Both A & B
d. None of the above
ANSWER: ASP
34. Which JSP Action tags is used to include the content of another resource, it may be
jsp, html or servlet?
a. jsp:include
b. jsp:forward
c. jsp:plugin
d. jsp:papam
ANSWER: jsp:include
35. In JSP page directive which attribute defines the MIME(Multipurpose Internet Mail
Extension) type of the HTTP response?
a. import
b. Content Type
c. Extends
d. Info
ANSWER: Content Type
36. A JSP page consists of which tags?
a. HTML tags
b. JSP tags
c. Both A & B
d. None of the above
ANSWER: Both A & B
38. Which of the following are the life cycle method of jsp?
A. jspInit()
B. jspService()
C. jspDestroy()
D. All of the above
ANSWER: D
4. SAX and DOM are very different Where SAX models the parser, DOM models the XML ___.
Ans: Document
5. The main purpose of ___ is to add interactivity to the browser and Web pages.
Ans: JavaScript
10. ___ is an API that can be used by web scripting languages like JavaScript, VBScript, etc.
Ans: HTTP requests
11. HTTP requests provide a mechanism for transferring the data either in text or XML format between the web client
and the webserver. (True/False)
Ans: True
13. XMLHttpRequest object property ___ is used to returns a reference to the constructor of an object.
Ans: Constructor
14. XMLHttpRequest object method abort is used to cancels the current HTTP request. (True/False)
Ans: True
15. ___ is used to sets or retrieves the event handler for asynchronous requests.
Ans: Onreadystatechange
16. The argument in send method is ignored if the request method is ___.
Ans: GET or HEAD.
19. The ___ attribute is used to return the text response entity-body.
Ans: responseText
22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True
24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True
26. DHTML allows the page author to ___ in their document, independently moving each element from any starting
point to any ending point.
Ans: Animate text and image
27. ___ is a formal specification for arranging and styling items in web pages.
Ans: CSS
28. Variations in web browser implementations, such as ___ and Worldwide Web, made consistent site appearance
difficult.
Ans: ViolaWWW
31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest
35. Like HTML, XML elements can contain other XML element. (True/False)
Ans: True
36. In the ___ method a node list containing all of a node's child nodes.
Ans: ChildNodes()
37. ___ method takes a single parameter: the node to insert, and inserts that node after the last child node.
Ans: AppendChild()
38. ___ method takes two parameters: the attribute name and value. If the attribute already exists, it replaces it with
the new value. If it doesn't exist, it creates it.
Ans: SetAttribute()
39. The process of fetching data from an XML files to be filled in an HTML table, using ___ and ___.
Ans: DSO and Javascript
41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()
44. PHP scripts are always enclosed in between ___ PHP tags.
Ans: Two
45. We must save our PHP file with a___ extension, instead of the standard .html extension.
Ans: .PHP
46. In a ___ array, each element in the main array can also be an array.
Ans: Multidimensional
47. PHP variables must start with a letter or underscore "_". (true/false)
Ans: True
48. The ___ function is used to collect values from a form sent with method="post".
Ans: POST
49. The ___ function is used to collect values from a form sent with method="get".
Ans: GET
52. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
53. ___ function which will change the value of our second field.
Ans: setOutput()
55. Database allows web applications to store information in a systematic way, and retrieve that information later
through the use of the structured query. (True/False)
Ans: True
56. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest
57. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
58. ___ function which will change the value of our second field.
Ans: SetOutput()
59. Ajax, PHP, and Database make a great combination for producing Web-based eCommerce applications.
(True/false)
Ans: True
60. ___ is used to request the interface for Update or Insert of the records.
Ans: AjaxFunctionUpdateInseart()
63. If a second call is made to mysql_connect() with the same arguments, no new connection will be established.
(True/false)
Ans: True
64. MySQL supports over ___ making it ideal for the education industry in which a wide variety of platforms are
used.
Ans: 20 platforms
65. MySQL works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA etc.
(True/false)
Ans: True
66. MySQL supports large databases, up to 50 million rows or more in a table. The default file size limit for a table
is___.
Ans: 4 GB
67. ASP stands for___
Ans: Active Server Page
68. ASP is Web pages that contain server-side scripts in addition to the usual mixture of text and HTML
tags.(True/false)
Ans: server-side script
69. ___ variables are used to store information about ALL users in one specific application.
Ans: Application
71. In ASP we declare a variable with the use of the ___ keyword.
Ans: DIM
72. If the ASP appears on the page or the ___, something has gone wrong.
Ans: Source of the page
73. The ___ checks if a condition is true before each time that the code inside the loop is repeated.
Ans: While loop
74. In ___ condition is tested at the bottom instead of at the top of the loop.
Ans: Do loop
75. Response object is used to send information to the user i.e. to the browser. (true/false)
Ans: true
WEB TECHNOLOGY
Web Technology
Course Outcome ( CO)
At the end of course , the student will be
able to understand
CO 1 Explain web development Strategies and Protocols governing Web..
CO 5 Building enterprise level applications and manipulate web databases using JDBC
Unit Topic
Introduction: Introduction and Web Development Strategies, History of Web and Internet,
Protocols Governing Web, Writing Web Projects, Connecting to Internet, Introduction to
I Internet services and tools, Introduction to client-server computing. Core Java: Introduction,
Operator, Data type, Variable, Arrays, Methods & Classes, Inheritance, Package and Interface,
Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event
handling, Introduction to AWT, AWT controls, Layout managers
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type
II definition, XML: DTD, XML schemes, Object Models, presenting and using XML, Using
XML Processors: DOM and SAX, Dynamic HTML
Scripting: Java scriAJAXpt: Introduction, documents, forms, statements, functions, objects;
introduction to Networking : Internet Addressing, InetAddress, Factory Methods, Instance
III Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle,
V Handling HTTP get Requests, Handling HTTP post Requests, Redirecting Requests to Other
Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page
Example, Implicit Objects, Scripting, Standard Actions, Directives, Custom Tag Libraries.
1 University Academy
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Solved MCQ
Topic Page
2 University Academy
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
WEB TECHNOLOGY 2020-21
6 University Academy
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
WEB TECHNOLOGY 2020-21
14 University Academy
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
WEB TECHNOLOGY 2020-21
18 University Academy
WEB TECHNOLOGY 2020-21
19 University Academy
WEB TECHNOLOGY 2020-21
20 University Academy
WEB TECHNOLOGY 2020-21
21 University Academy
WEB TECHNOLOGY 2020-21
22 University Academy
WEB TECHNOLOGY 2020-21
23 University Academy
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
WEB TECHNOLOGY 2020-21
25 University Academy
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
WEB TECHNOLOGY 2020-21
28 University Academy
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21
38 University Academy
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
WEB TECHNOLOGY 2020-21
45 University Academy
WEB TECHNOLOGY 2020-21
46 University Academy
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
WEB TECHNOLOGY 2020-21
49 University Academy
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
WEB TECHNOLOGY 2020-21
51 University Academy
WEB TECHNOLOGY 2020-21
52 University Academy
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
WEB TECHNOLOGY 2020-21
54 University Academy
WEB TECHNOLOGY 2020-21
55 University Academy
WEB TECHNOLOGY 2020-21
56 University Academy
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
WEB TECHNOLOGY 2020-21
59 University Academy
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
→Telegram Channel
→Telegram Group
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Web Technology
Course Outcome ( CO)
At the end of course , the student will be
able to understand
CO 1 Explain web development Strategies and Protocols governing Web..
CO 5 Building enterprise level applications and manipulate web databases using JDBC
Unit Topic
Introduction: Introduction and Web Development Strategies, History of Web and Internet,
Protocols Governing Web, Writing Web Projects, Connecting to Internet, Introduction to
I Internet services and tools, Introduction to client-server computing. Core Java: Introduction,
Operator, Data type, Variable, Arrays, Methods & Classes, Inheritance, Package and Interface,
Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event
handling, Introduction to AWT, AWT controls, Layout managers
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type
II definition, XML: DTD, XML schemes, Object Models, presenting and using XML, Using
XML Processors: DOM and SAX, Dynamic HTML
Scripting: Java scriAJAXpt: Introduction, documents, forms, statements, functions, objects;
introduction to Networking : Internet Addressing, InetAddress, Factory Methods, Instance
III Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle,
V Handling HTTP get Requests, Handling HTTP post Requests, Redirecting Requests to Other
Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page
Example, Implicit Objects, Scripting, Standard Actions, Directives, Custom Tag Libraries.
1 University Academy
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Solved MCQ
Topic Page
2 University Academy
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
WEB TECHNOLOGY 2020-21
6 University Academy
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
WEB TECHNOLOGY 2020-21
14 University Academy
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
WEB TECHNOLOGY 2020-21
18 University Academy
WEB TECHNOLOGY 2020-21
19 University Academy
WEB TECHNOLOGY 2020-21
20 University Academy
WEB TECHNOLOGY 2020-21
21 University Academy
WEB TECHNOLOGY 2020-21
22 University Academy
WEB TECHNOLOGY 2020-21
23 University Academy
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
WEB TECHNOLOGY 2020-21
25 University Academy
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
WEB TECHNOLOGY 2020-21
28 University Academy
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21
38 University Academy
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
WEB TECHNOLOGY 2020-21
45 University Academy
WEB TECHNOLOGY 2020-21
46 University Academy
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
WEB TECHNOLOGY 2020-21
49 University Academy
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
WEB TECHNOLOGY 2020-21
51 University Academy
WEB TECHNOLOGY 2020-21
52 University Academy
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
WEB TECHNOLOGY 2020-21
54 University Academy
WEB TECHNOLOGY 2020-21
55 University Academy
WEB TECHNOLOGY 2020-21
56 University Academy
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
WEB TECHNOLOGY 2020-21
59 University Academy
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
→Telegram Channel
→Telegram Group
Web Technologies - MCQs
1. The ___ receives a stream of tokens from the parser and sorts them according to function.
Ans: Event switcher
4. SAX and DOM are very different Where SAX models the parser, DOM models the XML ___.
Ans: Document
5. The main purpose of ___ is to add interactivity to the browser and Web pages.
Ans: JavaScript
10. ___ is an API that can be used by web scripting languages like JavaScript, VBScript, etc.
Ans: HTTP requests
11. HTTP requests provide a mechanism for transferring the data either in text or XML format between the web client
and the webserver. (True/False)
Ans: True
13. XMLHttpRequest object property ___ is used to returns a reference to the constructor of an object.
Ans: Constructor
14. XMLHttpRequest object method abort is used to cancels the current HTTP request. (True/False)
Ans: True
15. ___ is used to sets or retrieves the event handler for asynchronous requests.
Ans: Onreadystatechange
16. The argument in send method is ignored if the request method is ___.
Ans: GET or HEAD.
19. The ___ attribute is used to return the text response entity-body.
Ans: responseText
22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True
24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True
26. DHTML allows the page author to ___ in their document, independently moving each element from any starting
point to any ending point.
Ans: Animate text and image
27. ___ is a formal specification for arranging and styling items in web pages.
Ans: CSS
28. Variations in web browser implementations, such as ___ and Worldwide Web, made consistent site appearance
difficult.
Ans: ViolaWWW
31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest
35. Like HTML, XML elements can contain other XML element. (True/False)
Ans: True
36. In the ___ method a node list containing all of a node's child nodes.
Ans: ChildNodes()
37. ___ method takes a single parameter: the node to insert, and inserts that node after the last child node.
Ans: AppendChild()
38. ___ method takes two parameters: the attribute name and value. If the attribute already exists, it replaces it with
the new value. If it doesn't exist, it creates it.
Ans: SetAttribute()
39. The process of fetching data from an XML files to be filled in an HTML table, using ___ and ___.
Ans: DSO and Javascript
41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()
44. PHP scripts are always enclosed in between ___ PHP tags.
Ans: Two
45. We must save our PHP file with a___ extension, instead of the standard .html extension.
Ans: .PHP
46. In a ___ array, each element in the main array can also be an array.
Ans: Multidimensional
47. PHP variables must start with a letter or underscore "_". (true/false)
Ans: True
48. The ___ function is used to collect values from a form sent with method="post".
Ans: POST
49. The ___ function is used to collect values from a form sent with method="get".
Ans: GET
52. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
53. ___ function which will change the value of our second field.
Ans: setOutput()
55. Database allows web applications to store information in a systematic way, and retrieve that information later
through the use of the structured query. (True/False)
Ans: True
56. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest
57. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
58. ___ function which will change the value of our second field.
Ans: SetOutput()
59. Ajax, PHP, and Database make a great combination for producing Web-based eCommerce applications.
(True/false)
Ans: True
60. ___ is used to request the interface for Update or Insert of the records.
Ans: AjaxFunctionUpdateInseart()
63. If a second call is made to mysql_connect() with the same arguments, no new connection will be established.
(True/false)
Ans: True
64. MySQL supports over ___ making it ideal for the education industry in which a wide variety of platforms are
used.
Ans: 20 platforms
65. MySQL works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA etc.
(True/false)
Ans: True
66. MySQL supports large databases, up to 50 million rows or more in a table. The default file size limit for a table
is___.
Ans: 4 GB
67. ASP stands for___
Ans: Active Server Page
68. ASP is Web pages that contain server-side scripts in addition to the usual mixture of text and HTML
tags.(True/false)
Ans: server-side script
69. ___ variables are used to store information about ALL users in one specific application.
Ans: Application
71. In ASP we declare a variable with the use of the ___ keyword.
Ans: DIM
72. If the ASP appears on the page or the ___, something has gone wrong.
Ans: Source of the page
73. The ___ checks if a condition is true before each time that the code inside the loop is repeated.
Ans: While loop
74. In ___ condition is tested at the bottom instead of at the top of the loop.
Ans: Do loop
75. Response object is used to send information to the user i.e. to the browser. (true/false)
Ans: true
Coursary Open
5. What would be the colours of the RGB where the
hexadecimal values are #FF0000, #00FF00 and #0000FF
respectively?
<html>
<head> <title>JavaScript</title> </head>
<body bgcolor=”#0000ff”>
<script language=”JavaScript”>
<!– document.write(“<h1> hello world </h1>”); //–>
</script>
</body>
</html>
(a) The body of the web page will not contain any text
(b) The body of the web page will contain the text “<h1> hello
world </h1>”
(c) The body of the web page will contain the text “hello
world” as an H1 heading
(d) The background color of the web page will be green
(e) document.write(“<h1> hello world </h1 >”); is a comment.
<html>
<head><title>JavaScript</title></head>
<body>
<script language=”JavaScript”>
var a=80
var b=(a==80 ? “pass” :”fail”);
document.write(b)
</script>
</body>
</html>
(a) pass
(b) fail
(c) null
(d) 80
(e) Error at line 6.
<html>
<head><title>JavaScript question</title></head>
<body>
<script language=”JavaScript”>
book = new Array(1,2,3,4,5,6,7,8);
document.write(book[1]);
book[10]=10;
document.write(book[10]);
</script>
</body>
</html>
Once the above web page is loaded what will its body
contain?
(a) 210
(b) 110
(c) 110
(d) 210
(e) Error at line 7.
<html>
<head><title>JavaScript</title></head>
<body>
<script language=”JavaScript”>
document.write((125/5)%12);
</script>
</body>
</html>
What would be the output of the above script?
(a) 0
(b) 1
(c) 2.083
(d) 3
(e) 25%12.
(a) Display()
(b) Prompt()
(c) Alert()
(d) GetInput()
(e) Confirm().
17. The function returns a Boolean value that indicates
whether a specified expression can be evaluated as a
number; in ASP is
(a) IsNumeric()
(b) IsNumber()
(c) IsNotNumeric()
(d) IsNotNumber()
(e) IsNumberOrNot().
(a) green
(b) blue
(c) black
(d) red
(e) White.
20. Which property does one use to align text to the right
side of a block-level element in Cascading Style Sheets?
(a) horizontal-align
(b) align
(c) block-align
(d) justify
(e) text-align.
(a) setLayout()
(b) Layout()
(c) setContainerLayout()
(d) ContainerLayout()
(e) setConLayout().
(a) setSize()
(b) setBounds()
(c) setPosition()
(d) setPositionSize()
(e) setSizePosition().
(a) getCanvas()
(b) getGraphics()
(c) paint()
(d) getPaint()
(e) accessGraphics().
(a) getDate()
(b) Date()
(c) Now()
(d) getCurrentDate()
(e) CurrentDate().
29. In ASP the function which returns an expression
formatted as a date or time is:
(a) FormatDateOrTime()
(b) FormatDateAndTime()
(c) FormatTimeDate()
(d) FormatDateTime()
(e) FormatDT()
D. none of these
Answer:
A.document object model
31. ________ java script is also called server side java script
A. java script
C. nevigator
D. live wire
Answer:
D.live wire
B. 2
C. 3
D. 4
Answer:
A.1
B. false
C. both a and b
D. none of these ..
Answer:
A.true
B. html
C. href
D. none of these
Answer:
A.bandwidth
B. rgba
C. hsla
D. all of these
Answer:
D.all of these
B. 3
C. 120
D. 7
Answer:
A.140
B. br
C. <pre>
D. <marquee>
Answer:
A. <p>
B. <br>
C. <pre>
D. <marquee>
Answer:
B.<br>
B. br
C. <pre>
D. <marquee>
Answer:
C.<pre>
B. <br>
C. <pre>
D. <marquee>
Answer:
D.<marquee>
B. br
C. <pre>
D. <marquee>
Answer:
D.<marquee>
B. br
C. <pre>
D. <marquee>
Answer:
A.<ol>
B. br
C. <pre>
D. <marquee>
Answer:
A.<ul>
B. br
C. <pre>
D. <marquee>
Answer:
A.<!—->
B. br
C. <pre>
D. <marquee>
Answer:
A.<i>
B. br
C. <pre>
D. <marquee>
Answer:
A.<big>
B. br
C. <pre>
D. <marquee>
Answer:
A.<def>
B. br
C. <pre>
D. <marquee>
Answer:
A.<cite>
B. logical
C. center tag
D. a and b b both
Answer:
D.a and b b both
B. <center>
C. <pre>
D. <marquee>
Answer:
B.<center>
B. false
C. both a and b
D. none of these.
Answer:
A.true
52. ________ the space between is the space between content of
the cell and cell wall .
A. <p>
B. <center>
C. cell spacing
D. <marquee>
Answer:
C.cell spacing
B. <center>
C. cell spacing
D. <marquee>
Answer:
A.border
B. <th>
C. <frameset>
D. <a>
Answer:
A.<tr>
55. __________tag is used to create the table heading of the
table
A. <tr>
B. <th>
C. <frameset>
D. <a>
Answer:
B.<th>
56. To make a cell span more than one column, it is called use
the _______attribute
A. <tr>
B. colspan
C. <frameset>
D. rowspan
Answer:
B.colspan
57. To make a cell span more than one row, it is called use the
_______ attribute.
A. <tr>
B. colspan
C. <frameset>
D. rowspan
Answer:
D.rowspan
C. <frame>
D. rowspan
Answer:
C.<frame>
B. columun
C. frame
D. rowspan
Answer:
C.frame
B. colspan
C. <frameset>
D. rowspan
Answer:
C.<frameset>
B. ftp
C. physical
D. hyperlink
Answer:
A.tcp/ip
B. ftp
C. physical
D. hyperlink
Answer:
A.tcp/ip
B. ftp
C. physical
D. hyperlink
Answer:
B.ftp
B. ftp
C. physical
D. hyperlink
Answer:
A.<head>
B. <body>
C. physical
D. hyperlink
Answer:
B.<body>
B. ftp
C. physical
D. hyperlink
Answer:
C.physical
67. The LINKS starts at the ((Source)) anchor and points to the
((Destination)) anchor. TheseLINKIS are called as ___________
A. <head>
B. <body>
C. physical
D. hyperlink
Answer:
D.hyperlink
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<a>
B. checkbox
C. <textarea>
D. <text>
Answer:
B.checkbox
70. _________it is used to give the show the input box with
multiple rows and column.
A. <a>
B. checkbox
C. <textarea>
D. <text>
Answer:
C.<textarea>
71. __________- accept the any text in intput box..
A. <a>
B. checkbox
C. <textarea>
D. <text>
Answer:
D.<text>
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<submit>
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<password>
C. double
D. long
Answer:
C.double
B. iso-latin-1
C. unicode
Answer:
C.unicode
B. 0 & 1
D. true
Answer:
A.true & false
B. 2
C. 3
D. 4
Answer:
A.1
78. Which right shift operator preserves the sign of the value?
A. <<
B. >>
C. <<=
D. >>=
Answer:
B.>>
B. boolean
C. characters
D. double
Answer:
B.boolean
C. boolean
Answer:
C.boolean
81. Which of these jump statements can skip processing the
remainder of thecode in its body for a particular iteration?
A. break
B. return
C. exit
D. continue
Answer:
D.continue
B. if-else
C. switch
D. do-while
Answer:
D.do-while
B. break
C. continue
D. return
Answer:
A.exit()
B. alloc
C. new
D. new malloc
Answer:
C.new
Answer:
D.int x[] = int [5] new
B. switch
C. if & switch
Answer:
A.if
B. customize
C. class
D. id rule
Answer:
A.background
B. customize
C. class
D. id rule
Answer:
B.customize
B. customize
C. class
D. id rule
Answer:
D.id rule
B. customize
C. class
D. id rule
Answer:
C.class
B. selector
C. declaration
D. text color
Answer:
A.property name
B. selector
C. declaration
D. text color
Answer:
B.selector
B. selector
C. declaration
D. text color
Answer:
C.declaration
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<reset>
B. html
C. <textarea>
D. <text>
Answer:
A.css
B. serve
C. cache
D. client
Answer:
B.serve
B. server
C. empty
D. head tag
Answer:
A.web browser
B. server
C. empty
D. head tag
Answer:
C.empty
99. The HTML tag to left align the content inside a table cell is
<td align = “left”>.
A. true
B. false
C. both a and b
D. none of these
Answer:
A.true
B. server
C. empty
D. head tag
Answer:
D.head tag
101. Tags and text that are not directly displayed on the page
are written in___________section.
A. web browser
B. title
C. empty
D. head
Answer:
D.head
102. Some tags enclose the text. Those tags are known as
___________
A. single tag
B. paired tag
C. empty
D. head
Answer:
A.single tag
B. paired tag
C. strikeout
D. head
Answer:
C.strikeout
104. The <del> tag is used to display ________ text form a
document
A. single tag
B. paired tag
C. strikeout
D. deleted
Answer:
D.deleted
B. paired tag
C. strikeout
D. deleted
Answer:
A.title tag
Function and String in PHP
B. -32768 to 32767
C. -2147483648 to 2147483647
Answer:
B.-32768 to 32767
C. -2147483648 to 2147483647
Answer:
A.-128 to 127
B. long
C. byte
D. float
Answer:
A.int
B. 0 to 256
C. 0 to 32767
D. 0 to 65535
Answer:
D.0 to 65535
B. iso-latin-1
C. unicode
Answer:
C.unicode
B. boolean b2 = ‘false’;
C. boolean b3 = false;
D. boolean b4 = ‘true’
Answer:
C.boolean b3 = false;
B. alloc
C. new
D. new malloc
Answer:
C.new
B. column
Answer:
A.row
B. boolean
C. characters
Answer:
D.both numeric & characters
Answer:
C.both integers and floating – point numbers
117. Which operator is used to invert all the digits in a binary
representation ofa number?
A. ~
B. <<<
C. >>>
D. ^
Answer:
A.~
B. 32
C. 33
D. 31
Answer:
D.31
C. &
D. &&
Answer:
D.&&
C. *
D. >>
Answer:
A.()
Answer:
D.addition operator, +, and subtraction operator have equal
precedence
B. switch
C. if & switch
Answer:
B.switch
B. for()
C. continue
D. break
Answer:
A.if()
B. goto
C. continue
D. return
Answer:
D.return
B. bandwidth
C. webpage
D. dream viewer
Answer:
B.bandwidth
B. bandwidth
C. webpage
D. dream viewer
Answer:
C.webpage
B. bandwidth
C. webpage
D. dream viewer
Answer:
A.http
B. false
C. both a & b
D. none of these
Answer:
A.true
129. Following are the types of CSS , which one is not type of
CSS.
A. inline css:
C. external css:
D. none of these.
Answer:
D.none of these.
B. <span>
C. <img>
D. <tt>
Answer:
B.<span>
B. <span>
C. <img>
D. <tt>
Answer:
A.<map>
B. <span>
C. <img>
D. <tt>
Answer:
A.<map>
133. The _____________element is often used as a container for
other HTML elements tostyle them with CSS or to perform
certain tasks with JavaScript.
A. <map>
B. <div>
C. <img>
D. <tt>
Answer:
B.<div>
B. <span>
C. <img>
D. <tt>
Answer:
D.<tt>
B. <em>
C. <u>
D. <strong >
Answer:
A.<small>
136. ______tag Indicates that the text should be displayed
underlined. Not all browserssupport this tag.
A. <small>
B. <em>
C. <u>
D. <strong >
Answer:
C.<u>
B. <em>
C. <u>
D. <strong >
Answer:
B.<em>
B. <em>
C. <u>
D. <strong >
Answer:
D.<strong >
139. _________tag Used to offset text that the user should enter.
Often displayed in aCourier font or a similar font that allots
the same width to each character.
A. <small>
B. <em>
C. <kbd >
D. <strong >
Answer:
C.<kbd >
B. <em>
C. <kbd >
D. <strong >
Answer:
A.<var>
B. <cite>
C. <kbd >
D. <strong >
Answer:
B.<cite>
B. <tr>
C. <kbd >
D. <strong >
Answer:
B.<tr>
B. <tr>
C. <td >
D. <th >
Answer:
A.<table>
D. none of these
Answer:
A.cascading style sheets
C. navigation
D. dream viewer
Answer:
C.navigation
B. bandwidth
C. webpage
D. dream viewer
Answer:
D.dream viewer
B. java script
C. angular js
D. none of these
Answer:
A.php
B. java script
C. angular js
D. none of these
Answer:
A.php
B. java script c
C. angular js
D. none of these
Answer:
A.php
B. .js
C. .ajs
D. none of these
Answer:
A..php
B. java script
C. angular js
D. none of these
Answer:
A.echo
B. small
C. short
D. none of these
Answer:
A.wide
B. integer
Answer:
D.all of the above .
B. implicitly
C. both a and b
D. none of these
Answer:
A.explicitly
C. string operators
Answer:
D.all of the above
B. ++
C. ==
D. ?
Answer:
A.=
B. if condition
C. foreach
D. while
Answer:
A.switch
B. for loop
C. foreach
Answer:
D.all the these.
B. procedure
C. block
D. loop
Answer:
A.function
------>>[MOST IMPORTANT]<<------
WEB TECHNOLOGY
Web Technology
Course Outcome ( CO)
At the end of course , the student will be
able to understand
CO 1 Explain web development Strategies and Protocols governing Web..
CO 5 Building enterprise level applications and manipulate web databases using JDBC
Unit Topic
Introduction: Introduction and Web Development Strategies, History of Web and Internet,
Protocols Governing Web, Writing Web Projects, Connecting to Internet, Introduction to
I Internet services and tools, Introduction to client-server computing. Core Java: Introduction,
Operator, Data type, Variable, Arrays, Methods & Classes, Inheritance, Package and Interface,
Exception Handling, Multithread programming, I/O, Java Applet, String handling, Event
handling, Introduction to AWT, AWT controls, Layout managers
Web Page Designing: HTML: List, Table, Images, Frames, forms, CSS, Document type
II definition, XML: DTD, XML schemes, Object Models, presenting and using XML, Using
XML Processors: DOM and SAX, Dynamic HTML
Scripting: Java scriAJAXpt: Introduction, documents, forms, statements, functions, objects;
introduction to Networking : Internet Addressing, InetAddress, Factory Methods, Instance
III Methods, TCP/IP Client Sockets, URL, URL Connection, TCP/IP Server Sockets, Datagram
Servlets: Servlet Overview and Architecture, Interface Servlet and the Servlet Life Cycle,
V Handling HTTP get Requests, Handling HTTP post Requests, Redirecting Requests to Other
Resources, Session Tracking, Cookies, Session Tracking with Http Session
Java Server Pages (JSP): Introduction, Java Server Pages Overview, A First Java Server Page
Example, Implicit Objects, Scripting, Standard Actions, Directives, Custom Tag Libraries.
1 University Academy
WEB TECHNOLOGY 2020-21
WEB TECHNOLOGY
Solved MCQ
Topic Page
2 University Academy
WEB TECHNOLOGY 2020-21
to the Web server. The _____ method a. A URL represents the server a client
encodes the values as part of the URL. wants to make a request to
a. Post b. A URL helps identify the resource a
b. Get client wants to make a request to
c. Read c. URLs help find the fastest route on the
d. Argument network
11. Documents converted to …………… can d. None of the above
be published to the Web. 16. Dynamic web page:
a. .doc file a. Is same every time whenever it
b. http displays
c. machine language b. Generates on demand by a program
d. HTML or a request from browser
12. When sender and receiver of an e-mail are c. Both
on same system, we need only two d. None
a. User Agents 17. Which factor does NOT influence the
b. Servers performance of a webapp?
c. IP a. The browser used to open the webapp
d. Domain by your users
13. A web cookie is a small piece of data. b. The quality of the network between
a. Sent from a website and stored in client and server
user’s web browser while a user is c. The hardware configuration of the
browsing a website server
b. Sent from user and stored in the server d. The browser that you used while
while a user is browsing a website testing and deploying your webapp
c. Sent from root server to all servers 18. Common gateway interface is used to?
d. All a. Generate web pages
b. Generate executable files from web
14. URL stands for? content by web server
a. Unique reference label c. Stream videos
b. Uniform reference label d. All
c. Uniform resource locator
d. Unique resource locator 19. Computer which stores the different web
15. Which of the following statements are pages is called as:
correct? a. Service Provider
b. Web Browser
4 University Academy
WEB TECHNOLOGY 2020-21
c. Web Crawler
d. Web Server 25. The following enables access to computing
resources remotely
20. A __________ is the simplest form of a a. FTP
website, in which the site’s content is b. VPN
delivered without the use of server-side c. Blog
processing. d. Twitter
a. E-Commerce Website
b. Dynamic Websites 26. The following allows an Internet host
c. Social Networking Websites Computer to become a terminal of another
d. Static website host on the Internet
21. Which protocol helps to transfer files a. TELNET
between computers? b. Google Groups
a. FTP c. Microsoft OneDrive
b. HTTP d. None of the above
c. UDP
d. FTTP 27. To which protocol(s) are all hosts on the
ARPANET were switched over from the
22. The values GET, POST, HEAD, etc are older ARPANET protocols
specified in ____ of HTTP message. a. UNIX
a. Request line b. TCP/IP
b. Header line c. SSL
c. Entity body d. SIP
d. Status line
23. DNS is an Internet service that translates 28. Who is the Inventor of the Internet?
domain names to or from: a. Vincent Cerf
a. MAC address b. Bob Kahn
b. IP address c. Both (a) and (b)
c. Both d. None of the above
d. None 29. The following is a collection of
24. FTP stands for interconnected documents and other
a. Food Transfer Program resources
b. File Transfer Protocol a. Web
c. File Transfer Programming b. E-mail
d. Facebook To Python c. Chat
5 University Academy
WEB TECHNOLOGY 2020-21
6 University Academy
WEB TECHNOLOGY 2020-21
41. CIDR stands for 47. The following is like a large notice board
a. Classless Internet Domain Routing a. Newsgroup
b. Classless Inter Domain Routing b. E-mail
c. Classless Inter Domain Router c. Chat
d. Classless Internet Domain Router d. Browsing
48. The following is a page or collection of
42. SMTP stands for web pages designed to create and edit
a. Simple Merge Transfer Protocol contents
b. Simple Manual Transfer Protocol a. Forum
c. Simple Mail Transfer Protocol b. Bulletin Board
d. Separate Mail Transfer Protocol c. Chat
43. The following folder normally stores all d. Wiki
unsolicited e-mails 49. The following is the name of the process of
a. Inbox moving a file from a remote location to
b. Spam another location, sometimes, to your
c. Starred Computer Hard Disk
d. Trash a. Uploading
44. The following software supports instant b. Downloading
messaging service c. Deleting
a. Messenger d. Creating
b. E-mail
c. Only Google 50. The following lists are also called glossary
d. Only Yahoo lists
45. SMS stands for a. Unordered lists
a. Sample Messaging Service b. Ordered lists
b. Simple Messaging Service c. Definition lists
c. Stationary Messaging Service d. Linked lists
d. Small Messaging Service 51. The following tag is supported by
Microsoft Internet Explorer but not by
46. Chat is formally known as Netscape Navigator
a. Asynchronous conferencing a. <marquee>
b. Synchronous conferencing b. <br>
7 University Academy
WEB TECHNOLOGY 2020-21
c. <!–>
d. <p> 56. In java control statements break, continue,
return, try-catch-finally and assert belongs
52. The following is a tool for Web Page to?
Design a. Selection statements
a. Microsoft Expression Web b. Loop Statements
b. Microsoft Word c. Transfer statements
c. Google Sheets d. Pause Statement
d. Adobe Reader
53. TCP/IP stands for 57. Which provides runtime environment for
a. Transfer Control Protocol/Intranet java byte code to be executed?
Protocol a. JDK
b. Transfer Control Protocol/Internet b. JVM
Protocol c. JRE
c. Transmission Control d. JAVAC
Protocol/Internet Protocol
d. Transmission Control 58. What is byte code in Java?
Protocol/Intranet Protocol a. Code generated by a Java compiler
54. The following software allows authoring of b. Code generated by a Java Virtual
programs in identical environments on Machine
either the PC or the Macintosh and produce c. Name of Java source code file
runtimes for either d. Block of code written inside a class
a. Authorware 3
b. Fortran 59. Which of the following are not Java
c. DBase keywords ?
d. Pascal a. double
b. switch
55. Who is known as father of Java c. then
Programming Language? d. instanceof
a. James Gosling 60. Which of these have highest precedence?
b. M. P Java a. ()
c. Charel Babbage b. ++
d. Blais Pascal c. *
d. >>
8 University Academy
WEB TECHNOLOGY 2020-21
65. What is garbage collection in the context of 69. Which of these operators is used to allocate
Java? memory to array variable in Java?
a. Java deletes all unused java files on a. alloc
the system. b. malloc
c. new malloc
d. new
9 University Academy
WEB TECHNOLOGY 2020-21
c. go()
70. Which of these is not a bitwise operator? d. stop()
a. &' Operator
b. &=' Operator 75. What is the full form of JVM ?
c. |=' Operator a. Java Very Large Machine
d. <=' Operator b. Java Verified Machine
c. Java Very Small Machine
71. Which of these is returned by Greater Than, d. Java Virtual Machine
Less Than and Equal To (i.e Relational)
operator ? 76. In Java code, the line that begins with /*
a. Fload and ends with */ is known as?
b. Integer a. Multiline comment
c. Boolean b. Single line comment
d. Double c. Both A & B
d. None of these
72. Which statement transfer execution to 77. Which of the following are not Java
different parts of your code based on the modifiers?
value of an expression? a. Public
a. If b. private
b. Switch c. friendly
c. Nested-if d. transient
d. if-else-if
78. Output of the program
73. What feature of OOP has a super-class sub-
class concept?
a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
a. Compiler Error: Operator >> cannot
d. Multilevel inheritance
be applied to negative numbers
b. 2 2
c. 02
74. Which of the following are not the methods
d. -2 2
of the Thread class?
a. yield() 79. Output of the program
b. sleep(long msec)
10 University Academy
WEB TECHNOLOGY 2020-21
b. Stack
c. Disk
d. File
11 University Academy
WEB TECHNOLOGY 2020-21
c. try
d. None of these
90. Which of these packages contain all the
Java’s built in exceptions?
87. Find the correct statement about Java- a. java.lang
Exception b. java.util
c. java.io
d. java.net
12 University Academy
WEB TECHNOLOGY 2020-21
95. " It causes the currently executing thread a. A class can extends only one
object to pause and allow other threads to another class
execute temporarily". The above statement b. A class can extends multiple
belongs to which JAVA-Thread -Method classes.
activity c. A class can extends multiple
a. yield() interfaces.
b. join() d. An interface can extends multiple
c. suspend() interfaces
d. notify()
100. In java, “this” keyword is used to
a. Pass as an argument to a method.
96. What concepts come under Polymorphism b. Refer current class object.
in java? c. Return current class object.
a. Method overloading d. All are correct
b. Constructor overloading
c. Method overriding
101. Garbage collection in Java is:
d. All the above
a. Unused package in a program
97. Which is runtime polymorphism in Java automatically gets deleted.
oops? b. Memory occupied by objects with
a. Method overriding no reference is automatically
b. Method overloading reclaimed for deletion.
c. Constructor overloading c. Java deletes all unused java files on
d. All the above the system.
d. The JVM cleans output of Java
98. "super" keyword in java is used to
program.
a. Refer immediate parent class
instance variables.
b. Invoke immediate parent class 102. Correct syntax to create Java
methods. package(named as "myPackage")
c. Invoke immediate parent class a. import myPackage;
constructor. b. create package myPackage;
d. All the above c. new package myPackage;
d. package myPackage;
13 University Academy
WEB TECHNOLOGY 2020-21
14 University Academy
WEB TECHNOLOGY 2020-21
c. Panel a. java.awt
d. Frame b. java.Graphics
111. Which is used to store data and partial c. java.awt.Graphics
results, as well as to perform dynamic d. None of the above
linking, return values for methods, and 116. How many ways can we align the
dispatch exceptions? label in a container?
a. Window a. 1
b. Panel b. 2
c. Frame c. 3
d. Container d. 4
112. What are the different types of 117. What will be the output of the
controls in AWT? following Java program?
a. Labels
b. Pushbuttons class main_class
c. Checkboxes {
d. Choice lists public static void main(String args[])
e. All of these {
int x = 9;
113. Give the abbreviation of AWT? if (x == 9)
a. Applet Windowing Toolkit {
b. Abstract Windowing Toolkit int x = 8;
c. Absolute Windowing Toolkit System.out.println(x);
d. None of the above }
}
114. The following specifies the advantages }
of It is lightweight. It supports pluggable a. 9
look and feel. It follows MVC (Model b. 8
View Controller) architecture. c. Compilation error
a. Swing d. Runtime error
b. AWT
c. Both A & B 118. What will be the output of the
d. None of the above following Java program?
115. Which class provides many methods
for graphics programming? class box
15 University Academy
WEB TECHNOLOGY 2020-21
{ d. constructor
int width; 121. Which method can be defined only
int height; once in a program?
int length; a. main method
} b. finalize method
class mainclass c. static method
{ d. private method
public static void main(String args[]) 122. Which of this statement is incorrect?
{ a. All object of a class are allotted
box obj = new box(); memory for the all the variables
obj.width = 10; defined in the class
obj.height = 2; b. If a function is defined public it can be
obj.length = 10; accessed by object of other class by
int y = obj.width * obj.height * inheritation
obj.length; c. main() method must be made public
System.out.print(y); d. All object of a class are allotted
} memory for the methods defined in
} the class
a. 12
b. 200 123. What will be the output of the
c. 400 following Java program?
d. 100
class equality
119. What is the process of defining more {
than one method in a class differentiated by int x;
method signature? int y;
a. Function overriding boolean isequal()
b. Function overloading {
c. Function doubling return(x == y);
d. None of the mentioned }
120. Which of the following is a method }
having same name as that of it’s class? class Output
a. finalize {
b. delete public static void main(String args[])
c. class {
16 University Academy
WEB TECHNOLOGY 2020-21
equality obj = new equality(); 127. What will be the output of the
obj.x = 5; following Java code?
obj.y = 5; class box
System.out.println(obj.isequal()); {
} int width;
} int height;
a. false int length;
b. true int volume;
c. 0 void finalize()
d. 1 {
volume = width*height*length;
System.out.println(volume);
124. Which of the following is a method }
having same name as that of its class? protected void volume()
a. finalize {
b. delete volume = width*height*length;
c. class System.out.println(volume);
d. constructor }
125. Which operator is used by Java run }
time implementations to free the memory class Output
of an object when it is no longer needed? {
a. delete public static void main(String args[])
b. free {
c. new box obj = new box();
d. none of the mentioned obj.width=5;
obj.height=5;
126. Which function is used to perform obj.length=6;
some action when the object is to be obj.volume();
destroyed? }
a. finalize() }
b. delete() a. 150
c. main() b. 200
d. none of the mentioned c. Run time error
d. Compilation error
17 University Academy
WEB TECHNOLOGY 2020-21
18 University Academy
WEB TECHNOLOGY 2020-21
19 University Academy
WEB TECHNOLOGY 2020-21
20 University Academy
WEB TECHNOLOGY 2020-21
21 University Academy
WEB TECHNOLOGY 2020-21
22 University Academy
WEB TECHNOLOGY 2020-21
23 University Academy
WEB TECHNOLOGY 2020-21
14. Markup tags tell the web browser c. HTML, Head, Title, Body
a. The requested HTML file is not 19. How to insert an image in HTML?
b. The URL refers to a CGI script and b. <img url = "jtp.png" />
the header of the script does not c. <img link = "jtp.png" />
d. <img src = "jtp.png" />
24 University Academy
WEB TECHNOLOGY 2020-21
25 University Academy
WEB TECHNOLOGY 2020-21
c. <italic> c. dot
d. <i> d. all of above
40. Choose the correct HTML tag to make a 46. Which tag creates a check box for a form in
text bold? HTML?
a. <b> a. <checkbox>
b. <bold> b. <input type="checkbox">
c. <bb> c. <input=checkbox>
d. <bld> d. <input checkbox>
41. What is the correct HTML for adding a 47. To create a combo box (drop down box)
background color? which tag will you use?
a. <body color=”yellow”> a. <select>
b. <body bgcolor=”yellow”> b. <list>
c. <background>yellow</background> c. <input type="dropdown">
d. <body background=”yellow”> d. all of above
42. Choose the correct HTML tag for the 48. Which of the following is not a pair tag?
smallest size heading? a. <p>
a. <heading> b. < u >
b. <h6> c. <i>
c. <h1> d. <img>
d. <head> 49. To create HTML document you require
43. What is the correct HTML tag for inserting a. web page editing software
a line break? b. High powered computer
a. <br> c. Just a notepad can be used
b. <lb> d. None of above
c. <break> 50. HTML documents are saved in
d. <newline> a. Special binary format
44. What doesvlink attribute mean? b. Machine language codes
a. visited link c. ASCII text
b. virtual link d. None of above
c. very good link 51. The _____ character tells browsers to stop
d. active link tagging the text
45. Which attribute is used to name an element a. ?
uniquely? b. /
a. class c. >
b. id d. %
27 University Academy
WEB TECHNOLOGY 2020-21
28 University Academy
WEB TECHNOLOGY 2020-21
a. All the statements are true 71. DTD includes the specifications about the
b. All XML elements must have a markup that can be used within the
closing tag document, the specifications consists of all
c. All XML elements must be lower case EXCEPT
d. All XML documents must have a DTD
a. the browser name
67. Is it easier to process XML than HTML? b. the size of element name
c. entity declarations
a. Yes d. element declarations
b. No
c. Somtimes 72. The XML DOM object is
d. Cant say
a. Entity
68. Well formed XML document means b. Entity Reference
c. Comment Reference
a. it contains a root element d. Comment Data
29 University Academy
WEB TECHNOLOGY 2020-21
a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these
30 University Academy
WEB TECHNOLOGY 2020-21
switch(expression)
{
statements
}
a. Code-A
a. = = =
b. Code-B
b. equal
c. Both Code-A and Code-B
c. ==
d. Cannot Compare
d. Equals
4. In JavaScript, what is a block of
7. Which of the following variables takes
statement?
precedence over the others if the names
a. Conditional block are the same?
b. block that combines a number of
a. Global variable
statements into a single
b. The local element
compound statement
31 University Academy
WEB TECHNOLOGY 2020-21
c. The two of the above 12. When a user views a page containing a
d. None of the above JavaScript program, which machine
actually executes the script?
8. Which of the following type of a
variable is volatile? a. The User's machine running a
Web browser
a. Mutable variable
b. The Web server
b. Dynamic variable
c. A central machine deep within
c. Volatile variable Netscape's corporate offices
d. Immutable variable d. None of the above
9. Which of the following option is used 13. ______ JavaScript is also called client-
a. Microsoft
a. 00
b. Navigator
b. 0x
c. LiveWire
c. 0X
d. Native
d. Both 0x and 0X
14. __________ JavaScript is also called
10. In the JavaScript, which one of the server-side JavaScript.
following is not considered as an error:
a. Microsoft
a. Syntax error b. Navigator
32 University Academy
WEB TECHNOLOGY 2020-21
a. Return a value
hold the JavaScript version?
27. What is the correct syntax for referring 31. What does the <noscript> tag do?
to an external script called " abc.js"?
a. Enclose text to be displayed by non-
a. <script href=" abc.js"> JavaScript browsers.
b. <script name=" abc.js">
34 University Academy
WEB TECHNOLOGY 2020-21
JavaScript? c. ParseFloat
d. Efloat
a. a low-level programming language.
b. a scripting language precompiled in 39. Which of the following event fires
the browser. when the form element loses the focus:
c. a compiled scripting language. <button>, <input>, <label>, <select>,
d. an object-oriented scripting
<textarea>?
language.
a. onfocus
35. Choose the server-side JavaScript b. onblur
object? c. onclick
d. ondblclick
a. FileUpLoad
b. Function 40. The syntax of Eval is ____
c. File
35 University Academy
WEB TECHNOLOGY 2020-21
a. [objectName.]eval(numeriC. b. dateObjectName.new
b. [objectName.]eval(string) Date([parameters])
c. [EvalName.]eval(string) c. dateObjectName := new
d. [EvalName.]eval(numeriC. Date([parameters])
41. JavaScript is interpreted by _________ d. dateObjectName Date([parameters])
45. The _______ method of an Array
a. Client
object adds and/or removes elements
b. Server
from an array.
c. Object
d. None of the above a. Reverse
42. Using _______ statement is how you b. Shift
test for a specific condition. c. Slice
d. Splice
a. Select
b. If
46. To set up the window to capture all
c. Switch
Click events, we use which of the
d. For
following statement?
a. window.captureEvents(Event.CLICK);
43. Which of the following is the structure b. window.handleEvents (Event.CLICK);
of an if statement? c. window.routeEvents(Event.CLICK );
d. window.raiseEvents(Event.CLICK );
a. if (conditional expression is true)
thenexecute this codeend if
47. Which tag(s) can handle mouse events
b. if (conditional expression is
in Netscape?
true)execute this codeend if
c. if (conditional expression is true) a. <IMG>
{then execute this code>->} b. <A>
d. if (conditional expression is true) then c. <BR>
{execute this code} d. None of the above
44. How to create a Date object in
JavaScript? 48. ____________ is the tainted property of
a window object.
a. dateObjectName = new
Date([parameters]) a. Pathname
b. Protocol
36 University Academy
WEB TECHNOLOGY 2020-21
c. Defaultstatus c. JavaObject
d. Host d. Jobject
49. To enable data tainting, the end user 53. _________ is a wrapped Java array,
sets the _________ environment accessed from within JavaScript code.
variable.
a. JavaArray
a. ENABLE_TAINT b. JavaClass
b. MS_ENABLE_TAINT c. JavaObject
c. NS_ENABLE_TAINT d. JavaPackage
d. ENABLE_TAINT_NS 54. A ________ object is a reference to one
of the classes in a Java package, such as
50. In JavaScript, _________ is an object netscape.javascript .
of the target language data type that
a. JavaArray
encloses an object of the source
b. JavaClass
language.
c. JavaObject
a. a wrapper d. JavaPackage
b. a link
c. a cursor 55. To open a dialog box each time an error
d. a form occurs, which of the following is added
to prefs.js?
51. When a JavaScript object is sent to
a. user_pref("javascript.classic.error
Java, the runtime engine creates a Java
_alerts", true);
wrapper of type ___________
b. user_pref("javascript.classic.error_al
b. JSObject c. user_pref("javascript.console.open_o
d. Jobject d. user_pref("javascript.console.open_o
invoking JavaScript methods and 56. The syntax of a blur method in a button
a. ScriptObject a. Blur()
b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21
38 University Academy
WEB TECHNOLOGY 2020-21
67. Which of the following is AJAX? 72. Which of the following makes Ajax
unique?
a. is a program
b. is a country name a. It works the same with all Web
c. is a football club name browsers.
d. All of these b. It works as a stand-alone Web-
68. Which of the following are the features development tool.
of Ajax? c. It makes data requests
asynchronously.
a. Live data binding d. It uses C++ as its programming
b. Declarative instantiation of client language.
components
c. Client-side template rendering 73. _________________ combination of
d. All of the above technologies gives AJAX its name.
39 University Academy
WEB TECHNOLOGY 2020-21
popular. b. JSUnit
c. AjaxJSU
a. IBM d. JSUnitAjax
b. Microsoft 80. In Ajax ______________ready states
c. Sun Micro system are available.
d. Google
a. 4
75. AJAX can work with web application. b. 6
c. 8
a. true d. 2
b. False
79. How can you test the Ajax code? a. Debugging is difficult
40 University Academy
WEB TECHNOLOGY 2020-21
b. Increases size of the requests 89. Which classes are used for connection-
c. Slow and unreliable network oriented socket programming?
connection.
d. All of the mentioned above a. Socket
b. ServerSocket
a. CORS
b. JSONP 90. Which class can be used to create a
c. both 1 & 2 server socket. This object is used to
d. None of the above establish communication with the
clients?
86. What are the technologies used by
Ajax? a. ServerSocket
b. Socket
a. XMLHttpRequest c. Both A & B
b. Cascading Style Sheets (CSS) d. None of the above
c. Extensible HTML (XHTML)
d. All of the above 91. Which methods are commonly used in
87. Show some networking terminologies ServerSocket class?
given below?
a. public OutputStream
a. IP Address getOutputStream()
b. Protocol b. public Socket accept()
c. MAC Address c. public synchronized void close()
d. All mentioned above d. None of the above
88. TCP,FTP,Telnet,SMTP,POP etc. are 92. The URLConnection class can be used
examples of ? to read and write data to the specified
resource referred by the URL?
a. Socket
b. IP Address a. True
c. Protocol b. False
d. MAC Address
41 University Academy
WEB TECHNOLOGY 2020-21
c. IPAddress
93. The java.net.InetAddress class d. None of the choices are correct.
102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.
43 University Academy
WEB TECHNOLOGY 2020-21
c. Stream
d. None of the choices are correct.
112. How many ports of TCP/IP are
reserved for specific protocols?
a. 10
b. 1024
c. 2048
d. 512
113. Which of these class is used to
encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
44 University Academy
WEB TECHNOLOGY 2020-21
45 University Academy
WEB TECHNOLOGY 2020-21
46 University Academy
WEB TECHNOLOGY 2020-21
d. None of the above 28. Which of the following EJB has no state?
23. Which session bean does the conversational i. Message-Driven Bean.
state between multiple method calls is not ii. BMP Entity Bean.
maintained by the container? iii. Stateless Session Bean.
iv. Stateful Session Bean.
a. Stateful Session Bean
b. Stateless Session Bean a. Both (I) and (II) above
c. Singleton Session Bean b. Both (II) and (III) above
d. None of the above c. Both (III) and (IV) above
24. EJB technology is built on the top of d. Both (I) and (III) above.
Socket Programming
a. True 29. Which of the following is true for EJB?
b. False
25. Which of the following is not true about a. EJB is server-side component
Java beans? architecture for distributed
a. Implements java.io.Serializable applications in Java
interface b. EJB facilitates scalable, secure and
b. Extends java.io.Serializable class transaction-oriented applications
c. Provides no argument constructor c. EJB supports portability and
d. Provides setter and getter methods for reusability
its properties d. All of the above.
26. Which of the following is the format for
EJB deployment descriptor files? 30. Which of the following EJB type has no
a. XML Remote interfaces?
b. XSL a. Message-Driven Bean
c. HTML b. BMP Entity Bean
d. Java c. Session Bean
27. EJB is a d. Sessionless Bean.
47 University Academy
WEB TECHNOLOGY 2020-21
(b) Consistency
32. Which of the EJB has a passive state in its (c) Isolation
life cycle? (d) Distributed
I. Stateless Session Bean.
II. Message-Driven Bean. 36. Which EJB usually represents persistent
III. BMP Entity Bean. data?
a. Entity Bean
a. Only (I) above b. Stateless Session Bean
b. Only (II) above c. Stateful Session Bean
c. Only (III) above d. Message-Driven Bean
d. Both (I) and (II) above 37. Which is least visibility scope for Java bean
e. Both (II) and (III) above. in JSP?
33. Which part of multi-tier enterprise a. Page
application contains EJB component? b. Session
a. Application Server c. Request
b. Web Server d. Application
c. Database Server 38. Which of the following annotation is used
d. Fat Client to specify or inject a dependency as ejb
e. Thin Client. instance into another ejb?
34. Which of the following distributed object a. javax.ejb.Stateless
technology is/are not included in Java? b. javax.ejb.Stateful
I. CORBA. c. javax.ejb.MessageDrivenBean
II. DCOM. d. javax.ejb.EJB
III. RMI. 39. The EJB specification architecture does
IV. EJB. NOT define
a. transactional components
a. Only (I) above b. client side security and encryption
b. Only (II) above c. distributed object components
c. Only (III) above d. server-side components
d. Only (IV) above 40. Which case of a session bean obtains the
e. All (I), (II), (III) and (IV) above. UserTransaction object via the EJBContext
using the getUserTransaction() method in
35. Which of the following is not a property of EJB transaction management?
EJB transaction? a. Bean-managed transactions
(a) Atomicity b. Container-managed transactions
48 University Academy
WEB TECHNOLOGY 2020-21
49 University Academy
WEB TECHNOLOGY 2020-21
54. Where is metadata stored in MySQL? 59. Which JDBC driver Types are for use over
a. In the MySQL database metadata communications networks?
b. In the MySQL database metasql a. Type 3 only
c. In the MySQL database mysql b. Type 4 only
d. None of the above is correct. c. Both Type 3 and Type 4
d. Neither Type 3 nor Type 4
55. Which JDBC driver Type(s) can be used in
either applet or servlet code? 60. JDBC stands for:
a. Both Type 1 and Type 2 a. Java Database Connectivity
b. Both Type 1 and Type 3 b. Java Database Components
c. Both Type 3 and Type 4 c. Java Database Control
d. Type 4 only d. None of the above is correct.
61. Which of the following is correct about
56. What MySQL property is used to create a Statement class of JDBC?
surrogate key in MySQL? a. Statement encapsulates an SQL
a. UNIQUE statement which is passed to the
b. SEQUENCE database to be parsed and compiled.
c. AUTO_INCREMENT
50 University Academy
WEB TECHNOLOGY 2020-21
51 University Academy
WEB TECHNOLOGY 2020-21
52 University Academy
WEB TECHNOLOGY 2020-21
8. Which of the following is true about 11. Connection Pooling Class manages no of
servlets? user requests for connections to improve the
a. Servlets execute within the address performance.
space of web server a. True
b. Servlets are platform-independent b. False
because they are written in java 12. Which object of HttpSession can be used
c. Servlets can use the full functionality of to view and manipulate information about a
the Java class libraries session?
d. Servlets execute within the address a. session identifier
space of web server, platform b. creation time
independent and uses the c. last accessed time
functionality of java class libraries d. All mentioned above
13. Using mail API we cannot send mail
9. How is the dynamic interception of requests from a servlet.
and responses to transform the information a. True
done? b. False
a. servlet container
b. servlet config 14. Which class provides stream to read binary
c. servlet context data such as image etc. from the request
d. servlet filter object?
53 University Academy
WEB TECHNOLOGY 2020-21
54 University Academy
WEB TECHNOLOGY 2020-21
55 University Academy
WEB TECHNOLOGY 2020-21
56 University Academy
WEB TECHNOLOGY 2020-21
46. State whether the following statements 49. State whether the following statements
about the methods provided by HTTP about the interfaces included in the servlet
servlet response are True or False. API are True or False.
i) The addCookie method must be called i) The HttpServletRequest provides access to
before the response is committed so that the an input stream and so allows the servlet to
appropriate headers can be set. read data from the client.
ii) Further output should be made by the ii) The HttpServletResponse provides access
servlet after calling the sendError method. to an output stream and so allows the servlet to
a. i-True, ii-True send data to the client.
b. i-True, ii-False a. i-True, ii-True
c. i-False, ii-True b. i-True, ii-False
d. i-False, ii-False c. i-False, ii-True
47. Which of the following are the methods of d. i-False, ii-False
cookies that are used for section tracking. 50. State whether the following statements
i) getMaxAge() about the GET method are True.
ii) getValue() i) In the GET method entire form submission
iii) getDate() can be encapsulated in one URL.
a. i and ii only ii) The query length is limited to 256
b. ii and iii only characters.
57 University Academy
WEB TECHNOLOGY 2020-21
iii) The data is submitted as a part of the URL. 54. Which of the following are the life cycle
a. i and ii only method of jsp?
b. ii and iii only a. jspInit()
c. i and iii only b. _jspService()
d. All i, ii and iii c. jspDestroy()
d. All of the above
51. State whether the following statements
about the POST method are True or False. 55. Request processing of JSP is done by
i) In the POST method, data is submitted calling which method?
inside the body of the HTTP request. a. jspInit()
ii) Here the data is visible on the URL and less b. _jspService()
secure. c. jspDestroy()
a. i-True, ii-True d. _jspRequest()
b. i-True, ii-False
c. i-False, ii-True 56. Which of the following method helps in jsp
d. i-False, ii-False page initialization?
52. What is full form of JSP? a. jspInit()
a. Java Service Provider b. _jspService()
b. Java Service Pages c. jspDestroy()
c. Java Server Provider d. init()
d. Java Server Pages 57. Which of the following is correct about
53. Which of the following is true about JSP? JSP?
1. JSP page is translated into Servlet.
1.JSP technology is used to create web 2. JSP translator is a part of the web server
application. which is responsible for translating the JSP
2. The JSP pages are not easier to maintain page into Servlet.
than Servlet. a. only 1
3. JSP page consists of HTML tags and JSP b. only 2
tags. c. Both 1 & 2
a. 1&2 d. None
b. 1 & 3 58. Which of the following folder in JSP
c. 2&3 project contains web.xml file?
d. All of the above a. META-INF
b. WEB-INF
c. context-root
58 University Academy
WEB TECHNOLOGY 2020-21
59 University Academy
WEB TECHNOLOGY 2020-21
69. The ________ object is created by the web 74. Which of the following is/are jsp action
container for each jsp page. tags?
a. application a. jsp:getProperty
b. config b. jsp:plugin
c. exception c. jsp:fallback
d. All of the above d. All of the above
70. This object can be used to get initialization 75. ______ action tag helps embeds another
parameter from configuaration file components such as applet.
(web.xml) a. jsp:plugin
a. config b. jsp:config
b. application c. jsp:setProperty
c. session d. jsp:fallback
d. request 76. <%@ page ... %>
71. Which of the following is not a jsp directive Above jsp element defines page-dependent
element? attributes, such as:
a. page directive a. scripting language
b. include directive b. error page
c. taglib directive c. buffering requirements
d. session directive d. All of the above
72. The pageContext object can be used to set or 77. <%@ include ... %>
get or remove attributes from which of the This jsp element helps to:
following scopes a. Includes a file during the translation
a. request phase
b. session b. Includes plugins during the translation
c. application phase
d. All of the above c. Declares a tag library, containing
custom actions, used in the page
73. Which of the following is not a jsp action d. there is no such jsp element available
tag?
60 University Academy
WEB TECHNOLOGY 2020-21
78. <%@ taglib ... %> b. A JSP page can be sent as-is to the
above jsp element is used to: browser
a. Declare a tag library used in the page c. The JSP container is often
b. Declare scripting language implemented as a servlet configured to
handle all requests for JSP pages.
c. Declare error page d. A JSP container is responsible for
d. All of the above converting the JSP page into a servlet
79. Which of the following jsp element makes a 83. The difference between Servlets and JSP is
JavaBeans component available in a page? the …………….
a. jsp:useBean element a. Translation
b. jsp:getProperty element b. Compilation
c. jsp:include element c. Syntax
d. jsp:plugin element d. Both A and B
84. Which attribute specifies a JSP page that
80. Gets a property value from a JavaBeans should process any exceptions thrown but
component and adds it to the response in jsp not caught in the current page?
a. jsp:getProperty element a. The ErrorPage Attribute
b. jsp:setProperty element b. The IsErrorPage Attribute
c. jsp:param element c. Both A & B
d. jsp:includeProperty element d. None of the above
81. Which of the following are scopes provided
by jsp:
a. Page, Request, Session, Global-
Session
b. Page, Request, Session, Application,
Global-Session
c. Page, Request, Session, Application
d. Page, Request, Session, Application,
Response
82. Which of the following is not correct
statement related to jsp?
a. A JSP page cannot be sent as-is to the
browser
61 University Academy
Web Technologies Solved
MCQ - Part 2
http://freepdf-books.com
Web Technologies Solved
MCQ - Part 2
Well formed XML document means
_________________________________________________________
Which tags are commonly used by search engines?
Headings
Title
Paragraph
All of these
_________________________________________________________
XPATH used to
_________________________________________________________
DMSP stands for
http://freepdf-books.com
Distributed Message System Pool
Distributed Mail System Pool
_________________________________________________________
Address 192.5.48.3 belongs to
Class A
Class B
Class C
Class D
_________________________________________________________
_________________________________________________________
XML is a
Imperative language
Declarative language
Standard
None of these
_________________________________________________________
DOM is a
A parser
Specification
Coding style
None of these
http://freepdf-books.com
_________________________________________________________
A header in CGI script can specify
_________________________________________________________
The ______ is a set of standards that defines how a dynamic web
document should be written, how input data should be supplied to
the program, and how the output result should be used.
_________________________________________________________
XML uses the features of
HTML
XHTML
VML
SGML
_________________________________________________________
Repository of information gathered from multiple sources, storing
under unified scheme at a single site is called as
Data mining
Meta data
Data warehousing
Database
_________________________________________________________
http://freepdf-books.com
Which of the following identifies a specific web page and its
computer on the Web?
Web site
Web site address
URL
Domain Name
_________________________________________________________
DTD definition is used along with XML to specify
_________________________________________________________
What is XML?
_________________________________________________________
Internet data is broken up as
_________________________________________________________
The main function of a browser is to
http://freepdf-books.com
Compile HTML
Interpret HTML
De-compile HTML
Interpret CGI programs
_________________________________________________________
IP addresses are converted to
a binary string
alphanumeric string
a hierarchy of domain names
a hexadecimal string
_________________________________________________________
How many root element can an XML document have ?
One
Two
Three
As many as the memory provides
_________________________________________________________
The task of correcting and pre processing data is called as
Data streaming
Data cleaning
Data mining
Data storming
_________________________________________________________
The most popular way to materialize XML document is to use
DTD
XSLT
http://freepdf-books.com
HTML
SOAP
_________________________________________________________
The packets of an internet message
_________________________________________________________
Characteristic encoding is
_________________________________________________________
www is based on which model?
Local server
Client server
3 tier
None of these
_________________________________________________________
Attributes in XML are
Elements inXML
Child nodes
A way of attaching characteristics or properties to elements of a
document
None of these
http://freepdf-books.com
_________________________________________________________
i, ii
i, ii, iii
i, ii, iv
ii, iii and iv
_________________________________________________________
The tags in XML are
Case insensitive
Case sensitive
Browser dependent
None of these
_________________________________________________________
i, ii, iii
ii, iii, iv
i, iii
http://freepdf-books.com
ii, iii, iv, v
_________________________________________________________
XLL definition is used along with XML to specify
_________________________________________________________
Which of them take care of e mail at client side?
POP
MAP
IMAP
Both a and c
_________________________________________________________
Node in XML is
_________________________________________________________
The tracing model in Prolog describes program execution in terms of
certain events. These events are
http://freepdf-books.com
_________________________________________________________
Which Layer is not present in TCP/ IP model?
Application Layer
Internet Layer
Transport Layer
Presentation Layer
_________________________________________________________
Which of the following statement is true?
_________________________________________________________
Where are cookies stored?
On the server
Inweb.xml
On the client
In HTML
_________________________________________________________
Each list item in an ordered or unordered list has which tag?
List tag
Is tag
Li tag
Ol tag
_________________________________________________________
XML
http://freepdf-books.com
Can be used as a database
Cannot be used as a database
XML is not a database ,it is language
None of these
_________________________________________________________
(i)Encryption
(ii)HTTP
(iii)HTML
(iv)Firewalls
i and ii
ii and iii
iii and iv
i and iv
_________________________________________________________
(i)source address
(ii) destination address
(iii)serial number of packets
(iv)message bytes
(v)Control bits for error checking
(vi) Path identification bits
i, ii, iii
i, ii, iii, iv
i, ii, iii, iv, v
i, ii, iii, iv, v, vi
_________________________________________________________
http://freepdf-books.com
HTML (Hyper Text Markup Language) has language elements which
permit certain actions other than describing the structure of the web
document. Which one of the following actions is NOT supported by
pure HTML (without any server or client side scripting) pages?
Embed web objects from different sites into the same page
Refresh the page automatically after a specified interval
Automatically redirect to another page upon download
Display the client time as part of the page
_________________________________________________________
CIDR stands for
_________________________________________________________
The XML DOM object is
Entity
Entity reference
Comment reference
Comment data
_________________________________________________________
Which of the following tags below are used for multi line text input
control?
Textml tag
Text tag
Textarea tag
Both a and b
_________________________________________________________
http://freepdf-books.com
By an extranet we mean
_________________________________________________________
In HTML URI is used to
_________________________________________________________
i, ii, iii
i, ii, iii, iv
i, ii, iii, iv, v
i, ii, iii, v
_________________________________________________________
The term byte stuf fing refers to
http://freepdf-books.com
Data stuffing used with both A and B
Data stuffing used wi th byte oriented hardware
_________________________________________________________
Which type of web document is run at the client site
Static
Dynamic
Active
All of the above
_________________________________________________________
The web standard allows programmers on many different computer
platforms to dispersed format and display the information
server.These programs are called
Web browsers
HTML
Internet Explorer
None of these
_________________________________________________________
XML document can be viewed in
IE 3.0
IE 2.0
IE 6.0
IE X.0
http://freepdf-books.com
( Web Design / Web Technology /
Web Engineering )
❖ Follow us on Facebook
1. Microsoft XML schema data types for hexadecimal digits representing octates
A) UID
B) UXID
C) UUID
D) XXID
Ans-C
1
III. DNS
IV. Retrieval method
V. Server port number
A) I, II, III
B) I, III, V
C) I, II, IV
D) III, IV, V
Ans-B
4. XML
A) Can be used as a database
B) Cannot be used as a database
C) XML is not a database, it is language
D) None of these
Ans-A
2
5. The tags in XML are
A) Case insensitive
B) Case sensitive
C) Browser dependent
D) None of these
Ans-B
8. Which of the following attributes below are used for a font name?
A) Fontname
3
B) fn
C) Font
D) Face
Ans-D
4
Ans-B
5
A) No there is no such terms as empty element
B) Empty elements are element with no data
C) No it is not valid to use empty element
D) None of these
VIEW ANSWER
6
D) Square brackets
VIEW ANSWER
21. Namespace
A) Distinguishes one XML vocabulary from another
B) Provides the spaces in the names
C) Is a querying language
D) None of these
VIEW ANSWER
7
22. XML DSOs has the property for the number of pages of data the recordset
contains
A) Count
B) Number
C) Pagecount
D) Pagenumber
VIEW ANSWER
23. Which of the following identifies a specific web page and its computer on the
Web?
A) Web site
B) Web site address
C) URL
D) Domain Name
VIEW ANSWER
8
A) Exception
B) Error
C) Throwable
D) Raise
VIEW ANSWER
9
D) Classified Inter Domain Routing
VIEW ANSWER
30. MSXML is
A) A Microsoft language
B) XML parser that ships with IE5.0
C) Used for interacting with XML
D) None of these
VIEW ANSWER
10
32. Which Layer is not present in TCP/ IP model?
A) Application Layer
B) Internet Layer
C) Transport Layer
D) Presentation Layer
VIEW ANSWER
33. Each list item in an ordered or unordered list has which tag?
A) List tag
B) Is tag
C) Li tag
D) Ol tag
VIEW ANSWER
11
C) 3 tier
D) None of these
VIEW ANSWER
38. DOM is a
A) A parser
B) Specification
C) Coding style
D) None of these
VIEW ANSWER
12
39. XML is a
A) Imperative language
B) Declarative language
C) Standard
D) None of these
VIEW ANSWER
41. Which of the following tags below are used for multi line text input control?
A) Textml tag
B) Text tag
C) Textarea tag
D) Both a and b
VIEW ANSWER
13
B) IE 2.0
C) IE 6.0
D) IE X.0
VIEW ANSWER
14
VIEW ANSWER
46. The web standard allows programmers on many different computer platforms
to dispersed format and display the information server. These programs are called
A) Web browsers
B) HTML
C) Internet Explorer
D) None of these
VIEW ANSWER
15
49. Unlike Ipv4, Ipv6 does not include the following field in the base header
A) Next Header field
B) Field for Fragmentation information
C) Flow Label
D) Kind field
VIEW ANSWER
16
(C) <BODY> tag
(D) <HTML> tag
VIEW ANSWER
55. What are shared on the Internet and are called as Web pages?
(A) Programs
(B) Cables
(C) Hypertext documents
(D) None
VIEW ANSWER
17
56. ____ is used to store the data within the documents on the server.
(A) XML
(B) HTML
(C) DHTML
(D) CGI
VIEW ANSWER
59. Which program is used by web clients to view the web pages?
(A) Web browser
18
(B) Protocol
(C) Web server
(D) Search Engine
VIEW ANSWER
60. What is the name of the location address of the hypertext documents?
(A) Uniform Resource Locator
(B) Web server
(C) File
(D) Web address
VIEW ANSWER
19
VIEW ANSWER
65. Which tag is used to display text in title bar of a web document?
(A) Body tag
(B) Meta tag
(C) Title tag
(D) Comment tag
VIEW ANSWER
66. The ___ attribute is used to specify the width of the table.
20
(A) CELLPADDING
(B) WIDTH
(C) CELLSPACING
(D) BORDER
VIEW ANSWER
21
(D) To enable or disable option
VIEW ANSWER
70. The language that instructs the browser on how to display the hypertext, and
adds pictures to the document is __
(A) C
(B) COBOL
(C) HTML
(D) BASIC
VIEW ANSWER
72. The tag used to add images to the HTML document is ____
(A) <FONT>
(B) <HR>
(C) <HI>
(D) <IMG>
VIEW ANSWER
22
73. The ___ option allows the user to specify a location on the web.
(A) Format
(B) From location
(C) Location
(D) Insert
VIEW ANSWER
74. Which tag is used to change the default characteristics of a particular tag in
the entire web document wherever that tag is used?
(A) Meta tag
(B) Style tag
(C) Marquee tag
(D) Heading tag
VIEW ANSWER
75. The attributes that are used with <MARQUEE>tag are ___
(A) SIZE
(B) BG COLOR
(C) DIRECTION
(D) BG COLOR and DIRECTION
VIEW ANSWER
24
VIEW ANSWER
80. Which attribute can be used to change the colour of the links?
(A) Link
(B) ALINK
(C) VLINK
(D) All the above
VIEW ANSWER
82. Which tag is used to provide additional information about the page that is not
visible in the browser?
(A) Anchor tag
(B) Meta tag
(C) Comment tag
(D) Body tag
VIEW ANSWER
25
83. Which term is used to refer to the computers that are used for storing web
pages as files?
(A) Internet
(B) Web clients
(C) Web servers
(D) World Wide Web
VIEW ANSWER
84. Which tag is used to identify the keywords describing the site?
(A) Comment tag
(B) Title tag
(C) Meta tag
(D) Anchor tag
VIEW ANSWER
85. ____ files are more compact than the GIF files.
(A) .JPG and JPEG
(B) .JPG
(C) .JPEG
(D) None of the above
VIEW ANSWER
86. Which is the formal description of message formats and rules to be followed
by computers?
(A) Standards
26
(B) Protocol
(C) Syntax
(D) Language
VIEW ANSWER
87. Which tag is used to identify the author’s name of the web document?
(A) Anchor tag
(B) Meta tag
(C) Title tag
(D) Font tag
VIEW ANSWER
89. Which character is used after the opening angular bracket to represent the
closing tag?
(A) /
(B) ^
(C) |
(D) %
27
VIEW ANSWER
90. The ____ passes the information given by the user to a specified program.
(A) User
(B) Programmer
(C) Web server
(D) Browser
VIEW ANSWER
93. Which section of the Web page will contain Meta tags?
28
(A) Body section
(B) Heading section
(C) (a) or (b)
(D) None
VIEW ANSWER
96. Which one of the following indicates how light or dark a color appears on the
web page?
(A) Value
(B) shade
(C) Hue
29
(D) Tint
VIEW ANSWER
98. Interactive documents that can be created using a feature of HTML are called
____
(A) Tables
(B) Forms
(C) Files
(D) Frames
VIEW ANSWER
99. Who send the requisition for web pages to the web servers?
(A) Node
(B) System
(C) Web clients
(D) Web customer
VIEW ANSWER
30
100. A popular way of linking many documents was ___
(A) Notepad
(B) SGML
(C) Gopher
(D) Computer
VIEW ANSWER
31
Web Technologies - MCQs
1. The ___ receives a stream of tokens from the parser and sorts them according to function.
Ans: Event switcher
4. SAX and DOM are very different Where SAX models the parser, DOM models the XML ___.
Ans: Document
5. The main purpose of ___ is to add interactivity to the browser and Web pages.
Ans: JavaScript
10. ___ is an API that can be used by web scripting languages like JavaScript, VBScript, etc.
Ans: HTTP requests
11. HTTP requests provide a mechanism for transferring the data either in text or XML format between the web client
and the webserver. (True/False)
Ans: True
13. XMLHttpRequest object property ___ is used to returns a reference to the constructor of an object.
Ans: Constructor
14. XMLHttpRequest object method abort is used to cancels the current HTTP request. (True/False)
Ans: True
15. ___ is used to sets or retrieves the event handler for asynchronous requests.
Ans: Onreadystatechange
16. The argument in send method is ignored if the request method is ___.
Ans: GET or HEAD.
19. The ___ attribute is used to return the text response entity-body.
Ans: responseText
22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True
24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True
26. DHTML allows the page author to ___ in their document, independently moving each element from any starting
point to any ending point.
Ans: Animate text and image
27. ___ is a formal specification for arranging and styling items in web pages.
Ans: CSS
28. Variations in web browser implementations, such as ___ and Worldwide Web, made consistent site appearance
difficult.
Ans: ViolaWWW
31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest
35. Like HTML, XML elements can contain other XML element. (True/False)
Ans: True
36. In the ___ method a node list containing all of a node's child nodes.
Ans: ChildNodes()
37. ___ method takes a single parameter: the node to insert, and inserts that node after the last child node.
Ans: AppendChild()
38. ___ method takes two parameters: the attribute name and value. If the attribute already exists, it replaces it with
the new value. If it doesn't exist, it creates it.
Ans: SetAttribute()
39. The process of fetching data from an XML files to be filled in an HTML table, using ___ and ___.
Ans: DSO and Javascript
41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()
44. PHP scripts are always enclosed in between ___ PHP tags.
Ans: Two
45. We must save our PHP file with a___ extension, instead of the standard .html extension.
Ans: .PHP
46. In a ___ array, each element in the main array can also be an array.
Ans: Multidimensional
47. PHP variables must start with a letter or underscore "_". (true/false)
Ans: True
48. The ___ function is used to collect values from a form sent with method="post".
Ans: POST
49. The ___ function is used to collect values from a form sent with method="get".
Ans: GET
52. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
53. ___ function which will change the value of our second field.
Ans: setOutput()
55. Database allows web applications to store information in a systematic way, and retrieve that information later
through the use of the structured query. (True/False)
Ans: True
56. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest
57. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
58. ___ function which will change the value of our second field.
Ans: SetOutput()
59. Ajax, PHP, and Database make a great combination for producing Web-based eCommerce applications.
(True/false)
Ans: True
60. ___ is used to request the interface for Update or Insert of the records.
Ans: AjaxFunctionUpdateInseart()
63. If a second call is made to mysql_connect() with the same arguments, no new connection will be established.
(True/false)
Ans: True
64. MySQL supports over ___ making it ideal for the education industry in which a wide variety of platforms are
used.
Ans: 20 platforms
65. MySQL works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA etc.
(True/false)
Ans: True
66. MySQL supports large databases, up to 50 million rows or more in a table. The default file size limit for a table
is___.
Ans: 4 GB
67. ASP stands for___
Ans: Active Server Page
68. ASP is Web pages that contain server-side scripts in addition to the usual mixture of text and HTML
tags.(True/false)
Ans: server-side script
69. ___ variables are used to store information about ALL users in one specific application.
Ans: Application
71. In ASP we declare a variable with the use of the ___ keyword.
Ans: DIM
72. If the ASP appears on the page or the ___, something has gone wrong.
Ans: Source of the page
73. The ___ checks if a condition is true before each time that the code inside the loop is repeated.
Ans: While loop
74. In ___ condition is tested at the bottom instead of at the top of the loop.
Ans: Do loop
75. Response object is used to send information to the user i.e. to the browser. (true/false)
Ans: true
HOME Interview Questions MCQs *LAB VIVA CLASS NOTES SEMINAR TOPICS
ONLINE TEST GATE CAT Internship ABOUT US Privacy Policy
1 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
2 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
3 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
<html>
<head> <title>JavaScript</title> </head>
<body bgcolor=”#0000ff”>
<script language=”JavaScript”>
4 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
(a) The body of the web page will not contain any text
(b) The body of the web page will contain the text “<h1> hello
world </h1>”
(c) The body of the web page will contain the text “hello world” as
an H1 heading
(d) The background color of the web page will be green
(e) document.write(“<h1> hello world </h1 >”); is a comment.
<html>
<head><title>JavaScript</title></head>
5 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
<body>
<script language=”JavaScript”>
var a=80
var b=(a==80 ? “pass” :”fail”);
document.write(b)
</script>
</body>
</html>
(a) pass
(b) fail
(c) null
(d) 80
(e) Error at line 6.
<html>
<head><title>JavaScript question</title></head>
<body>
<script language=”JavaScript”>
book = new Array(1,2,3,4,5,6,7,8);
document.write(book[1]);
book[10]=10;
document.write(book[10]);
</script>
</body>
6 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
</html>
Once the above web page is loaded what will its body
contain?
(a) 210
(b) 110
(c) 110
(d) 210
(e) Error at line 7.
<html>
<head><title>JavaScript</title></head>
<body>
<script language=”JavaScript”>
document.write((125/5)%12);
</script>
</body>
</html>
7 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
(a) 0
(b) 1
(c) 2.083
(d) 3
(e) 25%12.
(a) Display()
(b) Prompt()
(c) Alert()
(d) GetInput()
(e) Confirm().
8 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
(a) IsNumeric()
(b) IsNumber()
(c) IsNotNumeric()
(d) IsNotNumber()
(e) IsNumberOrNot().
(a) Java, JavaScript, Jscript and VBScript are used on many web
sites as Scripting languages
(b) Client side scripts are executed on the server and the resulting
page will be downloaded and interpreted by the browser
(c) Client-side scripts increase the network traffic on execution of
the script
(d) Client-side scripts can perform many functions such
as data validation and provide interactive feedback to
the user
(e) Browsers need plug-ins to execute client-side scripts.
(a) green
(b) blue
(c) black
9 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
(d) red
(e) White.
20. Which property does one use to align text to the right
side of a block-level element in Cascading Style Sheets?
(a) horizontal-align
(b) align
(c) block-align
(d) justify
(e) text-align.
(a) setLayout()
(b) Layout()
(c) setContainerLayout()
(d) ContainerLayout()
(e) setConLayout().
(a) setSize()
(b) setBounds()
(c) setPosition()
10 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
(d) setPositionSize()
(e) setSizePosition().
(a) getCanvas()
(b) getGraphics()
(c) paint()
(d) getPaint()
11 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
(e) accessGraphics().
(a) getDate()
(b) Date()
(c) Now()
(d) getCurrentDate()
(e) CurrentDate().
(a) FormatDateOrTime()
(b) FormatDateAndTime()
(c) FormatTimeDate()
(d) FormatDateTime()
(e) FormatDT()
D. none of these
Answer:
A.document object model
12 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C. nevigator
D. live wire
Answer:
D.live wire
B. 2
C. 3
D. 4
Answer:
A.1
B. false
C. both a and b
D. none of these ..
Answer:
A.true
13 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. html
C. href
D. none of these
Answer:
A.bandwidth
B. rgba
C. hsla
D. all of these
Answer:
D.all of these
B. 3
C. 120
D. 7
Answer:
A.140
14 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. br
C. <pre>
D. <marquee>
Answer:
A. <p>
B. <br>
C. <pre>
D. <marquee>
Answer:
B.<br>
B. br
C. <pre>
D. <marquee>
Answer:
C.<pre>
15 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. <br>
C. <pre>
D. <marquee>
Answer:
D.<marquee>
B. br
C. <pre>
D. <marquee>
Answer:
D.<marquee>
B. br
C. <pre>
D. <marquee>
Answer:
A.<ol>
16 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. br
C. <pre>
D. <marquee>
Answer:
A.<ul>
B. br
C. <pre>
D. <marquee>
Answer:
A.<!—->
B. br
C. <pre>
D. <marquee>
Answer:
A.<i>
17 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
A. <big>
B. br
C. <pre>
D. <marquee>
Answer:
A.<big>
B. br
C. <pre>
D. <marquee>
Answer:
A.<def>
B. br
C. <pre>
D. <marquee>
Answer:
A.<cite>
18 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. logical
C. center tag
D. a and b b both
Answer:
D.a and b b both
B. <center>
C. <pre>
D. <marquee>
Answer:
B.<center>
B. false
C. both a and b
D. none of these.
Answer:
19 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
A.true
B. <center>
C. cell spacing
D. <marquee>
Answer:
C.cell spacing
B. <center>
C. cell spacing
D. <marquee>
Answer:
A.border
B. <th>
C. <frameset>
20 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
D. <a>
Answer:
A.<tr>
B. <th>
C. <frameset>
D. <a>
Answer:
B.<th>
56. To make a cell span more than one column, it is called use the
_______attribute
A. <tr>
B. colspan
C. <frameset>
D. rowspan
Answer:
B.colspan
57. To make a cell span more than one row, it is called use the
_______ attribute.
A. <tr>
B. colspan
21 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C. <frameset>
D. rowspan
Answer:
D.rowspan
B. colspan
C. <frame>
D. rowspan
Answer:
C.<frame>
B. columun
C. frame
D. rowspan
Answer:
C.frame
B. colspan
22 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C. <frameset>
D. rowspan
Answer:
C.<frameset>
B. ftp
C. physical
D. hyperlink
Answer:
A.tcp/ip
B. ftp
C. physical
D. hyperlink
Answer:
A.tcp/ip
23 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. ftp
C. physical
D. hyperlink
Answer:
B.ftp
B. ftp
C. physical
D. hyperlink
Answer:
A.<head>
B. <body>
C. physical
D. hyperlink
Answer:
B.<body>
24 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. ftp
C. physical
D. hyperlink
Answer:
C.physical
67. The LINKS starts at the ((Source)) anchor and points to the
((Destination)) anchor. TheseLINKIS are called as ___________
A. <head>
B. <body>
C. physical
D. hyperlink
Answer:
D.hyperlink
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<a>
25 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. checkbox
C. <textarea>
D. <text>
Answer:
B.checkbox
70. _________it is used to give the show the input box with
multiple rows and column.
A. <a>
B. checkbox
C. <textarea>
D. <text>
Answer:
C.<textarea>
B. checkbox
C. <textarea>
D. <text>
Answer:
D.<text>
26 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<submit>
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<password>
B. float
C. double
D. long
Answer:
27 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C.double
75. Which of these coding types is used for data type characters in
Java?
A. ascii
B. iso-latin-1
C. unicode
Answer:
C.unicode
B. 0 & 1
D. true
Answer:
A.true & false
B. 2
C. 3
D. 4
28 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
A.1
78. Which right shift operator preserves the sign of the value?
A. <<
B. >>
C. <<=
D. >>=
Answer:
B.>>
B. boolean
C. characters
D. double
Answer:
B.boolean
C. boolean
Answer:
29 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C.boolean
B. return
C. exit
D. continue
Answer:
D.continue
B. if-else
C. switch
D. do-while
Answer:
D.do-while
B. break
C. continue
D. return
Answer:
30 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
A.exit()
B. alloc
C. new
D. new malloc
Answer:
C.new
Answer:
D.int x[] = int [5] new
B. switch
C. if & switch
Answer:
31 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
A.if
B. customize
C. class
D. id rule
Answer:
A.background
B. customize
C. class
D. id rule
Answer:
B.customize
B. customize
C. class
D. id rule
32 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
D.id rule
B. customize
C. class
D. id rule
Answer:
C.class
B. selector
C. declaration
D. text color
Answer:
A.property name
B. selector
C. declaration
D. text color
Answer:
33 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B.selector
B. selector
C. declaration
D. text color
Answer:
C.declaration
94. Reset (button) :- it is used to reset the button ( cancel the data)
to upload
A. <reset>
B. checkbox
C. <textarea>
D. <text>
Answer:
A.<reset>
B. html
C. <textarea>
D. <text>
34 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
A.css
B. serve
C. cache
D. client
Answer:
B.serve
B. server
C. empty
D. head tag
Answer:
A.web browser
B. server
C. empty
D. head tag
Answer:
35 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C.empty
99. The HTML tag to left align the content inside a table cell is <td
align = “left”>.
A. true
B. false
C. both a and b
D. none of these
Answer:
A.true
B. server
C. empty
D. head tag
Answer:
D.head tag
101. Tags and text that are not directly displayed on the page are
written in___________section.
A. web browser
B. title
C. empty
D. head
36 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
D.head
102. Some tags enclose the text. Those tags are known as
___________
A. single tag
B. paired tag
C. empty
D. head
Answer:
A.single tag
B. paired tag
C. strikeout
D. head
Answer:
C.strikeout
B. paired tag
C. strikeout
D. deleted
37 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
D.deleted
B. paired tag
C. strikeout
D. deleted
Answer:
A.title tag
Function and String in PHP
B. -32768 to 32767
C. -2147483648 to 2147483647
Answer:
B.-32768 to 32767
B. -32768 to 32767
C. -2147483648 to 2147483647
38 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
A.-128 to 127
B. long
C. byte
D. float
Answer:
A.int
109. What is the numerical range of a char data type in Java script?
A. -128 to 127
B. 0 to 256
C. 0 to 32767
D. 0 to 65535
Answer:
D.0 to 65535
110. Which of these coding types is used for data type characters in
Java script?
A. ascii
B. iso-latin-1
C. unicode
39 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
C.unicode
B. boolean b2 = ‘false’;
C. boolean b3 = false;
D. boolean b4 = ‘true’
Answer:
C.boolean b3 = false;
B. alloc
C. new
D. new malloc
Answer:
C.new
40 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
D.intarr[] = int [5] new
B. column
Answer:
A.row
B. boolean
C. characters
Answer:
D.both numeric & characters
41 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
C.both integers and floating – point numbers
B. <<<
C. >>>
D. ^
Answer:
A.~
118. On applying Left shift operator, <<, on integer bits are lost
one they areshifted past which position bit?
A. 1
B. 32
C. 33
D. 31
Answer:
D.31
C. &
42 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
D. &&
Answer:
D.&&
B. ++
C. *
D. >>
Answer:
A.()
Answer:
D.addition operator, +, and subtraction operator have equal
precedence
B. switch
43 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C. if & switch
Answer:
B.switch
B. for()
C. continue
D. break
Answer:
A.if()
B. goto
C. continue
D. return
Answer:
D.return
B. bandwidth
44 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C. webpage
D. dream viewer
Answer:
B.bandwidth
B. bandwidth
C. webpage
D. dream viewer
Answer:
C.webpage
B. bandwidth
C. webpage
D. dream viewer
Answer:
A.http
128. Cost of buying and running a server for client serve model are
high .
45 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
A. true
B. false
C. both a & b
D. none of these
Answer:
A.true
129. Following are the types of CSS , which one is not type of CSS.
A. inline css:
C. external css:
D. none of these.
Answer:
D.none of these.
B. <span>
C. <img>
D. <tt>
Answer:
B.<span>
46 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. <span>
C. <img>
D. <tt>
Answer:
A.<map>
B. <span>
C. <img>
D. <tt>
Answer:
A.<map>
B. <div>
C. <img>
D. <tt>
Answer:
47 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B.<div>
B. <span>
C. <img>
D. <tt>
Answer:
D.<tt>
B. <em>
C. <u>
D. <strong >
Answer:
A.<small>
B. <em>
C. <u>
D. <strong >
48 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
Answer:
C.<u>
B. <em>
C. <u>
D. <strong >
Answer:
B.<em>
B. <em>
C. <u>
D. <strong >
Answer:
D.<strong >
139. _________tag Used to offset text that the user should enter.
Often displayed in aCourier font or a similar font that allots the
same width to each character.
A. <small>
B. <em>
C. <kbd >
49 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
D. <strong >
Answer:
C.<kbd >
B. <em>
C. <kbd >
D. <strong >
Answer:
A.<var>
B. <cite>
C. <kbd >
D. <strong >
Answer:
B.<cite>
B. <tr>
50 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C. <kbd >
D. <strong >
Answer:
B.<tr>
B. <tr>
C. <td >
D. <th >
Answer:
A.<table>
D. none of these
Answer:
A.cascading style sheets
B. bandwidth
51 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C. navigation
D. dream viewer
Answer:
C.navigation
B. bandwidth
C. webpage
D. dream viewer
Answer:
D.dream viewer
B. java script
C. angular js
D. none of these
Answer:
A.php
52 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. java script
C. angular js
D. none of these
Answer:
A.php
B. java script c
C. angular js
D. none of these
Answer:
A.php
B. .js
C. .ajs
D. none of these
Answer:
A..php
53 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. java script
C. angular js
D. none of these
Answer:
A.echo
B. small
C. short
D. none of these
Answer:
A.wide
B. integer
Answer:
D.all of the above .
B. implicitly
54 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
C. both a and b
D. none of these
Answer:
A.explicitly
B. logical operators
C. string operators
Answer:
D.all of the above
B. ++
C. ==
D. ?
Answer:
A.=
55 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
B. if condition
C. foreach
D. while
Answer:
A.switch
B. for loop
C. foreach
Answer:
D.all the these.
B. procedure
C. block
D. loop
Answer:
A.function
56 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...
------>>[MOST IMPORTANT]<<------
57 of 60 03-08-2021, 19:25
5 THOUGHTS ON “300+ TOP WEB TECHNOLOGIES MCQS
AND ANSWERS”
REPLY
REPLY
REPLY
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
mcq Questions
Top 60 Web Technology mcq questions for sppu, mu, anna university and the other university
examinations are added. These WT (mcq) multiple choice questions are also helpful for the coding
interviews. We are planning to provide Web technology mcq pdf download for free. WT mcq pdf will be
available shortly. Until then you can keep studying the Web Technology mcq given below.
1 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
B : Cookies are binary files stored on the server computer and they are kept for various
information tracking purpose.
C : Cookies are binary files stored on the client computer and they are kept for data
storage purpose.
D : Cookies are implicit object in JSP
Advertisement
Show Answer
Cookies are text files stored on the client computer and they are kept for various
information tracking purpose.
Show Answer
2 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
D : never
Advertisement
Show Answer
yes
Show Answer
void jspInit()
Advertisement
3 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
2names
Advertisement
Show Answer
4 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Navigator
Show Answer
Apache tomcat
Q.no 8. If we don’t want to allow a floating div to the left side of an element, which
css property will we use ?
A : margin
B : clear
C : float
D : padding
Advertisement
Show Answer
clear
5 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
B : http
C : node-resource
D : static
Advertisement
Show Answer
node-static
Show Answer
HTTP
Q.no 11. A PHP script should start with ___ and end with ___:
A : < php >
B : < ? php ?>
C:<??>
D : < ?php ? >
Advertisement
6 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
Show Answer
ActionForward
Advertisement
7 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
Show Answer
semicolon
Show Answer
true
8 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Advertisement
Show Answer
Q.no 17. Which of the following layer in Web Service Protocol Stack is responsible
for encoding messages in a common XML format so that messages can be
understood at either end?
A : Service Transport
B : XML Messaging
C : Service Description
D : Service Discovery
Advertisement
9 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
XML Messaging
Q.no 18. Which of the following is not the scope of Variable in PHP?
A : local
B : global
C : static
D : extern
Show Answer
extern
Show Answer
JavaScript
10 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Advertisement
Show Answer
Q.no 21. Which JSP Action tags is used to include the content of another resource,
like jsp, html or servlet?
A : jsp:plugin
B : jsp:include
C : jsp:forward
D : jsp:useBean
Show Answer
jsp:include
Advertisement
11 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
Show Answer
Q.no 24. In XML which internet languages are markup languages for handheld
devices?
A : WAP
B : WML
C : RSS
D : Both A & B
Show Answer
Both A & B
12 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
Q.no 26. _____ JavaScript statements embedded in an HTML page can respond to
user events such as mouse-clicks, form input, and page navigation.
A : Client-side
B : Server-side
C : Local
D : Native
Advertisement
Show Answer
Client-side
Show Answer
13 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Jsp:import
Show Answer
Show Answer
Server-side
Show Answer
Show Answer
Q.no 32. Which of the following code is used to get names of the attributes in
servlet
A : response.getAttributeNames()
B : request.getAttributeNames()
C : Header.getAttributeNames()
D : None of the above.
14 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
request.getAttributeNames()
Show Answer
Both a and b
Q.no 34. What is the work of the form control elements in the HTML DOM?
A : User Interface elements
B : All the possible elements
C : Debugging elements
D : Collecting elements
Advertisement
Show Answer
Q.no 35. Which of the following type of variables have only two possible values
either true or false?
15 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
A : Integers
B : Doubles
C : booleans
D : Strings
Show Answer
booleans
Show Answer
Advertisement
16 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
element Selectors
Q.no 38. What should appear at the very end of your JavaScript?
The
B : The
Show Answer
The
Q.no 39. By applying an ___________ a style can be applied to just a single tag.
A : class rule
B : element rule
C : id rule
D : none of the mentioned
Show Answer
id rule
Show Answer
Q.no 41. Which attribute of JSP page directive defines the MIME type of the HTTP
response
A : Import
B : Extends
C : contentType
D : info
17 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Advertisement
Show Answer
contentType
Show Answer
Xpath
Q.no 43. What is the easy way add extra Functionality in CMS?
A : Using Plugins/Extensions
B : Downloading New Theme
C : By going to coding portion
D : Making your own theme
Show Answer
Using Plugins/Extensions
18 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
B : create myFunction()
C : new_function myFunction()
D : del myfunction()
Advertisement
Show Answer
function myFunction()
Show Answer
Show Answer
19 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Window
Q.no 47. Which of the following array represents an array with strings as index?
A : Numeric Array
B : Associative Array
C : Multidimentional Array
D : Normal Array
Show Answer
Associative Array
Advertisement
Show Answer
Q.no 49. Which of the following method can be used to read parameters names in
JSP?
A : request.getParameter()
20 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
B : response.getParameter()
C : request.getParameterNames()
D : response.getParameterNames()
Show Answer
request.getParameterNames()
Show Answer
javax.servlet.ServletConfig
Q.no 51. What is the correct syntax of the declaration which defines the XML
version?
A:
B:
C:
D : None of the above
Advertisement
Show Answer
Q.no 52. How Node based web servers are different from traditional web servers?
21 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
A : Node based server process request much faster than traditional server.
B : Node based server uses a single threaded model and can services much larger
number of requests than traditional server like Apache HTTP Server.
C : There is no much difference between the two.
D : data based server
Show Answer
Node based server uses a single threaded model and can services much larger number of
requests than traditional server like Apache HTTP Server.
Show Answer
Website
Show Answer
MySQL
Q.no 55. Elements from the HTML namespace are displayed as they would in
…………………..
A : DHTML
B : XML
C : HTML
D : DXML
Advertisement
22 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
HTML
Q.no 56. To add the attribute named Type to the tag the syntax will be
A:
B:
C:
D:
Show Answer
Show Answer
Q.no 58. Which one of the following lines need to be uncommented or added in
the php.ini file so as to enable mysqli extension?
A : extension=php_mysqli.dll
B : extension=mysql.dll
C : extension=php_mysqli.dl
D : extension=mysqli.dl
23 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Show Answer
extension=php_mysqli.dll
Show Answer
$()
Advertisement
Show Answer
24 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Leave a Comment
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.
Post Comment »
Popular Posts
25 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
MCQ)
May 1, 2021
Digital Electronics and Logic Read more
26 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
Categories
Artificial Intelligence
Civil Engineering
Computer Engineering
Computer Graphics
Computer Network
Cyber Security
Data Analytics
DBMS
Digital Electronics
Discrete Math
EEE
Electrical Engineeing
Engineering Metallurgy
ETL
First Year
ISEE
Machine Learning
Mechanical Engineering
SEPM
Soft Computing
Software Testing
Thermodynamics
TOC
unix
27 of 28 03-08-2021, 19:32
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/
28 of 28 03-08-2021, 19:32
Web Technologies - MCQs
1. The ___ receives a stream of tokens from the parser and sorts them according to function.
Ans: Event switcher
4. SAX and DOM are very different Where SAX models the parser, DOM models the XML ___.
Ans: Document
5. The main purpose of ___ is to add interactivity to the browser and Web pages.
Ans: JavaScript
10. ___ is an API that can be used by web scripting languages like JavaScript, VBScript, etc.
Ans: HTTP requests
11. HTTP requests provide a mechanism for transferring the data either in text or XML format between the web client
and the webserver. (True/False)
Ans: True
13. XMLHttpRequest object property ___ is used to returns a reference to the constructor of an object.
Ans: Constructor
14. XMLHttpRequest object method abort is used to cancels the current HTTP request. (True/False)
Ans: True
15. ___ is used to sets or retrieves the event handler for asynchronous requests.
Ans: Onreadystatechange
16. The argument in send method is ignored if the request method is ___.
Ans: GET or HEAD.
19. The ___ attribute is used to return the text response entity-body.
Ans: responseText
22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True
24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True
26. DHTML allows the page author to ___ in their document, independently moving each element from any starting
point to any ending point.
Ans: Animate text and image
27. ___ is a formal specification for arranging and styling items in web pages.
Ans: CSS
28. Variations in web browser implementations, such as ___ and Worldwide Web, made consistent site appearance
difficult.
Ans: ViolaWWW
31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest
35. Like HTML, XML elements can contain other XML element. (True/False)
Ans: True
36. In the ___ method a node list containing all of a node's child nodes.
Ans: ChildNodes()
37. ___ method takes a single parameter: the node to insert, and inserts that node after the last child node.
Ans: AppendChild()
38. ___ method takes two parameters: the attribute name and value. If the attribute already exists, it replaces it with
the new value. If it doesn't exist, it creates it.
Ans: SetAttribute()
39. The process of fetching data from an XML files to be filled in an HTML table, using ___ and ___.
Ans: DSO and Javascript
41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()
44. PHP scripts are always enclosed in between ___ PHP tags.
Ans: Two
45. We must save our PHP file with a___ extension, instead of the standard .html extension.
Ans: .PHP
46. In a ___ array, each element in the main array can also be an array.
Ans: Multidimensional
47. PHP variables must start with a letter or underscore "_". (true/false)
Ans: True
48. The ___ function is used to collect values from a form sent with method="post".
Ans: POST
49. The ___ function is used to collect values from a form sent with method="get".
Ans: GET
52. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
53. ___ function which will change the value of our second field.
Ans: setOutput()
55. Database allows web applications to store information in a systematic way, and retrieve that information later
through the use of the structured query. (True/False)
Ans: True
56. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest
57. PHP has similarities with the JavaScript language used to control ___ in functionality, code layout, and ideology.
Ans: AJAX
58. ___ function which will change the value of our second field.
Ans: SetOutput()
59. Ajax, PHP, and Database make a great combination for producing Web-based eCommerce applications.
(True/false)
Ans: True
60. ___ is used to request the interface for Update or Insert of the records.
Ans: AjaxFunctionUpdateInseart()
63. If a second call is made to mysql_connect() with the same arguments, no new connection will be established.
(True/false)
Ans: True
64. MySQL supports over ___ making it ideal for the education industry in which a wide variety of platforms are
used.
Ans: 20 platforms
65. MySQL works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA etc.
(True/false)
Ans: True
66. MySQL supports large databases, up to 50 million rows or more in a table. The default file size limit for a table
is___.
Ans: 4 GB
67. ASP stands for___
Ans: Active Server Page
68. ASP is Web pages that contain server-side scripts in addition to the usual mixture of text and HTML
tags.(True/false)
Ans: server-side script
69. ___ variables are used to store information about ALL users in one specific application.
Ans: Application
71. In ASP we declare a variable with the use of the ___ keyword.
Ans: DIM
72. If the ASP appears on the page or the ___, something has gone wrong.
Ans: Source of the page
73. The ___ checks if a condition is true before each time that the code inside the loop is repeated.
Ans: While loop
74. In ___ condition is tested at the bottom instead of at the top of the loop.
Ans: Do loop
75. Response object is used to send information to the user i.e. to the browser. (true/false)
Ans: true
http://freepdf-books.com
Web Technologies Solved
MCQ - Part 2
Well formed XML document means
_________________________________________________________
Which tags are commonly used by search engines?
Headings
Title
Paragraph
All of these
_________________________________________________________
XPATH used to
_________________________________________________________
DMSP stands for
http://freepdf-books.com
Distributed Message System Pool
Distributed Mail System Pool
_________________________________________________________
Address 192.5.48.3 belongs to
Class A
Class B
Class C
Class D
_________________________________________________________
_________________________________________________________
XML is a
Imperative language
Declarative language
Standard
None of these
_________________________________________________________
DOM is a
A parser
Specification
Coding style
None of these
http://freepdf-books.com
_________________________________________________________
A header in CGI script can specify
_________________________________________________________
The ______ is a set of standards that defines how a dynamic web
document should be written, how input data should be supplied to
the program, and how the output result should be used.
_________________________________________________________
XML uses the features of
HTML
XHTML
VML
SGML
_________________________________________________________
Repository of information gathered from multiple sources, storing
under unified scheme at a single site is called as
Data mining
Meta data
Data warehousing
Database
_________________________________________________________
http://freepdf-books.com
Which of the following identifies a specific web page and its
computer on the Web?
Web site
Web site address
URL
Domain Name
_________________________________________________________
DTD definition is used along with XML to specify
_________________________________________________________
What is XML?
_________________________________________________________
Internet data is broken up as
_________________________________________________________
The main function of a browser is to
http://freepdf-books.com
Compile HTML
Interpret HTML
De-compile HTML
Interpret CGI programs
_________________________________________________________
IP addresses are converted to
a binary string
alphanumeric string
a hierarchy of domain names
a hexadecimal string
_________________________________________________________
How many root element can an XML document have ?
One
Two
Three
As many as the memory provides
_________________________________________________________
The task of correcting and pre processing data is called as
Data streaming
Data cleaning
Data mining
Data storming
_________________________________________________________
The most popular way to materialize XML document is to use
DTD
XSLT
http://freepdf-books.com
HTML
SOAP
_________________________________________________________
The packets of an internet message
_________________________________________________________
Characteristic encoding is
_________________________________________________________
www is based on which model?
Local server
Client server
3 tier
None of these
_________________________________________________________
Attributes in XML are
Elements inXML
Child nodes
A way of attaching characteristics or properties to elements of a
document
None of these
http://freepdf-books.com
_________________________________________________________
i, ii
i, ii, iii
i, ii, iv
ii, iii and iv
_________________________________________________________
The tags in XML are
Case insensitive
Case sensitive
Browser dependent
None of these
_________________________________________________________
i, ii, iii
ii, iii, iv
i, iii
http://freepdf-books.com
ii, iii, iv, v
_________________________________________________________
XLL definition is used along with XML to specify
_________________________________________________________
Which of them take care of e mail at client side?
POP
MAP
IMAP
Both a and c
_________________________________________________________
Node in XML is
_________________________________________________________
The tracing model in Prolog describes program execution in terms of
certain events. These events are
http://freepdf-books.com
_________________________________________________________
Which Layer is not present in TCP/ IP model?
Application Layer
Internet Layer
Transport Layer
Presentation Layer
_________________________________________________________
Which of the following statement is true?
_________________________________________________________
Where are cookies stored?
On the server
Inweb.xml
On the client
In HTML
_________________________________________________________
Each list item in an ordered or unordered list has which tag?
List tag
Is tag
Li tag
Ol tag
_________________________________________________________
XML
http://freepdf-books.com
Can be used as a database
Cannot be used as a database
XML is not a database ,it is language
None of these
_________________________________________________________
(i)Encryption
(ii)HTTP
(iii)HTML
(iv)Firewalls
i and ii
ii and iii
iii and iv
i and iv
_________________________________________________________
(i)source address
(ii) destination address
(iii)serial number of packets
(iv)message bytes
(v)Control bits for error checking
(vi) Path identification bits
i, ii, iii
i, ii, iii, iv
i, ii, iii, iv, v
i, ii, iii, iv, v, vi
_________________________________________________________
http://freepdf-books.com
HTML (Hyper Text Markup Language) has language elements which
permit certain actions other than describing the structure of the web
document. Which one of the following actions is NOT supported by
pure HTML (without any server or client side scripting) pages?
Embed web objects from different sites into the same page
Refresh the page automatically after a specified interval
Automatically redirect to another page upon download
Display the client time as part of the page
_________________________________________________________
CIDR stands for
_________________________________________________________
The XML DOM object is
Entity
Entity reference
Comment reference
Comment data
_________________________________________________________
Which of the following tags below are used for multi line text input
control?
Textml tag
Text tag
Textarea tag
Both a and b
_________________________________________________________
http://freepdf-books.com
By an extranet we mean
_________________________________________________________
In HTML URI is used to
_________________________________________________________
i, ii, iii
i, ii, iii, iv
i, ii, iii, iv, v
i, ii, iii, v
_________________________________________________________
The term byte stuf fing refers to
http://freepdf-books.com
Data stuffing used with both A and B
Data stuffing used wi th byte oriented hardware
_________________________________________________________
Which type of web document is run at the client site
Static
Dynamic
Active
All of the above
_________________________________________________________
The web standard allows programmers on many different computer
platforms to dispersed format and display the information
server.These programs are called
Web browsers
HTML
Internet Explorer
None of these
_________________________________________________________
XML document can be viewed in
IE 3.0
IE 2.0
IE 6.0
IE X.0
http://freepdf-books.com