0% found this document useful (0 votes)
12 views1,884 pages

Complete WT

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 1884

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 2 Develop Java programs for window/web-based applications

CO 3 Design web pages using HTML, XML, CSS and JavaScript.

CO 4 Creation of client-server environment using socket programming

CO 5 Building enterprise level applications and manipulate web databases using JDBC

CO 6 Design interactive web applications using Servlets and JSP


DETAILED SYLLABUS

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

Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans


Properties, Types of beans, Stateful Session bean, Stateless Session bean, Entity bean Java
IV Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating,
Databases with JDBC, Prepared Statements, Transaction Processing, Stored Procedures

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

1. Unit-I : Introduction ………………………...………………………………….….3

2. Unit-II : Web Page Designing ………………………………….…………...…….23

3. Unit-III : Scripting & Introduction to Networking …………………..….....…... 31

4. Unit-IV: Enterprise Java Bean & Database Connectivity (JDBC): ………..….45

5. Unit-V: Servlets & Java Server Pages (JSP)………………….....................…….52

2 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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

Q4. Which is valid about java.lang.Exceptions?


A.The class Exception and all its subclasses that are not also subclasses of
RuntimeException arechecked exceptions
B.The class Error and all its subclasses are unchecked exceptions
C.The class RuntimeException and all its subclasses are unchecked exceptions
D.All
Ans D

Q5. What is disadvantage/invalid about try-with-resource


A. introduced in java 7
B. we need not to write explicit code for closing file
C. Using multiple resources inside Try-with-resources is also allowed
d. None
Ans D

Q6. FileInputStream implements which interface for closing file automatically


in java7?
A. java.lang.AutoClose
B. java.lang.CloseAutomatically
C. java.lang.AutoCloseable
D. java.lang.Closeable
Ans C
Q7. Web page editors works on a ____ principle.
(A) WWW
(B) HTML
(C) WYSIWYG
(D) WYGWYSI
Ans: C

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

Q10. How many colour names are used by the browsers?


(A) 8
(B) 10
(C) 12
(D) 16
Ans: D

Q11. What is the abbreviation of HTTP?


(A) Hypertext tag path
(B) Hyper Text Transfer Protocol
(C) Hypertext transfer path
(D) None
Ans: B

Q12. The entire web document is contained within ____


(A) Comments
(B) Tags
(C) Web page
(D) HTML element
Ans: D

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

Q17. Which of these events is generated when a button is pressed?


A. WindowEvent
B. ActionEvent
C. WindowEvent
D. KeyEvent
Ans: B

Q18. Which of these events is generated when a button is pressed?


A. WindowEvent
B. ActionEvent
C. WindowEvent
D. KeyEvent
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

Q20. Package of drawstring() method is in?


A. java.applet
B. java.io
C. java.awt
D. javax.swing
Ans: C
Q21. Predict the output of following Java program
class Main {
public static void main(String args[]) {
try {
throw 10;
}
catch(int e) {
System.out.println("Got the Exception " + e);
}
}
}
A. Got the Exception 10
B. Got the Exception 0
C. Compiler Error
Answer: (C)

Q22. Predict the output of following Java program

class Base extends Exception {}


class Derived extends Base {}
public class Main {
public static void main(String args[]) {
// some other stuff
try {
// Some monitored code
throw new Derived();
}
catch(Base b) {
System.out.println("Caught base class exception");
}
catch(Derived d) {
System.out.println("Caught derived class exception");
}
}
}

(A) Caught base class exception


(B) Caught derived class exception
(C) Compiler Error because derived is not throwable
(D) Compiler Error because base class exception is caught before derived class
Answer: (D)

Q23. What block is always executed, independently of an exception being raised?


A. throws
B. finally
C. catch
D. throw
Ans D
Q24. Exception and Error are direct subclasses of?
A. BaseException
B. Throwable
C. Object
D. RuntimeException
Ans B

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

Q27. Which of these are java.lang.Error in exception handling in java


A. VirtualMachineError
B. IOError
C. AssertionError
D. ThreadDeath
E. All
Ans E

Q28. What is invalid statements for automatic resource management in java?


A. Allows us to catch more than one exception in one catch block
B. We could separate different exceptions using pipe ( | )
C. Increases developer efforts of writing multiple catch blocks.
D. None
Ans C

Q29. Which of these functions is called to display the output of an applet?


a) display()
b) paint()
c) displayApplet()
d) PrintApplet()
Answer: b

Q30. In Servlet Terminology what provides runtime environment for JavaEE (j2ee)
applications. It performs many operations that are given below:

1. Life Cycle Management


2. Multithreaded support
3. Object Pooling
4. Security etc.
A. Server
B. Webserver
C. Container
D. Application Server
Answer: C. Container

Q31. The following example shows the creation of a


import java.applet.*;
import java.awt.*;

public class Main extends Applet{


public void paint(Graphics g){
g.drawString("Welcome in Java Applet.",40,20);
}
}

A. Banner using Applet


B. Basic Applet
C. Display clock
D. None of the above
ANSWER: B. Basic Applet

Q32. From the following statements which is a drawback for Applet?


A. It works at client side so less response time
B. Secured
C. It can be executed by browsers running under many platforms, including Linux, Windows, and
Mac Os etc.
D. Plugin is required at client browser to execute applet
ANSWER: D. Plugin is required at client browser to execute applet

Q33. Applets cannot make network connection exception to the server host from which it
originated.
a. True
b. False
ANSWER: True

Q34. What will be output for the following code?


import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
public void paint(Graphics g)
{
g.drawString(""A Simple Applet"", 20, 20);
}
}
A. A Simple Applet
B. A Simple Applet 20 20
C. Compilation Error
D. Runtime Error
Ans : A
Q35. What is internet?
a) a single network
b) a vast collection of different networks
c) interconnection of local area networks
d) interconnection of wide area networks
Answer: b

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

Q37. ISP exchanges internet traffic between their networks by __________


a) internet exchange point
b) subscriber end point
c) isp end point
d) internet end point
Answer: a

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

Q42. Internet addresses must always have at least


(i) a country name or organization type
(ii) internet service provider’s name
(iii) name of organization
(iv) name of individual
(v) type of organization
a. i, ii, iii
b. ii, iii, iv
c. i, iii
d. ii, iii, iv, v
Ans: c

Q43. Internet packet data structure consists of


(i)source address
(ii) destination address
(iii)serial number of packets
(iv)message bytes
(v)Control bits for error checking
(vi) Path identification bits
a. i, ii, iii
b. i, ii, iii, iv
c. i, ii, iii, iv, v
d. i, ii, iii, iv, v, vi
Ans: c

Q44. Among services available on the World Wide Web are


(i)Encryption
(ii)HTTP
(iii)HTML
(iv)Firewalls
a. i and ii
b. ii and iii
c. iii and iv
d. i and iv
Ans: b
Q45. A URL specifies the following:
(i) protocol used
(ii) domain name of server hosting web page
(iii) name of folder with required information
(iv) name of document formatted using HTML
(v) the name of ISP
a. i, ii, iii, iv
b. ii, iii, iv, v
c. i, iii, iv
d. i, ii, iii, v
Ans: a

Q46. Desirable properties of a website are


(i)a meaningful address
(ii)Help and search facilities
(iii) Links to related sites
(iv)Features to allow users to give feedback
(v)Hosting on a mainframe
a. i, ii, iii
b. i, ii, iii, iv
c. i, ii, iii, iv, v
d. i, ii, iii, v
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

Q48. What will be the output of the following Java code?


class multithreaded_programing
{
public static void main(String args[])
{
Thread t = Thread.currentThread();
System.out.println(t);
}
}
a) Thread[5,main]
b) Thread[main,5]
c) Thread[main,0]
d) Thread[main,5,main]
Answer: d
Q49. What is the priority 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) 4
b) 5
c) 0
d) 1
Answer: b

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

Q3. URL is an acronym for


A. Universal Resource Locator
B. Universal Research locator
C. Uniform Resource Locator
D. None of the above
Ans: C. Uniform Resource Locator

Q4. The purpose of Markup is to …


A. Add hypertext capabilities
B. Enhance the document
C. Both A and B
D. None of the above
Ans: C. Both A and B

Q5. GIF and PNG files use an……….. format.


A. Interlacing
B. Progressive
C. Regressive
D. Clear View
Ans: A. Interlacing

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>

Q8. …… are used to visually displays to navigate to different pages.


A. Image maps
B. Hyper pages
C. Different slides
D. Animated pages
Ans: A. Image maps

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

Q10. For obtaining ordered list use the tag


A. <H1>
B. <UL>
C. <OL>
D. <ML>
Ans: C. <OL>

Q11. The …… tag defines a multi-line text input control.


A. <paragraph>
B. <multiline>
C. <textbox>
D. <textarea>
Ans: D. <textarea>

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

Q18. All information in XML is …………………


A) Unicode text
B) multi code
C) multi text
D) simple text
Ans: A) Unicode text

Q19. An entity in XML is a …………………………..


A) class
B) logical information
C) simple information
D) flexible information storage unit
Ans: D) flexible information storage unit

Q20. A tool for reading XML documents is popularly called a …………………


A) XML delimiters
B) XML processor
C) XML parser
D) Both b and c
Ans: D) Both b and c
Q21. XSL stands for
A) Extensible Style sheet Language
B) Extensible Style Language
C) Exclusive Stylesheet Language
D) Exclusive Style Language
Ans: A) Extensible Style sheet Language

Q22. XML tabs are ………………………..


A) case sensitive
B) case insnesitive
C) easy
D) deficult
Ans: A) case sensitive

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>

Q26. Which of the following tags are belongs to <Table> tag.


A. <table> <head><title>
B. <td><br>
C. <ol><ul>
D. <table><tr><td>
Ans: D. <table><tr><td>

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

Q42. ……………………. property defines the minimum number of lines in a paragraph to be


left at the top of a page.
A) widows
B) line-number
C) line-spacing
D) margins
Ans: A) widows

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

Q48. Choose The Correct HTML Tag To Make A Text Italic

A. &lt;italic>
B. &lt;it>
C. &lt;i>
D. &lt;il>
Ans: C

Q49. HTML Tags Are Surrounded By Which Type Of Brackets.

A. Curly
B. Round
C. Squart
D. Angle
Ans: D

Q50. Which of the following is the correct CSS syntax?


i) {p:color=green, font-size=15px
ii) {p:color=green, font-size=15px}
iii) p {color:green, font-size:15px;}
iv) p {color:green; font-size:15px;}
Ans: iii

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)

1. Which of the following is not JavaScript Data Types?

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

4. Which of the following is correct about features of JavaScript?

A. It can not Handling dates and time.


B. JavaScript is a object-based scripting language.
C. JavaScript is not interpreter based scripting language.
D. All of the above
Ans : B
5. Choose the correct JavaScript syntax to change the content of the
following HTML code.

A. document.getElement (“letsfindcourse").innerHTML = "I am a


letsfindcourse";
B. document.getElementById (“letsfindcourse").innerHTML = "I am a
letsfindcourse";
C. document.getId (“letsfindcourse") = "I am a letsfindcourse";
D. document.getElementById (“letsfindcourse").innerHTML = I am a
letsfindcourse;
Ans : B
6. Which of the following is the correct syntax to display "Letsfindcourse" in
an alert box using JavaScript?

A. alert-box("Letsfindcourse");
B. confirm("Letsfindcourse");
C. msgbox("Letsfindcourse");
D. alert("Letsfindcourse");
Ans : D

7. JavaScript is designed for following purpose -

A. to style HTML pages


B. to execute Queries related to databases on a server
C. to add interactivity to html pages
D. All of the above
Ans : D

8. What will be the output of the following Javascript code?


var string1 = "Letsfindcourse";
var intvalue = 30;
alert( string1 + intvalue );

A. Letsfindcourse 30
B. 30
C. Letsfindcourse30
D. Exception
Ans : C

9. What does javascript use instead of == and !=?

A. It uses bitwise checking


B. It uses === and !== instead
C. It uses equals() and notequals() instead
D. It uses equalto()
Ans : B

10. What are the types of Pop up boxes available in JavaScript?

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

12. What makes Ajax unique?


A. It works as a stand-alone Web-development tool.
B. It works the same with all Web browsers.
C. It uses C++ as its programming language.
D. It makes data requests asynchronously.
Ans: D

13. What does the XMLHttpRequest object accomplish inAjax?


A. It’s the programming language used to develop Ajax applications.
B. It provides a means of exchanging structured data between theWeb server and
client.
C. It provides the ability to asynchronously exchange data betweenWeb browsers
and a Web server.
D. It provides the ability to mark up and style the display of Web-pagetext.
Ans: C

14. Ajax is a programming language.


A. True
B. False
Ans: B

15. What combination of technologies gives AJAX its name?


A. ASP and XAML
B. Asynchronous JavaScript and XML
C. Autonomic Computing and DHTML
D. Atlas and XML
Ans: B

16. Which one of these technologies is NOT used in AJAX?


A. CSS
B. DOM
C. DHTML
D. Flash
Ans: D
17. What does the <noscript> tag do?
A. Enclose text to be displayed by non-JavaScript browsers.
B. Prevents scripts on the page from executing.
C. Describes certain low-budget movies.
D. None of the above
Ans: A

18. Why so JavaScript and Java have similar name?


A. JavaScript is a stripped-down version of Java
B. JavaScript’s syntax is loosely based on Java’s
C. They both originated on the island of Java
D. None of the above
Ans: B

19. JavaScript is also called client-side JavaScript.


A. Microsoft
B. Navigator
C. LiveWire
D. Native
Ans: B

20. Is it possible to use multiple


ScriptManager controls on aWeb page?
a. Yes
b. No
Ans: B

21. TCP,FTP,Telnet,SMTP,POP etc. are examples of ?


A) Socket
B) IP Address
C) Protocol
D) MAC Address
Ans: C

22. Which classes are used for connection-


oriented socket programming?
A) Socket
B) ServerSocket
C) Both A & B
D) None of the above
Ans: C
23. Which class can be used to create a server socket. This object is used
to establish communication with the clients?
A) ServerSocket
B) Socket
C) Both A & B
D) None of the above
Ans: A

24. Which methods are commonly used in ServerSocket class?


A) public OutputStream getOutputStream()
B) public Socket accept()
C) public synchronized void close()
D) None of the above
Ans: B

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

26. The java.net.InetAddress class represents an?


A) Socket
B) IP Address
C) Protocol
D) MAC Address
Ans: B

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

28. Which classes are used for connection-less socket programming?


A) DatagramSocket
B) DatagramPacket
C) Both A & B
D) None of the above
Ans: C
29. which method is used to establish the connection with the specified
url in a Driver Manager class?
A. public static void registerDriver(Driver driver)
B. public static void deregisterDriver(Driver driver)
C. public static Connection getConnection(String url)
D. public static Connection getConnection(String url,String userName,String
password)
Ans: C

30. Which of these methods is used to know host of an URL?


a) host()
b) getHost()
c) GetHost()
d) gethost
Ans: B

31. Which of these exceptions is thrown by URL class’s constructors?


a) URLNotFound
b) URLSourceNotFound
c) MalformedURLException
d) URLNotFoundException
Ans: C

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

33. What will be the output of the following Java code?

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

37. Datagram is basically an information but there is no guarantee of its


content, arrival or arrival time.
A) True
B) False
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

40. 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. getArray()

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

42. Which of the following is true about factory method?


a) A factory method is a non-constructor operation that creates and returns class
instances
b) Factory methods are widely used in mid-level design patterns and in object-
oriented programming in general
c) Factory methods create new instances using constructors or cloning, so they
do not rely on any special technique for class instantiation
d) All of the mentioned
Ans: D

43. When a generator assumes responsibility for product object creation in


a factory method,which of the following capabilities become available?
a) Access to product constructors can be restricted
b) Private data can be provided to new product objects
c) Product objects can be configured after creation
d) All of the mentioned
Ans: D
44. . Which class that can have only one instance?
a) Adaptor Class
b) Proxy Class
c) Singleton Class
d) Factory class
Ans: C

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

46. Which of the following truly describes the structure of Generator


pattern?
a) A generator pattern has a Client that needs an instance of a Product class
b) A Generator that creates or obtains access to such an instance on behalf of the
Client
c) All of the mentioned
d) None of the mentioned
Ans: C

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

48. Which type of JavaScript language is ___

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

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
ANSWER: True

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

5. Abbreviate the term JMS?


a. Java Message Service
b. Java Monitor Service
c. Java Message Session
d. Java Monitor Session
ANSWER: Java Message Service

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. Stateful Session Bean


b. Stateless Session Bean
c. Singleton Session Bean
d. None of the above
ANSWER: Singleton Session Bean

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?

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

16. Which middleware services are provided by EJB?


a. Security
b. Transaction Management
c. Both A & B
d. None of the above
ANSWER: Both A & B

17. Which server-side component is required to be deployed on the server?


a. EJB
b. RMI
c. Both A & B
d. None of the above
ANSWER: EJB

18. How many types of session beans are available in EJB?


a. 2
b. 3
c. 4
d. 5
ANSWER: 3

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. Stateful Session Bean


b. Stateless Session Bean
c. Singleton Session Bean
d. None of the above
ANSWER: Stateless Session Bean

21. How many types of session bean?

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)

22. Which of the following is not a property of EJB transaction?

(a) Atomicity
(b) Consistency
(c) Isolation
(d) Distributed
(e) Durability.
Ans : D

23. EJB is like COM, Abbreviate the term COM?

A. Component Object Model


B. Component Oriented Model
C. Common Object Model
D. Common Oriented Model
Ans : A

24. Which of the following is not true about Java beans?


a) Implements java.io.Serializable interface
b) Extends java.io.Serializable class
c) Provides no argument constructor
d) Provides setter and getter methods for its properties
Answer: b

25. Which of the following is not a feature of Beans?


a) Introspection
b) Events
c) Persistence
d) Serialization
Answer: d
26. Which attribute is used to specify initialization method?
a) init
b) init-method
c) initialization
d) initialization-method
Answer: b

27. What are the major components of the JDBC?


a) DriverManager, Driver, Connection, Statement, and ResultSet
b) DriverManager, Driver, Connection, and Statement
c) DriverManager, Statement, and ResultSet
d) DriverManager, Connection, Statement, and ResultSet
Answer: a

28. Select the packages in which JDBC classes are defined?


a) jdbc and javax.jdbc
b) rdb and javax.rdb
c) jdbc and java.jdbc.sql
d) sql and javax.sql
Answer: d

29. What is the correct sequence to create a database connection?


i. Import JDBC packages.
ii. Open a connection to the database.
iii. Load and register the JDBC driver.
iv. Execute the statement object and return a query resultset.
v. Create a statement object to perform a query.
vi. Close the resultset and statement objects.
vii. Process the resultset.
viii. Close the connection.
a) i, ii, iii, v, iv, vii, viii, vi
b) i, iii, ii, v, iv, vii, vi, viii
c) ii, i, iii, iv, viii, vii, v, vi
d) i, iii, ii, iv, v, vi, vii, viii
Answer: b

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

32. Which of the following is advantage of using JDBC connection pool?


a) Slow performance
b) Using more memory
c) Using less memory
d) Better performance
Answer: d

33. What does setAutoCommit(false) do?


a) commits transaction after each query
b) explicitly commits transaction
c) does not commit transaction automatically after each query
d) never commits transaction
Answer: c

34. Which of the following is used to rollback a JDBC transaction?


a) rollback()
b) rollforward()
c) deleteTransaction()
d) RemoveTransaction()
Answer: a

35. Which of the following is not a valid type of statement in JDBC?


A - Statement
B - PreparedStatement
C - CallableStatement
D - QueryStatement
Answer : D

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

39. Abbreviate the term UDA?

a. Unified Data Access


b. Universal Data Access
c. Universal Digital Access
d. Uniform Data Access

ANSWER: Universal Data Access

40. Which packages contain the JDBC classes?

a. java.jdbc and javax.jdbc


b. java.jdbc and java.jdbc.sql
c. java.sql and javax.sql
d. java.rdb and javax.
Ans: C

41. Which of these obtains a Connection?

A. Connection.getConnection(url)
B. Driver.getConnection(url)
C. DriverManager.getConnection(url)
D. new Connection(url)
Ans: C

42. Which is responsible for getting a connection to the database?

A. Driver
B. Connection
C. Statement
D. ResultSet
Ans: A
43. Which resources have their close() method called when this code runs?

public static void runQuery(Connection conn) throws SQLException {


try (Statement stmt = conn.createStatement()) {
ResultSet rs = stmt.executeQuery("select * from clowns");
rs.next();
}
}

A. No close() methods are called.


B. Only Statement
C. Only Statement and Connection
D. Only Statement and ResultSet
Ans: D

44. What is the correct order to close database resources?

A. Connection then Statement then ResultSet


B. ResultSet then Statement then Connection
C. Statement then Connection then ResultSet
D. Statement then ResultSet then Connection
Ans: B

45. How many JDBC driver types does Sun define?

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

47. Which JDBC driver Type(s) is(are) the JDBC-ODBC bridge?

A. Type 1
B. Type 2
C. Type 3
D. Type 4
Ans: A
48. JDBC stands for:

A. Java Database Connectivity


B. Java Database Components
C. Java Database Control
D. None of the above is correct.
Ans: A

49. Which of the following is method of JDBC batch process?

a. setBatch()
b. deleteBatch()
c. removeBatch()
d. addBatch()
Ans: D

50. Which of the following is not a JDBC connection isolation levels?

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?

A - The init() method is called when the servlet is first created.


B - The init() method is called whenever the servlet is invoked.
C - Both of the above.
D - None of the above.

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

4. The sendRedirect() method of HttpServletResponse interface can be used to redirect


response to another resource, it may be servlet, jsp or html file.
a. True
b. False
ANSWER: True

5. Which of these ways used to communicate from an applet to servlet?


a. RMI Communication
b. HTTP Communication
c. Socket Communication
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

8. What type of servlets use these methods doGet(), doPost(),doHead, doDelete(),


doTrace()?
a. Genereic Servlets
b. HttpServlets
c. All of the above
d. None of the above
ANSWER: HttpServlets

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

12. Servlets handle multiple simultaneous requests by using threads.


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

16. Which HTTP Request method is non-idempotent?


a. GET
b. POST
c. BOTH A & B
d. None of the above
ANSWER: POST

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

18. What is the lifecycle of a servlet?


a. Servlet class is loaded
b. Servlet instance is created
c. init,Service,destroy method is invoked
d. All mentioned above
ANSWER: All mentioned above

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

21. 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
22. 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

23. Which are the examples of Application Server?


a. Apache
b. Tomcat
c. JBoss
d. Weblogic
e. Both C & D
ANSWER: Both C & D

24. Which of the following code delete a cookie in servlet?


A - response.deleteCookie(cookie);
B - cookie.setMaxAge(0);
C - request.deleteCookie(cookie);
D - None of the above
Answer : B

25. Which of the following code is used to get locale in servlets?


A - request.getLocale()
B - Locale.getLocale()
C - response.getLocale()
D - None of the above.
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

27. Which of the following is not a jsp directive?


A. Include
B. Page
C. Scriptlet
D. useBean
Answer : D

28. Which of the following are the valid scopes in JSP?

A - request, page, session, application


B - request, page, session, global
C - response, page, session, application
D - request, page, context, application

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

33. Which tag is used to execute java source code in JSP?


a. Declaration Tag
b. Scriptlet tag
c. Expression tag
d. None of the above
ANSWER: Scriptlet tag

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

37. Which packages does a JSP API consist of?


a. javax.servlet.jsp
b. java.servlet
c. javax.servlet.jsp.tagext
d. Both A & C
ANSWER: Both A & C

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

39. Request processing of JSP is done by calling which method?


A. jspInit()
B. jspService()
C. jspDestroy()
D. jspRequest()
ANSWER: B

40. Which of the following method helps in jsp page initialization?


A. jspInit()
B. jspService()
C. jspDestroy()
D. init()
ANSWER: A
Web Technologies - MCQs
1. The ___ receives a stream of tokens from the parser and sorts them according to function.
Ans: Event switcher

2. DOM stands for ___.


Ans: Document Object Model

3. SAX stands for ___.


Ans: Simple API in XML

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

6. ___ is a full-fledged object-oriented programming language.


Ans: Java

7. The ___ is used to manipulate a stored piece of text.


Ans: String Object

8. The ___ contains an array of previously visited URLs by the visitor.


Ans: History Object

8. The ___ represents an open window in a browser.


Ans: Window Object

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

12. The 'A' in AJAX stands for ___.


Ans: "asynchronous,"

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.

17. Abort () method cancels any network activity. (True/False)


Ans: True
18. ___ attribute is used to return the document response entity-body.
Ans: The responseXML

19. The ___ attribute is used to return the text response entity-body.
Ans: responseText

20. AJAX stands for “___.


Ans: Asynchronous JavaScript and XML

21. ___ uses a programming model with display and events.


Ans: AJAX

22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True

23. AJAX includes HTML and ___ for presenting.


Ans: CSS

24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True

25. ___ is a powerhouse of options for the Ajax programmer.


Ans: DHTML

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

29. SSP stands for ___.


Ans: Stream-based style sheet proposal

30. A markup language is just a set of rules. (True / false)


Ans: True

31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest

32. Using an external file, It is simpler to include a ___ file.


Ans: JavaScript

33. The X in Ajax stands for ___.


Ans: XML
34. In XML, we make up our own ___ names.
Ans: Element

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

40. DSO allows data binding to HTML table elements. (true/false)


Ans: True

41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()

42. PHP stands for___


Ans: Hypertext Pre-processor

43. PHP is a ___ scripting language.


Ans: Server-side

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

50. To add more functionality to a function, we can add ___.


Ans: Parameters
51. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest

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()

54. ___ can be used for interactive communication with a database.


Ans: AJAX

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()

61. ___ is used to request the deletion of the selected records.


Ans: AjazFunctionDelete()

62. A ___ is a separate application that stores a collection of data.


Ans: database

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

70. Variables cannot contain a ___.


Ans: period

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

---- THE END ----


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 2 Develop Java programs for window/web-based applications

CO 3 Design web pages using HTML, XML, CSS and JavaScript.

CO 4 Creation of client-server environment using socket programming

CO 5 Building enterprise level applications and manipulate web databases using JDBC

CO 6 Design interactive web applications using Servlets and JSP


DETAILED SYLLABUS

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

Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans


Properties, Types of beans, Stateful Session bean, Stateless Session bean, Entity bean Java
IV Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating,
Databases with JDBC, Prepared Statements, Transaction Processing, Stored Procedures

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

1. Unit-I : Introduction ………………………...………………………………….….3

2. Unit-II : Web Page Designing ………………………………….…………...…….23

3. Unit-III : Scripting & Introduction to Networking …………………..….....…... 31

4. Unit-IV: Enterprise Java Bean & Database Connectivity (JDBC): ………..….45

5. Unit-V: Servlets & Java Server Pages (JSP)………………….....................…….52

2 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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 2 Develop Java programs for window/web-based applications

CO 3 Design web pages using HTML, XML, CSS and JavaScript.

CO 4 Creation of client-server environment using socket programming

CO 5 Building enterprise level applications and manipulate web databases using JDBC

CO 6 Design interactive web applications using Servlets and JSP


DETAILED SYLLABUS

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

Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans


Properties, Types of beans, Stateful Session bean, Stateless Session bean, Entity bean Java
IV Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating,
Databases with JDBC, Prepared Statements, Transaction Processing, Stored Procedures

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

1. Unit-I : Introduction ………………………...………………………………….….3

2. Unit-II : Web Page Designing ………………………………….…………...…….23

3. Unit-III : Scripting & Introduction to Networking …………………..….....…... 31

4. Unit-IV: Enterprise Java Bean & Database Connectivity (JDBC): ………..….45

5. Unit-V: Servlets & Java Server Pages (JSP)………………….....................…….52

2 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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 2 Develop Java programs for window/web-based applications

CO 3 Design web pages using HTML, XML, CSS and JavaScript.

CO 4 Creation of client-server environment using socket programming

CO 5 Building enterprise level applications and manipulate web databases using JDBC

CO 6 Design interactive web applications using Servlets and JSP


DETAILED SYLLABUS

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

Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans


Properties, Types of beans, Stateful Session bean, Stateless Session bean, Entity bean Java
IV Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating,
Databases with JDBC, Prepared Statements, Transaction Processing, Stored Procedures

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

1. Unit-I : Introduction ………………………...………………………………….….3

2. Unit-II : Web Page Designing ………………………………….…………...…….23

3. Unit-III : Scripting & Introduction to Networking …………………..….....…... 31

4. Unit-IV: Enterprise Java Bean & Database Connectivity (JDBC): ………..….45

5. Unit-V: Servlets & Java Server Pages (JSP)………………….....................…….52

2 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 University Academy
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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
www.aktutor.in
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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?

(a) It is a modelling language


(b) It is a DTP language
(c) It is a partial programming language
(d) It is used to structure documents
(e) It is a scripting language.

2. Consider the following statement:


GET /cgi-bin/dispenser.pl&want=whatsnew.html HTTP/1.0

Which of the following options is a correct one?

(a) The above statement is a part of a request from a web client


(b) The above statement is a part of the input to a CGI program
(c) want is a variable and whatsnew.html is a value
(d) want is a variable and whatsnew.html HTTP/1.0 is the value
(e) dispenser.pl may be a CGI program.

3. When trying to access a URL, the following message is


displayed on the browser:
Server; Error 403

What could be the reason for the message?

(a) The requested HTML file is not available


(b) The URL refers to a CGI script and the header of the script
does not indicate where the interpreter is located
(c) The path to the interpreter of the script file is invalid
(d) The first line of the output from the script is not a valid
HTTP header
(e) The requested HTML file or CGI script has insufficient
permission.

4. Which of the following statements is incorrect regarding


multimedia on the web?

(a) The MPEG, AIFF and WAV are cross-platform formats


(b) The MPEG, AU and MIDI are cross-platform formats
(c) The SND format has a relatively low fidelity
(d) VRML can be used to model and display 3D interactive
graphics
(e) The dynsrc attribute in the element can be used to include
videos in web pages.

Search for courses for free

Coursary Open
5. What would be the colours of the RGB where the
hexadecimal values are #FF0000, #00FF00 and #0000FF
respectively?

(a) Blue, Green, Red


(b) Green, Blue, Red
(c) Green, Red, Blue
(d) Red, Blue, Green
(e) Red, Green, Blue.

6. The elements and have the following characteristics

(a) Element inherits properties defined for in a stylesheet


(b)and have no real meanings as html tags unless stylesheet is
applied

(c) Elements and define content to be inline or block-level

(d)and are used as alternatives for the element


(e)is used inside element.

7. Which of the following statement is not true regarding


JavaScript?
(a) JavaScript is a loosely typed language
(b) JavaScript is an object-based language
(c) JavaScript is event driven
(d) A JavaScript embedded in an HTML document is
compiled and executed by the client browser
(e) JavaScript can not run in stand-alone mode (without a
browser).

8. The following is a web-page:

<html>
<head> <title>JavaScript</title> </head>
<body bgcolor=”#0000ff”>
<script language=”JavaScript”>
<!– document.write(“<h1> hello world </h1>”); //–>
</script>
</body>
</html>

When the above web page is loaded into a browser, what


will happen?

(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.

9. The following statements are about three important


browser objects in JavaScript.

I. window object : The highest of all objects in the client-


side JavaScript object hierarchy.
II. navigator object : A collection of information about
the browser. Useful in browser sniffing.
III. document object : Provides access to the document
being viewed.
Which of the above statements is/are true?
(a) Only (I) above
(b) Only (II) above
(c) Only (III) above
(d) Both (I) and (II) above
(e) All (I), (II) and (III) above.

10. Consider the following script:

<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>

What will be the output of the above script?

(a) pass
(b) fail
(c) null
(d) 80
(e) Error at line 6.

WEB TECHNOLOGIES Mcqs

11. The following web page is loaded into a web server:

<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.

12. Which of the following statements is false regarding


“Cookies”?

(a) Cookies are programs which run in the background of


the web-client
(b) Cookies have the potential of being used to violate the
privacy of users
(c) Cookies are very helpful in keeping track of users in
developing online shopping cart applications, personalized
portals and in advertising on web sites
(d) Cookies cannot contain more than 4Kb of data
(e) Cookies usually contain data in the form of name = value
pairs.

13. Consider the following script:

<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.

14. Which of the following statements is true regarding


HTTP?

(a) Web browsers use only HTTP as a communication


protocol with servers
(b) It does not maintain any connection information on
previous transactions
(c) It is designed to route information based on content
(d) It refers to resources using their Universal Resource
Identifier (URI)
(e) It does not carry browser information to the server.

15. Which of the following is true about XHTML?

(a) It is a new hybrid technology that is different from both


XML and HTML
(b) It has totally replaced HTML as the tool for building Web
pages
(c) It is a reformulation of HTML in XML
(d) One cannot use it to create Web pages
(e) It has to be converted to HTML using a style sheet.

16. While working on a JavaScript project, in your


JavaScript application, which function would you use to
send messages to users requesting for text input?

(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().

18. Which of the following is true about client-side script


use in HTML documents?

(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.

19. Consider the following entries in a Cascading Style


Sheet (CSS) file.

P {colour: blue; background-colour: white; border-colour:


red; border-left: solid}
BODY {colour: black; border-colour: green}

What is the colour of text in a paragraph of an HTML


document that uses the above style sheet?

(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.

21. Which of the following statements is false about event


handlers in JavaScript?

(a) They can be included with input tags


(b) They can be associated with end of file processing for
a database application
(c) They can be included with the form tag
(d) They are generally used to call functions when triggered
(e) They can be used to trigger server-side scripts.

22. What method is used to specify a container’s layout in


JSP?

(a) setLayout()
(b) Layout()
(c) setContainerLayout()
(d) ContainerLayout()
(e) setConLayout().

23. Which method of the Component class is used to set


the position and size of a component in JSP?

(a) setSize()
(b) setBounds()
(c) setPosition()
(d) setPositionSize()
(e) setSizePosition().

24. What value does readLine() return when it has


reached the end of a file in JSP?
(a) Last character in the file
(b) False
(c) Null
(d) EOF
(e) True.

25. Which class in JSP provides the capability to


implement a growable array of objects?

(a) Array class


(b) GrowAbleArray class
(c) Container class
(d) Vector class
(e) DynamicArray class.

26. In JSP, the classes that allow primitive types to be


accessed as objects are known as

(a) Primitive classes


(b) Object classes
(c) Boxing classes
(d) UnBoxing classes
(e) Wrapped classes.

27. In JSP, a Canvas object provides access to a Graphics


object via one of its method called:

(a) getCanvas()
(b) getGraphics()
(c) paint()
(d) getPaint()
(e) accessGraphics().

28. In ASP the function which returns the current system


date is:

(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()

30. DOM stand for ___________


A. document object model

B. document object memory

C. document oriented memory

D. none of these

Answer:
A.document object model

31. ________ java script is also called server side java script
A. java script

B. object based scripting language

C. nevigator

D. live wire

Answer:
D.live wire

32. Increment operator, increases the value of variable


by what number?
A. 1

B. 2

C. 3
D. 4

Answer:
A.1

33. FUCTION is a block of statements that performs


certain task.
A. true

B. false

C. both a and b

D. none of these ..

Answer:
A.true

34. __________means the amount of data that can be sent


from one point to another in a certain period of time
A. bandwidth

B. html

C. href

D. none of these

Answer:
A.bandwidth

35. HTML color are specified using predefined color


names or ________ values.
A. rgb,

B. rgba

C. hsla

D. all of these
Answer:
D.all of these

36. HTML supports__________ standard color names.


A. 140

B. 3

C. 120

D. 7

Answer:
A.140

37. ____this tag is used to give paragraph


A. <p>

B. br

C. <pre>

D. <marquee>

Answer:
A. <p>

38. ________ tag is used to brake the line it is single tag


A. <p>

B. <br>

C. <pre>

D. <marquee>

Answer:
B.<br>

39. ________ is pre formatted tags it is used ,it show the


without formatted text .
A. <p>

B. br

C. <pre>

D. <marquee>

Answer:
C.<pre>

40. __________tag is used to create a scrolling effect to th


selected text
A. <p>

B. <br>

C. <pre>

D. <marquee>

Answer:
D.<marquee>

41. __________ element is used to indicated text quoted


from another scource..
A. <blockquote>

B. br

C. <pre>

D. <marquee>

Answer:
D.<marquee>

42. _______- it is used to show list by order wise .


A. <ol>

B. br
C. <pre>

D. <marquee>

Answer:
A.<ol>

43. _____________ it is used to show list by no particular


order wise .it show bulleted wise .
A. <ul>

B. br

C. <pre>

D. <marquee>

Answer:
A.<ul>

44. ________it is a comment , it is used to show additional


information in html.
A. <!—->

B. br

C. <pre>

D. <marquee>

Answer:
A.<!—->

45. _________ it is italic tag , it is used to show the italic


font.
A. <i>

B. br

C. <pre>
D. <marquee>

Answer:
A.<i>

46. _________ it is used to display a font in a bigger font size


.
A. <big>

B. br

C. <pre>

D. <marquee>

Answer:
A.<big>

47. _________ this definition tag is used to define the


concept .
A. <def>

B. br

C. <pre>

D. <marquee>

Answer:
A.<def>

48. ________citation tag is used to display a citation in html


document .
A. <cite>

B. br

C. <pre>

D. <marquee>
Answer:
A.<cite>

49. Tag is divided into 2 tags


A. physical

B. logical

C. center tag

D. a and b b both

Answer:
D.a and b b both

50. __________ this tag is used to make taxt to be aligned


cantered.
A. <p>

B. <center>

C. <pre>

D. <marquee>

Answer:
B.<center>

51. To link to the another web site following link is used<a


href=”https://www.lokmat.com/html/”>Visit our lokamat
paper </a
A. true

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

53. __________ of the table is used to specify the thickness of


the table .DNYANSAGAR ARTS AND COMMERCE COLLEGE,
BALEWADI,PUNE-45PROF. YOGESH P.DESHMUKH
www.dacc.edu.in
A. border

B. <center>

C. cell spacing

D. <marquee>

Answer:
A.border

54. _____tag is used to create the rows in a table


A. <tr>

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

58. __________ is used to manage the layout the page.


A. <tr>
B. colspan

C. <frame>

D. rowspan

Answer:
C.<frame>

59. In html __________ is used to divide the browser the screen


into 2 or more then onepart.
A. <tr>

B. columun

C. frame

D. rowspan

Answer:
C.frame

60. ______ tag is devide the tag horizontally or vertically .


A. <tr>

B. colspan

C. <frameset>

D. rowspan

Answer:
C.<frameset>

61. ___________stands for Transmission Control


Protocol/Internet Protocol
A. tcp/ip

B. ftp

C. physical
D. hyperlink

Answer:
A.tcp/ip

62. ________is a set of standardized rules that allow computers


to communicate on anetwork such as the internet.
A. tcp/ip

B. ftp

C. physical

D. hyperlink

Answer:
A.tcp/ip

63. The __________ is a standard network protocol used for the


transfer of computerfiles between a client and server on a
computer network
A. tcp/ip

B. ftp

C. physical

D. hyperlink

Answer:
B.ftp

64. The ____________element contains meta information about


the HTML page
A. <head>

B. ftp

C. physical

D. hyperlink
Answer:
A.<head>

65. The ________element defines the document’s body, and is a


container for allthe visible contents, such as headings,
paragraphs, images, hyperlinks, tables,lists, etc.
A. <head>

B. <body>

C. physical

D. hyperlink

Answer:
B.<body>

66. _______tag are used to indicate exactly how specific


characters are to be formatted
A. tcp/ip

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

68. _______it is used to To create a link to another documents


by using href attribute
A. <a>

B. checkbox

C. <textarea>

D. <text>

Answer:
A.<a>

69. __________accept only true or false we can select more then


one option out of givenoption
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>

72. _____________it is used to submit the button ( accept the


data) to upload
A. <submit>

B. checkbox

C. <textarea>

D. <text>

Answer:
A.<submit>

73. ____________ it is used with text , when we use to hide the


text matter
A. <password>

B. checkbox

C. <textarea>

D. <text>

Answer:
A.<password>

74. Which data type value is returned by all transcendental


math functions?
A. int
B. float

C. double

D. long

Answer:
C.double

75. Which of these coding types is used for data type


characters in Java?
A. ascii

B. iso-latin-1

C. unicode

D. none of the mentioned

Answer:
C.unicode

76. Which of these values can a boolean variable contain?


A. true & false

B. 0 & 1

C. any integer value

D. true

Answer:
A.true & false

77. Decrement operator, −−, decreases the value of variable


by what number?
A. 1

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.>>

79. What is the output of relational operators?


A. integer

B. boolean

C. characters

D. double

Answer:
B.boolean

80. . Which of these is returned by “greater than”, “less than”


and “equal to”operators?
A. integers

B. floating – point numbers

C. boolean

D. none of the mentioned

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

82. Which of the following is not a decision making


statement?
A. if

B. if-else

C. switch

D. do-while

Answer:
D.do-while

83. Which of the following is not a valid flow control


statement?
A. exit()

B. break

C. continue

D. return

Answer:
A.exit()

84. Which of these operators is used to allocate memory to


array variable in Javascript?
A. malloc

B. alloc

C. new

D. new malloc

Answer:
C.new

85. Which of these is an incorrect array declaration?


A. int x[] = new int[5]

B. int [] arr = new int[5]

C. intarr[] = new int[5]

D. int x[] = int [5] new

Answer:
D.int x[] = int [5] new

86. Which of these selection statements test only for equality?


A. if

B. switch

C. if & switch

D. none of the mentioned

Answer:
A.if

87. The CSS background properties are used to define the


___________effects.
A. background

B. customize
C. class

D. id rule

Answer:
A.background

88. CSS border properties allow us to__________ the borders.


A. background

B. customize

C. class

D. id rule

Answer:
B.customize

89. By applying an_______ a style can be applied to just a single


tag.
A. background

B. customize

C. class

D. id rule

Answer:
D.id rule

90. _________selectors are used to specify a group of elements.


A. background

B. customize

C. class

D. id rule
Answer:
C.class

91. In CSS, “font-size” can be called as ________


A. property name

B. selector

C. declaration

D. text color

Answer:
A.property name

92. In CSS, h1 can be called as _______


A. property name

B. selector

C. declaration

D. text color

Answer:
B.selector

93. In , CSS “color:red” can be called as _____________


A. property name

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>

95. _______ describes how HTML elements are to be displayed


on screen, paper, or inother media
A. css

B. html

C. <textarea>

D. <text>

Answer:
A.css

96. Websites are uploaded _______


A. address

B. serve

C. cache

D. client

Answer:
B.serve

97. HTML web pages can be read and rendered by __________


A. web browser

B. server
C. empty

D. head tag

Answer:
A.web browser

98. <INPUT> is ________tag.


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

100. The body tag usually used after _________


A. web browser

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

103. The <strike> tag is used to _________the text or sentence.


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

105. _________ is used to give additional information.


A. title tag

B. paired tag

C. strikeout

D. deleted

Answer:
A.title tag
Function and String in PHP

106. What is the range of short data type in Java script ?


A. -128 to 127

B. -32768 to 32767

C. -2147483648 to 2147483647

D. none of the mentioned

Answer:
B.-32768 to 32767

107. What is the range of byte data type in Java script?


A. -128 to 127
B. -32768 to 32767

C. -2147483648 to 2147483647

D. none of the mentioned

Answer:
A.-128 to 127

108. An expression involving byte, int, and literal numbers is


promoted towhich of these?
A. int

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

D. none of the mentioned

Answer:
C.unicode

111. Which one is a valid declaration of a Boolean?


A. boolean b1 = 1;

B. boolean b2 = ‘false’;

C. boolean b3 = false;

D. boolean b4 = ‘true’

Answer:
C.boolean b3 = false;

112. Which of these operators is used to allocate memory to


array variable inJava script?
A. malloc

B. alloc

C. new

D. new malloc

Answer:
C.new

113. Which of these is an incorrect array declaration?


A. intarr[] = new int[5]

B. int [] arr = new int[5]

C. intarr[] = new int[5]

D. intarr[] = int [5] new


Answer:
D.intarr[] = int [5] new

114. Which of these is necessary to specify at time of array


initialization?
A. row

B. column

C. both row and column

D. none of the mentioned

Answer:
A.row

115. Which of the following can be operands of arithmetic


operators?
A. numeric

B. boolean

C. characters

D. both numeric & characters

Answer:
D.both numeric & characters

116. Modulus operator, %, can be applied to which of these?


A. integers

B. floating – point numbers

C. both integers and floating – point numbers

D. none of the mentioned

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.~

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

119. Which of these operators can skip evaluating right hand


operand?
A. !

B. none of the mentioned

C. &

D. &&

Answer:
D.&&

120. Which of these have highest precedence?


A. ()
B. ++

C. *

D. >>

Answer:
A.()

121. Which of these statements are incorrect?


A. equal to operator has least precedence

B. brackets () have highest precedence

C. division operator, /, has higher precedence than


multiplication operator

D. addition operator, +, and subtraction operator have equal


precedence

Answer:
D.addition operator, +, and subtraction operator have equal
precedence

122. Which of these selection statements test only for


equality?
A. if

B. switch

C. if & switch

D. none of the mentioned

Answer:
B.switch

123. Which of these are selection statements in Java script?


A. if()

B. for()
C. continue

D. break

Answer:
A.if()

124. Which of the following is not a valid jump statement?


A. break

B. goto

C. continue

D. return

Answer:
D.return

125. _______is the measured as the amount of data that can be


transferred from onepoint to another point within a specific
amount of time.
A. http

B. bandwidth

C. webpage

D. dream viewer

Answer:
B.bandwidth

126. A ___________ is a document, typically written in plain


text distributed withformatting instruction of Hypertext
markup languages like HTML,XHTML
A. http

B. bandwidth

C. webpage
D. dream viewer

Answer:
C.webpage

127. ___________ Stands for Hypertext markup languages for


displaying webpages and other information that can be
displayed in a web browser
A. http

B. bandwidth

C. webpage

D. dream viewer

Answer:
A.http

128. Cost of buying and running a server for client serve


model are high .
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:

B. internal or embedded css

C. external css:

D. none of these.
Answer:
D.none of these.

130. The _______ tag provides no visual change by itself, but


when it is marked, you canstyle it with CSS, or manipulate it
with JavaScript.
A. <map>

B. <span>

C. <img>

D. <tt>

Answer:
B.<span>

131. The _________ tag defines an image in an HTML page.


A. <map>

B. <span>

C. <img>

D. <tt>

Answer:
A.<map>

132. The ____________tag has two required attributes: src and


alt.
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>

134. _________tag Indicates that the text should be used with a


font such as Courier thatallots the same width to each
character.
A. <map>

B. <span>

C. <img>

D. <tt>

Answer:
D.<tt>

135. _____________ tag Indicates that the text should be


displayed in a small font.Available in HTML 3.0 or higher.
A. <small>

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>

137. ___________Indicates that characters should be


emphasized in some way. Usuallydisplayed in italics.
A. <small>

B. <em>

C. <u>

D. <strong >

Answer:
B.<em>

138. _________Emphasizes characters more strongly than


<EM>. Usually displayed in a boldfont
A. <small>

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 >

140. ________Indicates a variable. Often displayed in italics or


underlined.
A. <var>

B. <em>

C. <kbd >

D. <strong >

Answer:
A.<var>

141. _________Indicates short quotes or citations. Often italized


by browsers.
A. <small>

B. <cite>

C. <kbd >

D. <strong >

Answer:
B.<cite>

142. The ________ele1ment defines a table row, the <th>


element defines a table header,and the <td> element defines a
table cell.
A. <small>

B. <tr>

C. <kbd >

D. <strong >

Answer:
B.<tr>

143. The _______ tag is used to create in an HTML table.


A. <table>

B. <tr>

C. <td >

D. <th >

Answer:
A.<table>

144. CSS stands for ___________


A. cascading style sheets

B. cascading super sheets

C. cascading style excel sheet

D. none of these

Answer:
A.cascading style sheets

145. _________means the way to move from one page to


another page in website.To move from one page to another
pages hyperlinks are used.
A. http
B. bandwidth

C. navigation

D. dream viewer

Answer:
C.navigation

146. __________ is Web development software . Create, code


and manage dynamicwebsites easily with a smart, simplified
coding engine
A. http

B. bandwidth

C. webpage

D. dream viewer

Answer:
D.dream viewer

147. ________ is a server scripting language, and a powerful


tool for making dynamicand interactive Web pages.
A. php

B. java script

C. angular js

D. none of these

Answer:
A.php

148. _______ is a object oriented programming language , it is


used to create theobject…
A. php

B. java script
C. angular js

D. none of these

Answer:
A.php

149. A ________ script can be placed anywhere in the


document.
A. php

B. java script c

C. angular js

D. none of these

Answer:
A.php

150. The default file extension for PHP files is _________


A. .php

B. .js

C. .ajs

D. none of these

Answer:
A..php

151. __________ is used to show the out put …or give


message..same as printf in clanguage…
A. echo

B. java script

C. angular js

D. none of these
Answer:
A.echo

152. PHP supports a ___________ range of databases


A. wide

B. small

C. short

D. none of these

Answer:
A.wide

153. PHP supports the following data types:


A. string

B. integer

C. float (floating point numbers – also called double)

D. all of the above .

Answer:
D.all of the above .

154. In PHP, an object must be_________declared.


A. explicitly

B. implicitly

C. both a and b

D. none of these

Answer:
A.explicitly

155. PHP divides the operators in the following groups:


A. increment/decrement operators
B. logical operators

C. string operators

D. all of the above

Answer:
D.all of the above

156. The basic assignment operator in PHP is __________ It


means that the left operandgets set to the value of the
assignment expression on the right.
A. =

B. ++

C. ==

D. ?

Answer:
A.=

157. the _________ statement is used to perform different


actions based on differentconditions
A. switch

B. if condition

C. foreach

D. while

Answer:
A.switch

158. In PHP, we have the following loop types:


A. while loop

B. for loop
C. foreach

D. all the these.

Answer:
D.all the these.

159. In php, A ___________ is a block of statements that can be


used repeatedly in aprogram.
A. function

B. procedure

C. block

D. loop

Answer:
A.function

Web Technologies Objective Questions with Answers Quiz


Test Pdf Download

---- >> Related Posts Of Above Questions :::

------>>[MOST IMPORTANT]<<------

1. 250+ TOP MCQs on Embedding JavaScript in HTML


and Answers
2. 15 Days Learn Execute ExtJS Online
3. 15 Days Learn What is the JavaScript Object()
Constructor?
4. 250+ TOP MCQs on Script Loading and Answers
5. 250+ TOP MCQs on FTP & HTTP and Answers
6. 250+ TOP MCQs on HTML DOM and Answers
7. 250+ TOP MCQs on Client-Side JavaScript and
Answers
8. 300+ TOP Ui Developer Interview Questions and
Answers
9. 250+ TOP MCQs on Web Browsers and Answers
WEB TECHNOLOGY

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

2- What is a web browser?


a) a program that can display a web page
b) a program used to view html documents
c) it enables user to access the resources of internet
d) all of the mentioned

Ans- d) all of the mentioned

3-________ is known as father of WWW.


a) John T. Thomson
b) Denis Ritchie
c) Tim Berners-Lee
d) None of above

Ans- c)Tim Berners-Lee

4- On which one of the following dates World Wide Web was invented?
a)1972
b)1989
c)1986
d)1930

Ans- b)1989

5- A web cookie is a small piece of data that is _______


a) sent from a website and stored in user’s web browser while a user is browsing a website
b) sent from user and stored in the server while a user is browsing a website
c) sent from root server to all servers
d) sent from the root server to other root servers
Ans- a) sent from a website and stored in user’s web browser while a user is browsing a
website

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

7- 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) i, ii, iii

8- World Wide Web


a) is another name for internet
b) world wide connection for computers
c) a collection of linked information residing on computers connected by the internet
d) a collection of world wide information

Ans- c) a collection of linked information residing on computers connected by the internet

9- A world wide web contains web pages


a) residing in many computers
b) created using HTML
c) with links to other web pages
d) residing in many computers linked together using HTML

Ans- d) residing in many computers linked together using HTML


10- A web page is located using a
a) Universal Record Linking
b) Uniform Resource Locator
c) Universal Record Locator
d) Uniformly Reachable Links

Ans- b) Uniform Resource Locator

11- Which of the following allows user to view a webpage?


a) Operating System
b) Website
c) Interpreter
d) Internet Browser

Ans- d) Internet Browser

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

14- The communication protocol used by internet is


a)HTTP
b)WWW
c)TCP/IP
d)FTP

Ans- c) TCP/IP

15- Which of the following is called as protocol in the URL?

http://www.c4learn.com

a) c4learn
b) www
c) http
d) .com

Ans- c) http

16- A simple protocol used for fetching e-mail from a mailbox is


a) POP2
b) POP3
c) IMAP
d) None of the above

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- d) all of the above

18- What protocol is used between E-Mail servers?


a) FTP
b) SMTP
c) SNMP
d) POP3

Ans- b) SMTP

19- During error reporting, ICMP always reports error messages to


a)Source
b)Destination
c)Station
d)Header

Ans- a) Source

20- The File Transfer Protocol is built on ______________


a) data centric architecture
b) service oriented architecture
c) client server architecture
d) connection oriented architecture

Ans- c) client server architecture


21- The FTP protocol is used to __________?
a) Transfer data over the internet
b) Exchange files over the internet
c) Transfer text message over the internet
d) All of the above

Ans- b) Exchange files over the internet

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

Ans- c) Both upload and download

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

24- FTP is built on _____ architecture.


a)Client- Server
b)P2P
c)Both of the above
d)None of the above

Ans- a) Client- Server

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

26- W3C stands for


a) World Wide Web Consortium
b) World Wide Web Collaboration
c) World Wide Web Community
d) None of the mentioned

Ans- a) World Wide Web Consortium

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

a) v, i, iv, vi, ii, iii


b) v, ii, vi, iv, i, iii
c) v, ii, iv, vi, i, iii
d) vi, ii, iv, v, i, iii

Ans- c) v, ii, iv, vi, i, iii

28- DNS is used to resolve host names to IP addresses and find services.
a) True
b) False

Ans- a) True

29- Intranet and Extranet differs at ___________________________.


a) Intranet: Private , Extranet: Public
b) Intranet: Public, Extranet: Public
c) Intranet: Private, Extranet: Private and also allowed authorized partners
d) Intranet: Public, Extranet: Private

Ans- c) Intranet: Private, Extranet: Private and also allowed authorized partners

30- _____________ is a subset of the website.


a)Web Site
b) Web Space
c) Web Portal
d) None of above

Ans- c) Web Portal

31- An extranet is which of the following?


a) The use of Internet protocols with limited access to company data by the company's
customers and suppliers.
b) The use of Internet protocols with unlimited access to company data by the company's
customers and suppliers.
c) The use of Internet protocols with limited access to company data by people within an
organization.
d) The use of Internet protocols with unlimited access to company data by people within an
organization.

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

Ans- c) Completely Static Website

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- c) Static Website

34- In HTTPS ‘S’ is stands for:


a) Simple
b) Secured
c) Server
d) None of these

Ans- b) secured
35- Which protocol is used for browsing website
a)TCP
b) HTTP
c) FTP
d) TFTP

Ans- b) HTTP

36- Which protocol use to transmit information on the WWW


a) HTPP
b) HPPT
c) HTTTP
d) 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

Ans- d) all of the above

40- Some Abbreviations:


a) ISP – Internet Service Provider
b) TCP- Transmission Control Protocol
c) IP- Internet Protocol
d) SMTP- Simple Mail Transfer Protocol
e) POP- Post Office Protocol
f) IMAP- Internet Message Access Protocol
g) HTTP- Hyper Text Transfer Protocol
h) ICMP- Internet Control Message Protocol
i) FTP- File Transfer Protocol
j) URL-Uniform Resource Locator
k) DNS- Domain Name System
l) UI- User Interface
m) UX- User eXperience
n) MIME- Multipurpose Internet Mail Extension
o) W3C- World Wide Web Consortium
p) JDK- Java Development Kit
q) JRE- Java Runtime Environment
r) JVM- Java Virtual Machine
s) JIT- Just-in Time
t) AWT- Abstract Window Toolkit
u) JAR- Java ARchive
41- Which of the following is not a Java features?
a) Dynamic
b) Architecture Neutral
c) Use of pointers
d) Object-oriented

Ans- c) Use of pointers

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

44- Which component is responsible to run java program?


a) JVM
b) JDK
c) JIT
d) JRE

Ans- a) JRE

45- Which statement is true about java?


a) Platform independent programming language
b) Platform dependent programming language
c) Code dependent programming language
d) Sequence dependent programming language
Ans- a) Platform independent programming language

46- Which of the below is invalid identifier with the main method?
a) public
b) static
c) private
d) final

Ans- c) private

47- What is the extension of java code files?


a) .class
b) .java
c) .txt
d) .js

Ans- b) .java

48- What is the extension of compiled java classes?


a) .class
b) .java
c) .txt
d) .js

Ans- a) .class

49- What is use of interpreter?


a) They convert bytecode to machine language code
b) They read high level code and execute them
c) They are intermediated between JIT and JVM
d) It is a synonym for JIT

Ans- b) They read high level code and execute them

50- Which of the following is not OOPS concept in Java?


a) Inheritance
b) Encapsulation
c) Polymorphism
d) Compilation

Ans- d) Compilation

51- Which of the following is a type of polymorphism in Java?


a) Compile time polymorphism
b) Execution time polymorphism
c) Multiple polymorphism
d) Multilevel polymorphism

Ans- a) Compile time polymorphism


Explanation: There are two types of polymorphism in Java. Compile time polymorphism
(overloading) and runtime polymorphism (overriding).

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

53- Which of these values can a boolean variable contain?


a) True & False
b) 0 & 1
c) Any integer value
d) true

Ans- a) True & False

54- Which one is a valid declaration of a Boolean?


a) boolean b1 = 1;
b) boolean b2 = ‘false’;
c) boolean b3 = false;
d) boolean b4 = ‘true’
Ans- c) Boolean b3 = false;

55- Which of these is an incorrect array declaration?


a) int arr[] = new int[5]
b) int [] arr = new int[5]
c) int arr[] = new int[5]
d) int arr[] = int [5] new

Ans- d) int arr[] = int [5] new

56- What is the stored in the object obj in following lines of Java code?

box obj;

a)Memory address of allocated memory of object


b) NULL
c) Any arbitrary pointer
d) Garbage

Ans- b) NULL

57- Which of the following is a valid declaration of an object of class Box?


a) Box obj = new Box();
b) Box obj = new Box;
c) obj = new Box();
d) new Box obj;

Ans- a) Box obj = new Box();

58- Which of these operators is used to allocate memory for an object?


a) malloc
b) alloc
c) new
d) give

Ans- c) new

59- Which of the following statements is correct?


a) Public method is accessible to all other classes in the hierarchy
b) Public method is accessible only to subclasses of its parent class
c) Public method can only be called by object of its class
d) Public method can be accessed by calling object of the public class

Ans- a) Public method is accessible to all other classes in the hierarchy

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

61- Which of these keywords are used to define an abstract class?


a) abst
b) abstract
c) Abstract
d) abstract class

Ans- b) abstract

62- Which of these class is superclass of every class in Java?


a) String class
b) Object class
c) Abstract class
d) ArrayList class

Ans- b) Object class

63- Which of this keyword must be used to inherit a class?


a) super
b) this
c) extent
d) extends

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

65- Which of these is correct way of inheriting class A by class B?


a) class B + class A {}
b) class B inherits class A {}
c) class B extends A {}
d) class B extends class A {}

Ans- c) class B extends A {}

66- What is not type of inheritance?


a) Single inheritance
b) Double inheritance
c) Hierarchical inheritance
d) Multiple inheritance

Ans- b) Double inheritance

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

68- All classes in Java are inherited from which class?


a) java.lang.class
b) java.class.inherited
c) java.class.object
d) java.lang.Object

Ans- d) java.lang.Object

69- Static members are not inherited to subclass.


a) True
b) False

Ans- b) False

70- Which of these keywords is used to define packages in Java?


a) pkg
b) Pkg
c) package
d) Package

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- c) import pkg.*

73- Which of these keywords is used to define interfaces in Java?


a) interface
b) Interface
c) intf
d) Intf

Ans- a) interface

74- Which of these access specifiers can be used for an interface?


a) Public
b) Protected
c) private
d) All of the mentioned

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- b) class B implements A{}

76- What does an interface contain?


a) Method definition
b) Method declaration
c) Method declaration and definition
d) Method name
Ans- b) Method declaration

77- When does Exceptions in Java arises in code sequence?


a) Run Time
b) Compilation Time
c) Can Occur Any Time
d) None of the mentioned

Ans- a) Run Time

78- Which of these keywords is not a part of exception handling?


a) try
b) finally
c) thrown
d) catch

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

80- What is the use of try & catch?


a) It allows us to manually handle the exception
b) It allows to fix errors
c) It prevents automatic terminating of the program in cases when an exception occurs
d) All of the mentioned

Ans- d) All of the mentioned

81- Which of these method is used to implement Runnable interface?


a) stop()
b) run()
c) runThread()
d) stopThread()

Ans- b) run()

82- Which of these method is used to begin the execution of a thread?


a) run()
b) start()
c) runThread()
d) startThread()

Ans- b) start()

83- What is multithreaded programming?


a) It’s a process in which two different processes run simultaneously
b) It’s a process in which two or more parts of same process run simultaneously
c) It’s a process in which many different process are able to access same information
d) It’s a process in which a single process can access information from many sources

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

86- Which of these class is used to read from byte array?


a) InputStream
b) BufferedInputStream
c) ArrayInputStream
d) ByteArrayInputStream

Ans- d) ByteArrayInputStream

87-An applet is a Java class that extends the?


a) java.Applet class
b) java class
c) Applet class
d) java.applet.Applet class

Ans- d) java.applet.Applet class


88- Applets are designed to be embedded within an __________.
a) Javascript
b) Css
c) HTML
d) SQL

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?

a)<applet class=Test width=200 height=100>


</applet>

b) <applet>
code=Test.class width=200 height=100>
</applet>

c) <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

Ans- a) An event is an object that describes a state change in a source

94- What is a listener in context to event handling?


a) A listener is a variable that is notified when an event occurs
b) A listener is a object that is notified when an event occurs
c) A listener is a method that is notified when an event occurs
d) None of the mentioned

Ans- b) A listener is a object that is notified when an event occurs

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

98- Which of these package is used for graphical user interface?


a) java.applet
b) java.awt
c) java.awt.image
d) java.io

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

Ans- c) Heap memory

100- Which of the following is false?


a)The rt.jar stands for the runtime jar
b)It is an optional jar file
c)It contains all the compiled class files
d)All the classes available in rt.jar is known to the JVM

Ans- b) It is an optional jar file


UNIT-2
1. Which attribute specifies a unique alphanumeric identifier to be associated with an element?
a) class
b) id
c) article
d) html

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.

7. Which element contains definition?


a) <dl>
b) <dd>
c) <dt>
d) <ul>

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.

8.. Which of the following can’t be the value of list-style-type?


a) square
b) circle
c) ellipse
d) disc

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.

9.For displaying a list horizontally, we can use ______________


a) <dd>
b) display:inline
c) <dt>
d) type

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.

10.Which element was designed for creating multicolumn directory lists?


a) menu
b) dir
c) ul
d) ol

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.

11. Which element is restricted to inline content?


a) <dt>
b) <dd>
c) <ul>
d) <dl>
Answer: a
Explanation: <dt> element is restricted to inline content. In creation of a definition list the term is
given by <dt> element. <dd> element contains block-level content. The description is given by <dd>
element. <dl> is also used for marking up the dialogues.

12.The content property does not include __________


a) Strings
b) URIs
c) Normal
d) Color

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.

13. Each cell of the table can be represented by using __________


a) <tr>
b) <td>
c) <th>
d) <thead>

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.

14.For heading we can use ____________


a) <td>
b) <tr>
c) <thead>
d) <th>

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.

15.Headings of table lies inside ___________


a) <thead>
b) <tfoot>
c) <th>
d) <tbody>

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.

18. Borders can’t be applied on ________________


a) <th>
b) <td>
c) <tr>
d) <thead>

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; }

tfoot tr:last-child td{border-bottom: 9 px;}

19. Which of the following does not specify a column width?


a) Fixed
b) Percentage
c) Proportional
d) Pixels

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.

20.Which of the following is not the value for align attribute?


a) justify
b) char
c) middle
d) left

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.

21.valign attribute does not take the value __________________


a) justify
b) middle
c) baseline
d) bottom

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>

(c) <img src=“https://bit.ly/2FicgIx” alt=“Geeksforgeeks”>

(d) <image src=“https://bit.ly/2FicgIx” alt=“Geeksforgeeks”></image>

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

<img src=”apple.jpg” alt=”This is an apple, It is red” title=”apple”/>

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.

24.For caption of the image we use ____________

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

<figure> <img src=”sea.jpg” alt=”Photograph of the sea”> <br/>

<figurecaption> Sea is holding hands </figurecaption> </figure>

Name/title of HTML document is given by <title></title> tag.

25.Metadata does not define _________

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>.

26. Which element defines preformatted text?

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 ____________

a) link other pages within the same site

b) link the same page with other sites

c) link other pages with other sites

d) does not link

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?

a) <img src= “pic.jpg”>

b) <img src= “../pic.jpg”>

c) <img src= “images/pic.jpg”>

d) <img src= “/images/pic.jpg”>

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.

30. For defining bookmarks in a page we use __________

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.

31. In CSS, h1 can be called as _______

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.

33.In css, “color:red” can be called as _____________

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

d) both class and tag

Answer: a

Explanation: For binding a particular unique element, id selectors are used. While for group of
elements, class selector can be used.

35.Which of the following tag is used to embed css in html page?

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

41.“font-style comes first than font-weight in font attribute”.State true or false.


a) True
b) False
Answer: b
Explanation: Syntax:
font: font-weight font-style font-variant font-size/line-height font-family .

42. What will be the output of following code snippet?

h1 {color: red text-decoration: underline; font-style: italic;}

a) color: red, text-decoration: underline and font-style: italic all works

b) text-decoration: underline and font-style: italic works

c) color: red, text-decoration: underline works

d) only font-style: italic works

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.

43.What will be the output of below mentioned code snippet?

h1 {color: "green";}

a) heading becomes green

b) heading becomes dark-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

within the head of the document.

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.

47.Which of the following is not an Absolute Unit?

a) px

b) em

c) pt

d) mm

Answer: b

Explanation: em is a Relative Unit

48.Which of the following element is used for linking a External Files to the html page?

a) <script>

b) <style>

c) <link>

d) all of the above

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.

51.What is true about XML Schema?

A. It is used to describe and validate the structure and the content of XML data.

B. XML schema defines the elements, attributes and data types.

C. It is similar to a database schema that describes the data in a database.

D. All of the above


Ans : D

Explanation: All of the above statement are true.

52.XML Schema is commonly known as ?

A. XZD

B. XAS

C. XSD

D. XFD

Ans : C

Explanation: XML Schema is commonly known as XML Schema Definition (XSD)

53.How is everything treated in HTML DOM?

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:

● The document itself is a document node.


● All HTML elements are element nodes.
● All HTML attributes are attribute nodes.
● Text inside HTML elements are text nodes.
● Comments are comment nodes.

54.How are the objects organized in the HTML DOM?


a) Class-wise

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.

55.Which of the following is a type of HTML DOM?

a) Legacy DOM

b) W3C DOM

c) IE4 DOM

d) All of the mentioned

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.

56.Which object is the top of the hierarchy?

a) Window Object

b) Document Object

c) Form Object

d) Form Control Elements


Answer: a

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.

57.What is the purpose of the Legacy DOM?

a) Makes the scripting easier

b) Allows access to few keys and elements

c) Modify the nodes

d) Making the script modular

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

b) Attributes don’t have attributes

c) Attributes have attributes

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) The domain name and IP address


B) Host address and Domain name
C) Domain name and server address
D) Server name and IP address

Answer- A) Domain name and IP address

60. How many standard color names does HTML supports?

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.

61.Which of the following is not set with font-style property?

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.

63.Which works similar to <i> element?

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.

<p><strong>Dog is</strong> an animal.</p>

Output: Dog is an animal.

65.Which element is used for abbreviation or acronym?

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>

Output: The Dr. is on the way.

66. What is the work of <address> element?

a) contains contact details for author

b) contains IP address

c) contains home 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

67.10. To show deleted text, which element is used?

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.

<p>This is <del>not</del> for deletion </p>

Output: This is not for deletion.

68.How <bdo> element works?

a) override text direction

b) stops writing in the current text direction

c) only override direction of rtl text


d) only changes the direction of ltr text

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.

69.For smaller text which element is used?

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.

<p>This is text in <small>small</small>.</p>

Output: This is text in small.

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.

72.how can you make an e-mail link?

a. <a href=”xxx@yyy”>
b. <mail href=”xxx@yyy”>
c. <mail>xxx@yyy</mail>
d. <a href=”mailto:xxx@yyy”>
Answer: d

73. In which part of the HTML metadata is contained?

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.

74.What is the role of charset attribute? It specifies

a) a scheme to be used to interpret the value of the content attribute

b) a name for the metadata

c) the character encoding for the HTML document

d) the character decoding for the HTML document

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.

75.Which of the following is not supported in HTML5?

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.

78.In OSI model USB lies under the layer ___________

a) data Link layer

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.

79. IP is used in the level ___________

a) presentation layer

b) network layer

c) application layer

d) data Link 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.

81.Which header field defines meta information?

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.

82.Which of the following is not the request method?

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

84. Which of the following is not a request-header field?

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.

85. Which of the following is not a response-header field?

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.

86.Protocols are set of rules to govern _________

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.

88. What is the correct syntax of doctype in HTML5?

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?

a) Browser finds the document in quirky mode

b) Browser finds a document in standard mode


c) Browser stops working

d) Browser crashes after showing the page

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.

90. Which tag supports Non-English language?

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.

91. Which element was not removed by HTML5?

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”.

92.Which of the following is not a type of attribute for input tag?

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

Explanation: Scripts are re-enabled by allow-scripts. Allow-forms re-enables from submission.


Allow-same-origin allows iframe content to be treated as being from the same origin. API’s are
re-enable by allow-pointer-lock.

97.Which of the following defines a group of related options in a drop-down list?

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.

99. Which of the following prints bold letters in traditional HTML?

i. <B>Go boldly</B>

ii. <B>Go boldly</b>

iii. <b>Go boldly</B>

iv. <b>Go boldly</b>

a) iv

b) i

c) i, ii, iii, and iv

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.

100. XHTML is case insensitive and HTML is case sensitive.


a) True

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)

Q 1 - Which of the following is correct about JavaScript?

A - JavaScript is a lightweight, interpreted programming language.

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.

D - All of the above.

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 User's machine running a Web browser

B. The Web server

C. A central machine deep within Netscape's corporate offices

D. None of the above

Q6. What should appear at the very end of your JavaScript?

The <script type="text/JavaScript">tag

A. The </script>

B. The <script>

C. The END statement

D. None of the above

Q7. Which of the following can't be done with client-side JavaScript?

A. Validating a form

B. Sending a form's contents by email

C. Storing the form's contents to a database file on the server

D. None of the above

Q8. What is the correct JavaScript syntax to write "Hello World"?

A. System.out.println("Hello World")

B. println ("Hello World")

C. document.write("Hello World")

D. response.write("Hello World")

Q9. Inside which HTML element do we put the JavaScript?

A. <js>

B. <scripting>

C. <script>

D. <javascript>
Q10. What is the correct syntax for referring to an external script called " abc.js"?

A. <script href=" abc.js">

B. <script name=" abc.js">

C. <script src=" abc.js">

D. None of the above

Q11. Which is the correct way to write a JavaScript array?

A. var txt = new Array(1:"tim",2:"kim",3:"jim")

B. var txt = new Array("tim","kim","jim")

C. var txt = new Array:1=("tim")2=("kim")3=("jim")

D. var txt = new Array="tim","kim","jim"

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";

C. para1.firstChild.nodeValue= "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

Q14. Which of the following best describes JavaScript?

A. a low-level programming language.

B. a scripting language precompiled in the browser.

C. a compiled scripting language.

D. an object-oriented scripting language.

Q15. What is the correct JavaScript syntax to change the content of the HTML element below?

<p id="demo">This is a demonstration.</p>


A. document.getElementById("demo").innerHTML = "Hello World!";
B. document.getElementByName("p").innerHTML = "Hello World!";
C. document.getElement("p").innerHTML = "Hello World!";
D. #demo.innerHTML = "Hello World!";

Q16. How do you write "Hello World" in an alert box?

A. alert("Hello World");
B. msg("Hello World");
C. msgBox("Hello World");
D. alertBox("Hello World");

Q17. How do you create a function in JavaScript?

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

Q21. avaScript Code is written inside file having extension __________.

A. .javascript
B. .jvs
C. .js
D. .jsc

Q22. hy JavaScript is called as Lightweight Programming Language ?

A. because JS is client side scripting


B. because we can add programming functionality inside JS
C. because JS is available free of cost.
D. because JS can provide programming functionality inside but up to certain extend.

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

Q26. Which was the first browser to support JavaScript ?

A. IE
B. Mozilla Firefox
C. Netscape
D. Google Chrome

Q27 Which of the data type is not available in JS?

A. float
B. var
C. boolean
D. undefined

Q28. Which company developed JavaScript?

A. Netscape

B. Bell Labs

C. Sun Microsystems

D. IBM

Q29. JavaScript is designed for following purpose -

A. to style HTML pages

B. to execute Queries related to databases on a server


C. to add interactivity to html pages

D. All of the above

Q30. What are the types of Pop up boxes available in JavaScript?

A. Alert

B. Prompt

C. Confirm

D. All of the above

Q31. How ++ works in Javascript? Find output of below Javascript code.

var a = 1;

document.write(a--);

document.write(a);

A. 00

B. 01

C. 11

D. 10

Q32. Find output of below Javascript addition code

document.write("1 plus 1 is " + 1 + 1);

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

B. It returns the decimal values in string form

C. If returns only the integer portion of the number


D. None of the listed option

Q34. What is the output of below Javascript code?

alert (typeof new Date() );

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

Q36. AJAX Stands for:

A. Asynchronous Javascript and XML

B. Abstract JSON and XML

C. Another Java Abstraction for X-Windows

D. Another Java and XML Library

Q37. What makes Ajax unique?

A. It works as a stand-alone Web-development tool.

B. It works the same with all Web browsers.

C. It uses C++ as its programming language.

D. It makes data requests asynchronously.

Q38. What does the XMLHttpRequest object accomplish in Ajax?

A. It’s the programming language used to develop Ajax applications.

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.

Q39. Ajax is a programming language.

A. True

B. False

Q40. AJAX based on ______ .

A. JavaScript and XML

B. JavaScript and Java

C. VBScript and XML

D. JavaScript and HTTP requests

Q41. Using AJAX we can made our web page.

A. more interactive and faster

B. easy to connect web page with server

C. more dynamic

Q42. What are the advantages of AJAX?

A. AJAX is a platform-independent technology


B. It provides partial-page updates
C. Improved performance
D. All of the above

Q43. What are the disadvantages of AJAX?

A. Dependent on JavaScript
B. Security issues
C. Debugging is difficult
D. All of the above

Q44. Which of the following technology is not used by Ajax?

A. JavaScript
B. XMLHttpRequest
C. Document Object Model
D. Flash

Q45. AJAX comes in ____.

A. 2003

B. 2005

C. 2004

D. 2006
Q46. AJAX made popular by

A. Microsoft

B. IBM

C. Sun Microsystem

D. Google

Q47. __ is more robust and secure than __.

A. POST, GET

B. GET, POST

C. Both A & B

D. None of the above

Q48. The ___ property defines a function to be executed when the readyState changes.

A. onreadystatechange

B. onreadystateup

C. onreadystatedown

D. None of the above

Q49. What are the advantages of Ajax?

A. Bandwidth utilization

B. More interactive

C. Speeder retrieval of data

D. All of these

Q50. __ get the response data as XML data.

A. responseXML

B. responseText

C. responseString

D. None of the above

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

Q54. Which of these is a full form of DNS?

a) Data Network Service

b) Data Name Service

c) Domain Network Service

d) Domain Name Service

Q55. Which of these class is used to encapsulate IP address and DNS?

a) DatagramPacket

b) URL

c) InetAddress

d) ContentHandle

Q56. What will be the output of the following Java program?

import java.net.*;

class networking

public static void main(String[] args) throws UnknownHostException

InetAddress obj1 = InetAddress.getByName("cisco.com");

System.out.print(obj1.getHostName());

a) cisco
b) cisco.com

c) www.cisco.com

d) none of the mentioned

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

Thin driver is also known as?


Type 3 Driver
Type 2 Driver
Type 4 Driver
Type 1 Driver

Question 3

Which JDBC driver can be used in servlet and applet both?


answer choices
Type 3
Type 4
Type 3 and Type 2
Type 3 and Type 4
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.
Question 4

JDBC-ODBC driver is also known as?


Type 4
Type 3
Type 2
Type 1

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

JDBC API supports____________ and __________ architecture model for


accessing the database.
Two-tier
Three-tier
Both a and b
Only b

Question 8

which of the following driver is platform independent and database dependent?


answer choices
Type-2
Type-1
Type-3
Type-4

Question 9

In type-1 driver database is _______ and platform is _______.


dependent, dependent
independent, dependent
dependent, independent
independent, independent

Question 10

Which of the following driver are database and platform independent?


JDBC-ODBC driver
Network protocol driver
Native-API
Thin driver

Question 11

which of the following driver also known as pure java driver?


answer choices
Type-3
Type-4
Type-1
Type-2

Question 12

How many JDBC driver does Sun define?


one
two
three
four

Question 13
Driver types are used to categorize the technology used to connect to database.
True
False

Question 14

This is an application programming interface provided by Microsoft for access


the database. It use SQL as its database language.
JDBC
ODBC

Question 15

JDBC stands for:


Java Database Component
Java Database Connectivity
Java Database Control
None
JDBC Quiz

1-What are the major components of the JDBC?

a. DriverManager, Driver, Connection, Statement, and ResultSet


b. DriverManager, Driver, Connection, and Statement
c. DriverManager, Statement, and ResultSet
d. DriverManager, Connection, Statement, and ResultSet

2-Select the packages in which JDBC classes are defined?

a. jdbc and javax.jdbc


b. rdb and javax.rdb
c. jdbc and java.jdbc.sql
d. sql and javax.sql

3-What is the correct sequence to create a database connection?


i. Import JDBC packages.
ii. Open a connection to the database.
iii. Load and register the JDBC driver.
iv. Execute the statement object and return a query resultset.
v. Create a statement object to perform a query.
vi. Close the resultset and statement objects.
vii. Process the resultset.
viii. Close the connection.

a. i, ii, iii, v, iv, vii, viii, vi


b. i, iii, ii, v, iv, vii, vi, viii
c. ii, i, iii, iv, viii, vii, v, vi
d. i, iii, ii, iv, v, vi, vii, viii

4- Parameterized queries can be executed by?

a. ParameterizedStatement
b. PreparedStatement
c. CallableStatement and Parameterized Statement
d. All kinds of Statements

Explanation: The PreparedStatement interface extends the Statement interface.


It represents a precompiled SQL statement that can be executed multiple times.
It accepts parameterized SQL quires. We can pass 0 or more parameters to this
query.
5- Which of the following is not a valid statement in JDBC?

a. Statement
b. PreparedStatement
c. QueryStatement
d. CallableStatement

Explanation:

o 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.
o PreparedStatement: It represents the pre-compiled SQL statements that
can be executed multiple times.
o CallableStatement: It is used to execute SQL stored procedures.
o QueryStatement: It is not supported by JDBC.

6- Stored procedure can be called by using the ????..?

a. CallableStatement
b. Statement
c. CalledStatement
d. PreparedStatement

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.

7- Which of the following driver is the fastest one?

a. JDBC-ODBC Bridge Driver


b. Native API Partly Java Driver
c. Network Protocol Driver
d. JDBC Net Pure Java Driver

8- 5. What does setAutoCommit(false) do?


a) commits transaction after each query
b) explicitly commits transaction
c) does not commit transaction automatically after each query
d) never commits transaction

9-Which of the following is used to call stored procedure?


a) Statement
b) PreparedStatement
c) CallableStatment
d) CalledStatement

10-What must be the first characters of a database URL?

A. db,
B. db:
C. jdbc,
D. jdbc:
Explanation: All JDBC URLs begin with the protocol jdbc followed by a colon
as a delimiter.

11-Which of these obtains a Connection?

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

15-Transactions can be described with key properties:-


a) Atomicity
b) Consistency
c) Isolation
d) All of the mentioned

16- The term must be closed at the end of java program is

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

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 : 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

ANSWER: Bean-managed transactions

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

5) Abbreviate the term JMS?

a. Java Message Service


b. Java Monitor Service
c. Java Message Session
d. Java Monitor Session
ANSWER: Java Message Service

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. Stateful Session Bean


b. Stateless Session Bean
c. Singleton Session Bean
d. None of the above
ANSWER: Singleton Session Bean

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

c. server and client side component

d. None of the above

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

13) EJB is like COM, Abbreviate the term COM?


- Published on 20 Jul 15

a. Component Object Model

b. Component Oriented Model

c. Common Object Model

d. Common Oriented Model

ANSWER: Component Object Model

14) JMS is also known as a messaging service.


- Published on 17 Jul 15

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

16) What represents a persistent global data from the database?


- Published on 16 Jul 15

a. Entity Bean

b. Session Bean

c. Both A & B

d. None of the above

ANSWER: Entity Bean

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

c. server and client side component

d. None of the above

ANSWER: Server-side component

18) In EJB, middleware services are provided by EJB Container automatically.


- Published on 15 Jul 15

a. True

b. False

ANSWER: True

19) Which middleware services are provided by EJB?


- Published on 15 Jul 15

a. Security

b. Transaction Management
c. Both A & B

d. None of the above

ANSWER: Both A & B

20) Which server-side component is required to be deployed on the server?


- Published on 13 Jul 15

a. EJB

b. RMI

c. Both A & B

d. None of the above

ANSWER: EJB

21) How many types of session beans are available in EJB?


- Published on 13 Jul 15

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

d. None of the above

ANSWER: Message-Driven Bean

23) Which middleware services are provided by EJB?


- Published on 10 Jul 15
a. Security

b. Transaction Management

c. Both A & B

d. None of the above

ANSWER: 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. Stateful Session Bean

b. Stateless Session Bean

c. Singleton Session Bean

d. None of the above

ANSWER: Stateless Session Bean

25) EJB technology is built on the top of Socket Programming


- 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

26) Which of the following is true about message driven bean?

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.

C - This type of bean represents persistent data storage.


D - None of the above.

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.

27) Which of the following is true about stateless bean?

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.

C - Both of the above.

D - None of the above.

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.

28) Which of the following is correct about mappedName attribute in @javax.ejb.Stateless


annotation?

A - It is used to specify name of the session bean.

B - it is used to specify the JNDI name of the session bean.

C - It is used to provide description of the session bean.

D - None of the above.

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.

B - it is used to specify the interface type of the referenced bean.

C - It is used to provide name of the referenced bean.

D - It is used to specify the JNDI name of the referenced bean.


Answer : A
Explaination

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

@javax.ejb.Local annotation is used to specify Local interface(s) of a session bean.

31) Which of the following is correct about @PostActivate annotation for a callback method?

A - Method is invoked when a bean is created for the first time.

B - Method is invoked when a bean is removed from the bean pool or is destroyed.

C - Method is invoked when a bean is loaded to be used.

D - Method is invoked when a bean is put back to bean pool.

Answer : C
Explaination

@PostActivate - method is invoked when a bean is loaded to be used.

32) Which annotation is used to inject an datasource into an ejb?

A - @EJB

B - @Resource

C - Both of the above.

D - None of the above.

Answer : B
Explaination

@Resource annotation is used to inject an datasource into an ejb.


33) Which of the following types of java classes can be mapped using @Lob annotation?

A - byte[]

B - String

C - Serializable Object

D - All of the above.

Answer : D
Explaination

All of the above classes can be mapped using @Lob annotation.

34) Which of the following is correct about a Success attrribute of Bean Managed Transactions
in EJB?

A - When to start a transaction in a business method.

B - Identify success scenario when a transaction is to be committed.

C - Identify failure scenario when a transaction is to be rollback.

D - None of the above.

Answer : B
Explaination

Success - Identify success scenario when a transaction is to be committed.

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.

C - Both of the above

D - None of the above.

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.

36) How to specify autowiring by name?

Options
A : @Qualifier

B : @Type

C : @Constructor

D : @Name

View Answer

37) What does setAutoCommit(false) do?

Options

A : commits transaction after each query

B : explicitly commits transaction

C : does not commit transaction automatically after each query

D : never commits transaction

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

40) Which attribute is used to specify destroy method?

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 & Explanation

Answer: Option D

Explanation:

42. The EJB specification architecture does NOT define

A. transactional components

B. client side security and encryption

C. distributed object components

D. server-side components

View Answer

Workspace

Report

Discuss

Answer & Explanation

Answer: Option B

Explanation:

43. Which of the following is true?

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

C. Both are correct

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

D. All mentioned above

View Answer

Workspace

Report

Discuss

Answer & Explanation

Answer: Option C

Explanation:

45. Which statement about session beans is true?

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

D. None of the above

View Answer

Workspace

Report

Discuss

Answer & Explanation

Answer: Option C
Explanation:

46) Which of the following is correct about Statement class of JDBC?

A - Statement encapsulates an SQL statement which is passed to the database to be parsed


and compiled.

B - Statement encapsulates an SQL statement which is passed to the database to be planned


and executed.

C - Both of the above.

D - none of the above.

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

D - None of the above.

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?

A - JDBC-ODBC Bridge plus ODBC driver

B - Native-API, partly Java driver

C - JDBC-Net, pure Java driver

D - Native-protocol, pure Java driver

Answer : D
Explanation

Native-protocol, pure Java driver, uses database native protocol.


49) Which of the following is not a valid type of statement in JDBC?

A - Statement

B - PreparedStatement

C - CallableStatement

D - QueryStatement

Answer : D
Explanation

QueryStatement is not a valid type of statement in JDBC.

50) Which of the following is correct about PreparedStatement?

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.

C - Both of the above.

D - None of the above.

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.

B - It uses a default mapping for most data types.

C - Both of the above.

D - None of the above.

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.

B - components like Apache Commons DBCP Component can be used to configure


connection pooling.

C - Both of the above.

D - None of the above.

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.

55) Which of the following is correct about setFetchSize(int)?

A - setFetchSize(int) defines the number of rows that will be read from the database when the
ResultSet needs more rows.

B - setFetchSize(int) affects how the database returns the ResultSet data.

C - Both of the above.

D - None of the above.

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.

56) Which of the following is true about 'dirty read'?

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.

C - Both of the above.

D - None of the above.

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.

59) What are the major components of the JDBC?

DriverManager, Driver, Connection, Statement, and ResultSet

DriverManager, Driver, Connection, and Statement

DriverManager, Statement, and ResultSet

DriverManager, Connection, Statement, and ResultSet

Workspace

Answer: a

Explanation:

DriverManager: Manages a list of database drivers.

Driver: The database communications link, handling all communication with the database.

Connection: Interface with all methods for contacting a 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.

60) Select the packages in which JDBC classes are defined?

A. jdbc and javax.jdbc


B. rdb and javax.rdb
C. jdbc and java.jdbc.sql
D. sql and javax.sql

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.

61) Thin driver is also known as?

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.

63) What is the correct sequence to create a database connection?

i. Import JDBC packages.

2.7M

Hello Java Program for Beginners

ii. Open a connection to the database.

iii. Load and register the JDBC driver.

iv. Execute the statement object and return a query resultset.

v. Create a statement object to perform a query.

vi. Close the resultset and statement objects.

vii. Process the resultset.

viii. Close the connection.

a) i, ii, iii, v, iv, vii, viii, vi


b) i, iii, ii, v, iv, vii, vi, viii
c) ii, i, iii, iv, viii, vii, v, vi
d) i, iii, ii, iv, v, vi, vii, viii

Workspace

Answer: b

Explanation: To create a database connection in Java, we must follow the sequence given below:

Import JDBC packages.

Load and register the JDBC driver.

Open a connection to the database.


Create a statement object to perform a query.

Execute the statement object and return a query resultset.

Process the resultset.

Close the resultset and statement objects.

Close the connection.

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

Explanation: The following table defines transaction isolation levels.

Transaction Isolation Level Description

TRANSACTION_READ_UNCOMMITTED Dirty reads, non-repeatable reads, and phantom


reads can occur.

TRANSACTION_READ_COMMITTED Dirty reads are prevented; non-repeatable reads and


phantom reads can occur.

TRANSACTION_REPEATABLE_READ Dirty reads and non-repeatable reads are prevented;


phantom reads can occur.

TRANSACTION_SERIALIZABLE Dirty reads, non-repeatable reads, and phantom


reads are prevented.

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.

67) Which methods are required to load a database driver in JDBC?

a) getConnection()
b) registerDriver()
c) forName()
d) Both b and c

Answer: d

Explanation: There are two ways to load a database driver in JDBC:

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.

68) Parameterized queries can be executed by?

a) ParameterizedStatement
b) PreparedStatement
c) CallableStatement and Parameterized Statement
d) All kinds of Statements

Answer: b

Explanation: The PreparedStatement interface extends the Statement interface. It represents a


precompiled SQL statement that can be executed multiple times. It accepts parameterized SQL quires.
We can pass 0 or more parameters to this query.

69) Which of the following is not a valid statement in JDBC?

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.

CallableStatement: It is used to execute SQL stored procedures.

QueryStatement: It is not supported by JDBC.

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.

71) What does setAutoCommit(false) do?

a) It will not commit transactions automatically after each query.


b) It explicitly commits the transaction.
c) It never commits the transactions.
d) It does not commit transaction automatically after each query.

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.

72) Stored procedure can be called by using the ????..?

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?

a) Connection, Statements, and then ResultSet


b) ResultSet, Connection, and then Statements
c) Statements, ResultSet, and then Connection
d) ResultSet, Statements, and then Connection

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).

74) A good way to debug JDBC-related problems is to enable???..?

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.

76) JDBC-ODBC driver is also known as?

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.

77) Which of the following driver is the fastest one?

a) JDBC-ODBC Bridge Driver


b) Native API Partly Java Driver
c) Network Protocol Driver
d) JDBC Net Pure Java Driver

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.

78) Which of the following is not a type of ResultSet object?

a) TYPE_FORWARD_ONLY
b) CONCUR_WRITE_ONLY
c) TYPE_SCROLL_INSENSITIVE
d) TYPE_SCROLL_SENSITIVE

Answer: b

Explanation: There are three types of ResultSet object:

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.

Based on the concurrency there are two types of ResultSet object.

CONCUR_READ_ONLY: The ResultSet is read-only, this is the default concurrency type.

CONCUR_UPDATABLE: We can use the ResultSet update method to update the rows data.

79) What is JDBC Savepoint?

a) An intermediate or checkpoint in a transaction


b) A point where we can store queries
c) A point where the JDBC application starts execution
d) A memory where we can store transaction

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

Explanation: There are following stages in a JDBC program:

Register the driver

Connecting to a database

Preparing SQL statements in Java

Executing the SQL statements on the database

Retrieving the results

Closing the connection

81) Which of the following is the correct to register a JdbcOdbcDriver?

a) jdbc.odbc.JdbcOdbcDriver obj = new sun.jdbc.odbc.JdbcOdbcDriver();


b) odbc.JdbcOdbcDriver obj = new sun.odbc.JdbcOdbcDriver();
c) jdbc.JdbcOdbcDriver obj = new sun.jdbc.JdbcOdbcDriver();
d) jdbc.odbc.JdbcOdbc obj = new sun.jdbc.odbc.JdbcOdbc();

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:

sun.jdbc.odbc.JdbcOdbcDriver obj = new sun.jdbc.odbc.JdbcOdbcDriver();

82) How many ways to register a driver?

a) 2
b) 3
c) 4
d) 5

Answer: c

Explanation: There are four ways to register a driver:

1. By creating an object of the Driver For example:

sun.jdbc.odbc.JdbcOdbcDriver obj = new sun.jdbc.odbc.JdbcOdbcDriver();


2. By sending the driver class object to the registerDriver() method of the DriverManager class. For
example:

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");

4. By using the getProperty() method of the System class. For example:

String dname = System.getProperty("driver");

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:

c:\> java -Ddriver = driverclassname Programname

For example:

c:\> java -Ddriver = sun.jdbc.odbc.JdbcOdbcDriver MyProgram

83) Identify the DSN in the following statement:

a) DriverManager.getConnection("jdbc:odbc:oradsn", "scott", "tiger")


b) jdbc
c) odbc
d) scott
e) oradsn

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.?

a) getConnection("jdbc::thin@localhost:1521:oracle", "scott", "tiger");


b) getConnection("jdbc:thin@localhost:1521:oracle", "scott", "tiger");
c) getConnection("jdbc::thin@localhost:1522:oracle", "scott", "tiger");
d) getConnection("jdbc::oracle@localhost:1521:thin", "scott", "tiger");

Answer: a

Explanation: We use the following statement to connect Oracle database using the thin driver.

DriverManager.getConnection("jdbc::thin@localhost:1521:oracle", "scott", "tiger");


85) What are the types of ResultSet in JDBC?

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.

86) What is blob in the following statement?

create table profilepic(photo blob);

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.

88) DatabaseMetaData interface is used to get?????..?

a) Comprehensive information about the database as a whole.


b) Comprehensive information about the table as a whole.
c) Comprehensive information about the column as a whole.
d) Both b and c

Answer: a

Explanation: DatabaseMetaData is an interface that is used to get Comprehensive information about


the database as a whole. It is implemented by driver vendors to let users know the capabilities of a
DBMS in combination with the JDBC driver that is used with it.

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.

90) Are ResultSets updateable?

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.

92) How many statement objects can be created using a Connection?

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.

94) Which statement(s) is/ are true about transactions?

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.

95). Which of the following contains both date and 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.

96) Which of the following is advantage of using JDBC connection pool?


a) Slow performance
b) Using more memory
c) Using less memory
d) Better performance

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.

97) Which of the following is advantage of using PreparedStatement in Java?

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.

98) Which one of the following contains date information?

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.

99) What does setAutoCommit(false) do?

a) commits transaction after each query


b) explicitly commits transaction
c) does not commit transaction automatically after each query
d) never commits transaction

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.

100) Which of the following is used to call stored procedure?

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.

102) Which of the following is method of JDBC batch process?

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.

103) Which of the following is used to rollback a JDBC transaction?

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.

104) Which of the following is not a JDBC connection isolation levels?

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.

105) Which of the following is not an Enterprise Beans type?

a) Doubleton
b) Singleton
c) Stateful
d) Stateless
Answer: a
Explanation: Stateful, Stateless and Singleton are session beans.

106) Which of the following is not true about Java beans?

a) Implements java.io.Serializable interface


b) Extends java.io.Serializable class
c) Provides no argument constructor
d) Provides setter and getter methods for its properties
View Answer

Answer: b
Explanation: java.io.Serializable is not a class. Instead it is an interface. Hence it cannot be extended.

107) Which file separator should be used by MANIFEST file?

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.

109) Java Beans are extremely secured?

a) True
b) False

Answer: b
Explanation: JavaBeans do not add any security features to the Java platform.

110) Which of the following is not a feature of Beans?

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.

112) Which attribute is used to specify initialization method?

a) init
b) init-method
c) initialization
d) initialization-method

Answer: b
Explanation: init-method is used to specify the initialization method.

113) Which attribute is used to specify destroy method?

a) destroy
b) destroy-method
c) destruction
d) destruction-method

Answer: b
Explanation: destroy-method is used to specify the destruction method.

114) How to specify autowiring by name?

a) @Qualifier
b) @Type
c) @Constructor
d) @Name

Answer: a
Explanation: Differet beans of the same class are identified by name.
Servlet

1- The java _______ specification defines an application programming


interface for communication between the Web server and the application
program.
a. Program
b. Servlet
c. Randomise
d. Server
2- The life cycle of servlet is managed by
a. The supporting protocol (http & https)
b. Servlet context
c. Servlet itself
d. Servlet container

3-Which of the following is true about servlets?


a. execute within the address space of web server
b. platform-independent because they are written in java
c. use the full functionality of the Java class libraries
d. All of above
4- Which of the following package contains servlet classes?

javax.servlet
javax.servlet.http
Both of the above.
None of the above.

5- identify the disadvantages of CGI?

If clients increases more time for sending response


each request has process & Web server limited processes
It uses platform dependent language e.g. C, C++, perl
All mentioned above

6- Servlet technology is used to create web application


a. True
b. false
7- which lifecyle method is called once in servlet life cycle

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

response.encodeRedirectURL(url) encodes the specified URL for use in the sendRedirect


method or, if encoding is not needed, returns the URL unchanged.
Q 6 - Which of the following code can be used to add a header?
A - request.addHeader(name,value)
B - response.addDateHeader(name,value)
C - Header.addDateHeader(name,value)
D - None of the above.

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.

15. 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
a) i, ii, iii, vi
b) i, ii, iv, v
c) i, vi, iii, v
d) i, ii, iii, v

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.

20. Servlet are used to program which component in a web application?


a) client
b) server
c) tomcat
d) applet

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.

23. How does applet and servlet communicate?


a) HTTP
b) HTTPS
c) FTP
d) HTTP Tunneling

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

Q. 25 Servlet runs each request in a __________ ?


a. OS shell
b. JVM
c. Separate thread
d. JRE
Correct Answer : OPTION C, Separate thread.
Q. 26 GenericServlet class is encapsulated inside __________ package
a. java.lang
b. javax.servlet
c. java.servlet
d. javax.servlet.http
Correct Answer : OPTION B, javax.servlet
27. Which class provide implementation for service() method ?
a. GenericServlet
b. HttpServlet
c. Servlet
d. none of the above
Correct Answer : OPTION B, HttpServlet
28. _________ is responsible for managing execution of servlet

a. Web Container

b. Servlet Context

c. JVM

d. Server

Correct Answer : OPTION A, Web Container


29. When using HTML forms which of the following is true for POST method ? Select the one
correct answer.

a. POST allows users to bookmark URLs with parameters.


b. The POST method should not be used when large amount of data needs to be transferred.

c. POST method shows the send data in the URL.

d. POST method sends data in the body of the request.

Correct Answer : OPTION D, POST method sends data in the body of the request
30. Q. Deployment Descriptor(DD) is a _________ .

a. Servlet used to maintain other servlet.

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

Correct Answer : OPTION A, True


32. Q. Which method is called only once in Servlet life cycle ?

a. service()

b. initialize()

c. init()

d. all of the above

Correct Answer : OPTION C, init()


33. Q. Which of the following is not a valid HTTP/1.1 method. Select the correct answer.

a. CONNECT method

b. COMPARE method

c. OPTIONS method

d. TRACE method

Correct Answer : OPTION B, COMPARE method


34. Which of these classes define the getWriter() method that returns an object of type
PrintWriter ? Select the one correct answer. ?

a. HttpServletRequest

b. HttpServletResponse

c. ServletConfig

d. ServletContext

Correct Answer : OPTION B


Q.35 Which method defined in the HttpServletResponse may be used to set the content type ?
a. setType()
b. setContent()
c. setContentType()
d. setResponseContentType()
Correct Answer : OPTION C
36. Q. Which method of HttpServletResponse is used to redirect an HTTP request to another
URL ?

a. sendURL()

b. redirectURL()

c. sendRedirect()

d. getRequestDispatcher()

Correct Answer : OPTION C


37. Q. Given request is a HttpServletRequest object, which gets a binary input stream ?

a. BinaryInputStream s = request.getInputStream();

b. ServletInputStream s = request.getInputStream();

c. BinaryInputStream s = request.getBinaryStream();

d. ServletInputStream s = request.getInputStream();

Correct Answer : OPTION B


38. Q. Which method defined in the HttpServletRequest returns the object of RequestDispatcher
?

A. getRequestDispatcher()
b. getDispatcher()

c. getRequest()

d. requestDispatcher()

Correct Answer : OPTION A


39. Q. Which statement is true about include() method of RequestDispatcher interface ?

a. forwards a request from a servlet to another resource on the server.

b. includes the content of any resource inside the current servlet.

c. includes the content of only servlet inside the current servlet

d.None

Correct Answer : OPTION B


40. Which method of HttpServletRequest returns the name of the HTTP method with which the
request was made ?

a. getRequestMethod()

b. getHttpMethod()

c. getHttpRequestMethod()

d. getMethod()

Correct Answer : OPTION D


41. Q. When the Web Container initializes a servlet, it creates a ___________ object for the
servlet ?

a. ServletConfig

b. ServletInit

c. ServletContext

d. None of the above

Correct Answer : OPTION A


42. ____________ object is available to any servlet or JSPs that are part of the web app and
provides communication between servlets and JSPs.

a. Servlet

b. ServletConfig
c. ServletContext

d. HttpServletContext

Correct Answer : OPTION C

43. Q. Which types of objects can store attributes ?

a. ServletConfig

b. ServletResponse

c. RequestDispatcher

d. HttpServletRequest

Correct Answer : OPTION D


44. . If the client has disabled cookie in the browser, which session management mechanism
could the web container employ ?

a. Session Management using Cookies

b. Session Management using URL rewriting

c. Either Cookies or URL rewriting

d. Cookies and URL rewriting must be used together

Correct Answer : OPTION B


45. Which statement about HttpSession is not true?

a. HttpSession object is used to store entire session with a specific client

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

d. Attribute can be stored, retrieved and removed from HttpSession object

Correct Answer : OPTION C


46. Q. Given request is an HttpServletRequest, which code snippets will creates a session if one
doesn't exist?

a. request.getSession(false);

b. request.createSession();

c. request.getNewSession();
d. request.getSession();

Correct Answer : OPTION D


47. Q. Which method is used access the cookies that are added to response object?

a. getCookies()

b. getNewCookies();

c. cookies();

d. returnCookies();

Correct Answer : OPTION A


48. Q. Which method is used to get the parameter value from request object?

a. getParameterValue()

b. getParameter()

c. getValue()

d. requestParameter()

Correct Answer : OPTION B


49. Q. Which statement is true for request.getSession(true) method?

a. if session already exist, it return the existing session else create a new session

b. getSession(true) method always returns a new session

c. getSession(true) method always returns a pre existing session

d.none

Correct Answer : OPTION B


50. Q Which method returns a string containing the unique session id?

a. getSessionId()

b. getUniqueId()

c. getUniqueSessionId()

d. getId()

Correct Answer : OPTION D


51. Q. Cookies are stored on _______ side.
a. Client

b. Server

Correct Answer : OPTION A


52. Q. Which method is used to delete a session?

a. invalidateSession()

b. invalidate()

c. deleteSession()

d. delete()

Correct Answer : OPTION B


53. Q. Which method returns the time when the session was created?

a. getCreationTime()

b. getTime()

c. getStartingTime()

d. creationTime()

Correct Answer : OPTION A


54.What are the jobs of web-server? choose multiple answers.

a.Get the resources

b.Find the resources

c.Return the requested thing to user

d.Get the Request

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?

a.can be one physical machine

b.can be software

c.can be hardware

d.non of these

Ans:a,b,c

57.Which of the following protocol is used for web page browsing ?

a.https

b.http

c.ftp

d.none of these

Ans:a,b

58.Which html tag can be used to send the request to servlet?

a.<action>

b.<form>

c.<input>

d.all of these

Ans:b

59.Which statements are true about http protocol?

a.Runs on top of Tcp/IP

b.It has web specific feature

c.Web server processes http request

d.But it is not IETF standard

Ans:a,b,c

60.Html is part of httprequest, Is it true or false?


a.true

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

63.How to send data in get method?

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?

a.By comma separator

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

66.What is full form of MIME type?

a.Mail Interface Multiple Extension

b.Mail Internet Multiple Extension

c.Multiple Internet Mail Extension

d.Multiple Interface Mail Extension

Ans:c

67.Which of these are MIME types?

a.application/java

b.image/bmp

c.text/html

d.text/css

e.text/plain

Ans:all

68.What is true about MIME type?

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

69.What is the nature of HTML page ?

a.dynamic

b.static

c.both dynamic and static

d.none of these

Ans:b

70.Which of these are webserver?

a.Internet Information Services (IIS)

b.tomcat

c.Lighttpd

d.nginx

e.glassfish

Ans:a,b,c,d

71.Which of these is not a Application Server?

a.JBoss

b.JRun

c.WebLogic Server(BEA)

d.Apache HTTP Server

e.GlassFish

Ans:d

72.Web server serves only static page, tru or false?

a.true
b.false

Ans:a

73.Which tag doesn't belongs to web.xml?

a.web-app

b.welcome-file-list

c.servlet

d.servlet-mappings

Ans:d

JSP MCQ
1) JSP stands for ___.

A. Java Server Pages

B. Java Side Pages

C. Java Server Phase

D. All of the above

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

D. None of the above

Ans:A
3) Which of the following is the correct syntax to declare comments in JSP?

A. <%-- This is JSP comment --%>

B. <!-- This is JSP comment -->

C. //..

D. All of the above

Ans:A

4) Which of the following is not a directive?

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

D. None of the above

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

7) A JSP page consists of which tags?

A. HTML tags

B. JSP tags

C. Both A & B

D. None of the above

Ans:C

8) Which packages does a JSP API consist of?

A. javax.servlet.jsp

B. java.servlet

C. javax.servlet.jsp.tagext

D. Both A & C

Ans:D

9) JDBC stands for __.

A. Java Database Connectivity

B. Jar Database Connectivity

C. Java Database Content

D. None of the above

Ans:A

10) Is JSP technology extensible?

A. True

B. False

Ans:A

11) Which of the following is true about tag?


A. The <c:redirect > tag redirects the browser to an alternate URL by providing automatically
URL rewriting.

B. The <c:redirect > tag supports context-relative URLs.

C. The <c:redirect > tag supports <c:param> tag.

D. All of the above

Ans:D

12) What are the advantages of JSP?

A. platform independent

B. good performance and scalability

C. easily maintained

D. All of the above

Ans:D

13) What is the use of tag?

A. to catch any Throwable that occurs in its body and optionally exposes it.

B. to catch the runtime error and redirect to error page.

C. Both of the above.

D. None of the above.

Ans:A

14) Compilation process of JSP page involves:

A. Parsing of JSP

B. Turning JSP into servlet

C. Compiling the servlet

D. All of the above

Ans D

15) What is the use of tag?


A. It removes a item from a list

B. It removes the data row from the database.

C. It removes a variable from either a specified scope or the first scope where the variable is
found.

D. None of the above

Ans:C

16) What is the synatx of JSP Page directive?

A. <%@ page…%>

B. <% page…%>

C. <!@ page…!>

D. None of the above

Ans:A

17) Which syntax is used to defines the programming language (underlying language) being used
in the JSP?

A. <%@ page language="value" %>

B. <!@ page language="value" !>

C. <@ page language="value" >

D. None of the above

Ans:A

18) What JSTL stands for?

A. JSP Tag Library

B. JavaServer Pages Standard Tag Library

C. Java Standard Tag Library

D. None of the above.

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

D. None of the above

Ans:A

20) Which of the following is true about action?

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.

B. useBean is used to load java beans in jsp page.

C. Both of the above.

D. None of the above

Ans:C

21) Which one of the following is a syntax to create a simple JSP?

A. <html> <body> <% out.print(2*5); %> </body> </html>

B. <html> <body> <! out.print(2*5); !> </body> </html>

C. <html> <body> <%@ out.print(2*5); %> </body> </html>

Ans:A

D. None of the above

22) Application is instance of which class?

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?

A. Using <%jsp:param> tag

B. Using <%jsp:page> tag

C. Using <%jsp:useBean> tag

D. Using <%jsp:import> tag

Ans:B

24) Which option is true about session scope?

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

25) Default value of autoFlush attribute is?

A. True

B. False

Ans:A

26) Which one is the correct order of phases in JSP life cycle?

A. Compilation, Initialization, Execution, Cleanup

B. Cleanup, Compilation, Initialization, Execution

C. Initialization, Cleanup, Compilation, Execution

D. Initialization, Compilation, Cleanup, Execution

Ans:A

27) Request is instance of which one of the following classes in jsp:

A. ServletRequest

B. HttpServletRequest
C. Request

D. HttpRequest

Ans :B

28) Which is mandatory in tag?

A. id, type

B. type, property

C. type,id

D. id, class

Ans:D

29) The difference between Servlets and JSP is:

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

D. All of the above

Ans:B

Q31)_jspService() method of HttpJspPage class should not be overridden.

A - True

B - False
Answer : A
Explaination
JSP container creates _jspService() methods so it should not be overridden.

32) Which of the following is a server side technology?

A - html

B - jsp

C - javaScript

D - css

Answer : B
Explaination
jsp is a server side technology.

33)All jsp pages are required to be mapped and configured in web.xml.

A - True

B - False

Answer : B
Explaination
No, Jsp pages are not required to be mapped/configured in web.xml

34) isErrorPage is by default true.

A - True

B - False

Answer : B
Explaination
isErrorPage is required to be set true, it is false by default.

Q35)pageContext is instance of which class?

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.

36)What is default value of isELIgnored Attribute?

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.

37) Which of the following is true about isELIgnored Attribute?

A - The isELIgnored option gives you the ability to disable the evaluation of Expression
Language (EL) expressions.

B - The default value of the isELIgnored attribute is true.

C - Both of the above.

D - None of the above.

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.

B - Container invokes _jspService() method during Initialization phase.

C - Both of the above.

D - None of the above.


Answer : A
Explaination
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.

40) What is the use of <c:remove > tag?

A - It removes a item from a list

B - it removes the data row from the database.

C - It removes a variable from either a specified scope or the first scope where the variable is
found

D - None of the above.

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?

1. JSP technology is used to create web application.

2. The JSP pages are not easier to maintain than Servlet.

3. JSP page consists of HTML tags and JSP tags.

A.1 & 2

B.1 & 3

C.2 & 3

D.All of the above


Explanation
Correct Option :B.
42) Which of the following are the life cycle method of jsp?

A.jspInit()

B._jspService()

C.jspDestroy()

D.All of the above

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?

1. JSP page is translated into Servlet.

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

5. Compilation of JSP Page

6. Destroy

7. Translation of JSP Page

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

D.JSP include directive

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

D.All of the above

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

D.All of the above

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

D.All of the above

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

D.all of the above

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

D.All of the above

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

D.All of the above

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

D.All of the above

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

D.All of the above

E.Only A & B

Explanation
Correct Option :D.
All of the above is the correct answer

65)<%@ include ... %>


This jsp element helps to:

A.Includes a file during the translation phase

B.Includes plugins during the translation phase

C.Declares a tag library, containing custom actions, used in the page

D.there is no such jsp element available

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

B.Declare scripting language

C.Declare error page

D.All of the above

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

68)element in jsp is used to:

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

C.Includes a file during the translation phase

D.All of the above

E.Only A & B

Explanation
Correct Option :E.
Only A & B is the correct answer
69)jsp element is used to:

A.Forwards the processing of a request to a servlet or JSP page

B.Forwards the processing of a request to a third party plugins

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

73)<%! ... %>


above jsp element is known as:

A.scriptlet

B.expression

C.declaration

D.beans

E.taglib

Explanation
Correct Option :C.
declaration is the correct answer

74)Which of the following is not correct statement related to jsp?

A.A JSP page cannot be sent as-is to the browser

B.A JSP page can be sent as-is to the browser

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

76)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

E.Page, Request, Session, Application, Response, Global-Session

Explanation
Correct Option :C.
Page, Request, Session, Application is the correct answer

77)Which page directive should be used in JSP to generate a PDF page?

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()

3- _jspService() method of HttpJspPage class should not be overridden.


True
False

4-“request” is instance of which one of the following classes?


Request
HttpRequest
HttpServletRequest
ServletRequest

5-Which is not a directive?


include
page
export
useBean

6-Which is mandatory in <jsp:useBean /> tag?


id, class
id, type
type, property
type,id

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

8-Which tag is used to execute java source code in JSP?


Declaration Tag
Scriptlet tag
Expression tag
None of the above

9-Which one of the following is correct for directive in JSP?


<%@directive%>
<%!directive%>
<%directive%>
<%=directive%>

10-Java code is embedded under which tag in JSP?


Declaration
Scriptlet
Expression
Comment
11-The ASP and JSP technologies are quite similar in the way they support the
creation of Dynamic pages, using HTML templates, scripting code and
components for business logic.
True
False

12-Which two interfaces does the javax.servlet.jsp package have?


JspPage
HttpJspPage
JspWriter
PageContext
Both A & B

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

15-A JSP page consists of which tags?


HTML tags
JSP tags
Both A & B
None of the above

16-Which packages does a JSP API consist of?


javax.servlet.jsp
java.servlet
javax.servlet.jsp.tagext
Both A & C

17-For what JSP is used?


Server-side dynamic content generation
Client Side language for validation

18-What is full form of JSTL?


JSP Tag Library
JavaServer Pages Standard Tag Library
Java Standard Tag Library
None of the above.
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
WEB TECHNOLOGY

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

2- What is a web browser?


a) a program that can display a web page
b) a program used to view html documents
c) it enables user to access the resources of internet
d) all of the mentioned

Ans- d) all of the mentioned

3-________ is known as father of WWW.


a) John T. Thomson
b) Denis Ritchie
c) Tim Berners-Lee
d) None of above

Ans- c)Tim Berners-Lee

4- On which one of the following dates World Wide Web was invented?
a)1972
b)1989
c)1986
d)1930

Ans- b)1989

5- A web cookie is a small piece of data that is _______


a) sent from a website and stored in user’s web browser while a user is browsing a website
b) sent from user and stored in the server while a user is browsing a website
c) sent from root server to all servers
d) sent from the root server to other root servers
Ans- a) sent from a website and stored in user’s web browser while a user is browsing a
website

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

7- 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) i, ii, iii

8- World Wide Web


a) is another name for internet
b) world wide connection for computers
c) a collection of linked information residing on computers connected by the internet
d) a collection of world wide information

Ans- c) a collection of linked information residing on computers connected by the internet

9- A world wide web contains web pages


a) residing in many computers
b) created using HTML
c) with links to other web pages
d) residing in many computers linked together using HTML

Ans- d) residing in many computers linked together using HTML


10- A web page is located using a
a) Universal Record Linking
b) Uniform Resource Locator
c) Universal Record Locator
d) Uniformly Reachable Links

Ans- b) Uniform Resource Locator

11- Which of the following allows user to view a webpage?


a) Operating System
b) Website
c) Interpreter
d) Internet Browser

Ans- d) Internet Browser

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

14- The communication protocol used by internet is


a)HTTP
b)WWW
c)TCP/IP
d)FTP

Ans- c) TCP/IP

15- Which of the following is called as protocol in the URL?

http://www.c4learn.com

a) c4learn
b) www
c) http
d) .com

Ans- c) http

16- A simple protocol used for fetching e-mail from a mailbox is


a) POP2
b) POP3
c) IMAP
d) None of the above

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- d) all of the above

18- What protocol is used between E-Mail servers?


a) FTP
b) SMTP
c) SNMP
d) POP3

Ans- b) SMTP

19- During error reporting, ICMP always reports error messages to


a)Source
b)Destination
c)Station
d)Header

Ans- a) Source

20- The File Transfer Protocol is built on ______________


a) data centric architecture
b) service oriented architecture
c) client server architecture
d) connection oriented architecture

Ans- c) client server architecture


21- The FTP protocol is used to __________?
a) Transfer data over the internet
b) Exchange files over the internet
c) Transfer text message over the internet
d) All of the above

Ans- b) Exchange files over the internet

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

Ans- c) Both upload and download

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

24- FTP is built on _____ architecture.


a)Client- Server
b)P2P
c)Both of the above
d)None of the above

Ans- a) Client- Server

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

26- W3C stands for


a) World Wide Web Consortium
b) World Wide Web Collaboration
c) World Wide Web Community
d) None of the mentioned

Ans- a) World Wide Web Consortium

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

a) v, i, iv, vi, ii, iii


b) v, ii, vi, iv, i, iii
c) v, ii, iv, vi, i, iii
d) vi, ii, iv, v, i, iii

Ans- c) v, ii, iv, vi, i, iii

28- DNS is used to resolve host names to IP addresses and find services.
a) True
b) False

Ans- a) True

29- Intranet and Extranet differs at ___________________________.


a) Intranet: Private , Extranet: Public
b) Intranet: Public, Extranet: Public
c) Intranet: Private, Extranet: Private and also allowed authorized partners
d) Intranet: Public, Extranet: Private

Ans- c) Intranet: Private, Extranet: Private and also allowed authorized partners

30- _____________ is a subset of the website.


a)Web Site
b) Web Space
c) Web Portal
d) None of above

Ans- c) Web Portal

31- An extranet is which of the following?


a) The use of Internet protocols with limited access to company data by the company's
customers and suppliers.
b) The use of Internet protocols with unlimited access to company data by the company's
customers and suppliers.
c) The use of Internet protocols with limited access to company data by people within an
organization.
d) The use of Internet protocols with unlimited access to company data by people within an
organization.

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

Ans- c) Completely Static Website

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- c) Static Website

34- In HTTPS ‘S’ is stands for:


a) Simple
b) Secured
c) Server
d) None of these

Ans- b) secured
35- Which protocol is used for browsing website
a)TCP
b) HTTP
c) FTP
d) TFTP

Ans- b) HTTP

36- Which protocol use to transmit information on the WWW


a) HTPP
b) HPPT
c) HTTTP
d) 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

Ans- d) all of the above

40- Some Abbreviations:


a) ISP – Internet Service Provider
b) TCP- Transmission Control Protocol
c) IP- Internet Protocol
d) SMTP- Simple Mail Transfer Protocol
e) POP- Post Office Protocol
f) IMAP- Internet Message Access Protocol
g) HTTP- Hyper Text Transfer Protocol
h) ICMP- Internet Control Message Protocol
i) FTP- File Transfer Protocol
j) URL-Uniform Resource Locator
k) DNS- Domain Name System
l) UI- User Interface
m) UX- User eXperience
n) MIME- Multipurpose Internet Mail Extension
o) W3C- World Wide Web Consortium
p) JDK- Java Development Kit
q) JRE- Java Runtime Environment
r) JVM- Java Virtual Machine
s) JIT- Just-in Time
t) AWT- Abstract Window Toolkit
u) JAR- Java ARchive
41- Which of the following is not a Java features?
a) Dynamic
b) Architecture Neutral
c) Use of pointers
d) Object-oriented

Ans- c) Use of pointers

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

44- Which component is responsible to run java program?


a) JVM
b) JDK
c) JIT
d) JRE

Ans- a) JRE

45- Which statement is true about java?


a) Platform independent programming language
b) Platform dependent programming language
c) Code dependent programming language
d) Sequence dependent programming language
Ans- a) Platform independent programming language

46- Which of the below is invalid identifier with the main method?
a) public
b) static
c) private
d) final

Ans- c) private

47- What is the extension of java code files?


a) .class
b) .java
c) .txt
d) .js

Ans- b) .java

48- What is the extension of compiled java classes?


a) .class
b) .java
c) .txt
d) .js

Ans- a) .class

49- What is use of interpreter?


a) They convert bytecode to machine language code
b) They read high level code and execute them
c) They are intermediated between JIT and JVM
d) It is a synonym for JIT

Ans- b) They read high level code and execute them

50- Which of the following is not OOPS concept in Java?


a) Inheritance
b) Encapsulation
c) Polymorphism
d) Compilation

Ans- d) Compilation

51- Which of the following is a type of polymorphism in Java?


a) Compile time polymorphism
b) Execution time polymorphism
c) Multiple polymorphism
d) Multilevel polymorphism

Ans- a) Compile time polymorphism


Explanation: There are two types of polymorphism in Java. Compile time polymorphism
(overloading) and runtime polymorphism (overriding).

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

53- Which of these values can a boolean variable contain?


a) True & False
b) 0 & 1
c) Any integer value
d) true

Ans- a) True & False

54- Which one is a valid declaration of a Boolean?


a) boolean b1 = 1;
b) boolean b2 = ‘false’;
c) boolean b3 = false;
d) boolean b4 = ‘true’
Ans- c) Boolean b3 = false;

55- Which of these is an incorrect array declaration?


a) int arr[] = new int[5]
b) int [] arr = new int[5]
c) int arr[] = new int[5]
d) int arr[] = int [5] new

Ans- d) int arr[] = int [5] new

56- What is the stored in the object obj in following lines of Java code?

box obj;

a)Memory address of allocated memory of object


b) NULL
c) Any arbitrary pointer
d) Garbage

Ans- b) NULL

57- Which of the following is a valid declaration of an object of class Box?


a) Box obj = new Box();
b) Box obj = new Box;
c) obj = new Box();
d) new Box obj;

Ans- a) Box obj = new Box();

58- Which of these operators is used to allocate memory for an object?


a) malloc
b) alloc
c) new
d) give

Ans- c) new

59- Which of the following statements is correct?


a) Public method is accessible to all other classes in the hierarchy
b) Public method is accessible only to subclasses of its parent class
c) Public method can only be called by object of its class
d) Public method can be accessed by calling object of the public class

Ans- a) Public method is accessible to all other classes in the hierarchy

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

61- Which of these keywords are used to define an abstract class?


a) abst
b) abstract
c) Abstract
d) abstract class

Ans- b) abstract

62- Which of these class is superclass of every class in Java?


a) String class
b) Object class
c) Abstract class
d) ArrayList class

Ans- b) Object class

63- Which of this keyword must be used to inherit a class?


a) super
b) this
c) extent
d) extends

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

65- Which of these is correct way of inheriting class A by class B?


a) class B + class A {}
b) class B inherits class A {}
c) class B extends A {}
d) class B extends class A {}

Ans- c) class B extends A {}

66- What is not type of inheritance?


a) Single inheritance
b) Double inheritance
c) Hierarchical inheritance
d) Multiple inheritance

Ans- b) Double inheritance

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

68- All classes in Java are inherited from which class?


a) java.lang.class
b) java.class.inherited
c) java.class.object
d) java.lang.Object

Ans- d) java.lang.Object

69- Static members are not inherited to subclass.


a) True
b) False

Ans- b) False

70- Which of these keywords is used to define packages in Java?


a) pkg
b) Pkg
c) package
d) Package

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- c) import pkg.*

73- Which of these keywords is used to define interfaces in Java?


a) interface
b) Interface
c) intf
d) Intf

Ans- a) interface

74- Which of these access specifiers can be used for an interface?


a) Public
b) Protected
c) private
d) All of the mentioned

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- b) class B implements A{}

76- What does an interface contain?


a) Method definition
b) Method declaration
c) Method declaration and definition
d) Method name
Ans- b) Method declaration

77- When does Exceptions in Java arises in code sequence?


a) Run Time
b) Compilation Time
c) Can Occur Any Time
d) None of the mentioned

Ans- a) Run Time

78- Which of these keywords is not a part of exception handling?


a) try
b) finally
c) thrown
d) catch

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

80- What is the use of try & catch?


a) It allows us to manually handle the exception
b) It allows to fix errors
c) It prevents automatic terminating of the program in cases when an exception occurs
d) All of the mentioned

Ans- d) All of the mentioned

81- Which of these method is used to implement Runnable interface?


a) stop()
b) run()
c) runThread()
d) stopThread()

Ans- b) run()

82- Which of these method is used to begin the execution of a thread?


a) run()
b) start()
c) runThread()
d) startThread()

Ans- b) start()

83- What is multithreaded programming?


a) It’s a process in which two different processes run simultaneously
b) It’s a process in which two or more parts of same process run simultaneously
c) It’s a process in which many different process are able to access same information
d) It’s a process in which a single process can access information from many sources

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

86- Which of these class is used to read from byte array?


a) InputStream
b) BufferedInputStream
c) ArrayInputStream
d) ByteArrayInputStream

Ans- d) ByteArrayInputStream

87-An applet is a Java class that extends the?


a) java.Applet class
b) java class
c) Applet class
d) java.applet.Applet class

Ans- d) java.applet.Applet class


88- Applets are designed to be embedded within an __________.
a) Javascript
b) Css
c) HTML
d) SQL

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?

a)<applet class=Test width=200 height=100>


</applet>

b) <applet>
code=Test.class width=200 height=100>
</applet>

c) <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

Ans- a) An event is an object that describes a state change in a source

94- What is a listener in context to event handling?


a) A listener is a variable that is notified when an event occurs
b) A listener is a object that is notified when an event occurs
c) A listener is a method that is notified when an event occurs
d) None of the mentioned

Ans- b) A listener is a object that is notified when an event occurs

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

98- Which of these package is used for graphical user interface?


a) java.applet
b) java.awt
c) java.awt.image
d) java.io

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

Ans- c) Heap memory

100- Which of the following is false?


a)The rt.jar stands for the runtime jar
b)It is an optional jar file
c)It contains all the compiled class files
d)All the classes available in rt.jar is known to the JVM

Ans- b) It is an optional jar file


UNIT-2
1. Which attribute specifies a unique alphanumeric identifier to be associated with an element?
a) class
b) id
c) article
d) html

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.

7. Which element contains definition?


a) <dl>
b) <dd>
c) <dt>
d) <ul>

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.

8.. Which of the following can’t be the value of list-style-type?


a) square
b) circle
c) ellipse
d) disc

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.

9.For displaying a list horizontally, we can use ______________


a) <dd>
b) display:inline
c) <dt>
d) type

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.

10.Which element was designed for creating multicolumn directory lists?


a) menu
b) dir
c) ul
d) ol

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.

11. Which element is restricted to inline content?


a) <dt>
b) <dd>
c) <ul>
d) <dl>
Answer: a
Explanation: <dt> element is restricted to inline content. In creation of a definition list the term is
given by <dt> element. <dd> element contains block-level content. The description is given by <dd>
element. <dl> is also used for marking up the dialogues.

12.The content property does not include __________


a) Strings
b) URIs
c) Normal
d) Color

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.

13. Each cell of the table can be represented by using __________


a) <tr>
b) <td>
c) <th>
d) <thead>

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.

14.For heading we can use ____________


a) <td>
b) <tr>
c) <thead>
d) <th>

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.

15.Headings of table lies inside ___________


a) <thead>
b) <tfoot>
c) <th>
d) <tbody>

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.

18. Borders can’t be applied on ________________


a) <th>
b) <td>
c) <tr>
d) <thead>

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; }

tfoot tr:last-child td{border-bottom: 9 px;}

19. Which of the following does not specify a column width?


a) Fixed
b) Percentage
c) Proportional
d) Pixels

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.

20.Which of the following is not the value for align attribute?


a) justify
b) char
c) middle
d) left

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.

21.valign attribute does not take the value __________________


a) justify
b) middle
c) baseline
d) bottom

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>

(c) <img src=“https://bit.ly/2FicgIx” alt=“Geeksforgeeks”>

(d) <image src=“https://bit.ly/2FicgIx” alt=“Geeksforgeeks”></image>

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

<img src=”apple.jpg” alt=”This is an apple, It is red” title=”apple”/>

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.

24.For caption of the image we use ____________

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

<figure> <img src=”sea.jpg” alt=”Photograph of the sea”> <br/>

<figurecaption> Sea is holding hands </figurecaption> </figure>

Name/title of HTML document is given by <title></title> tag.

25.Metadata does not define _________

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>.

26. Which element defines preformatted text?

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 ____________

a) link other pages within the same site

b) link the same page with other sites

c) link other pages with other sites

d) does not link

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?

a) <img src= “pic.jpg”>

b) <img src= “../pic.jpg”>

c) <img src= “images/pic.jpg”>

d) <img src= “/images/pic.jpg”>

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.

30. For defining bookmarks in a page we use __________

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.

31. In CSS, h1 can be called as _______

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.

33.In css, “color:red” can be called as _____________

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

d) both class and tag

Answer: a

Explanation: For binding a particular unique element, id selectors are used. While for group of
elements, class selector can be used.

35.Which of the following tag is used to embed css in html page?

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

41.“font-style comes first than font-weight in font attribute”.State true or false.


a) True
b) False
Answer: b
Explanation: Syntax:
font: font-weight font-style font-variant font-size/line-height font-family .

42. What will be the output of following code snippet?

h1 {color: red text-decoration: underline; font-style: italic;}

a) color: red, text-decoration: underline and font-style: italic all works

b) text-decoration: underline and font-style: italic works

c) color: red, text-decoration: underline works

d) only font-style: italic works

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.

43.What will be the output of below mentioned code snippet?

h1 {color: "green";}

a) heading becomes green

b) heading becomes dark-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

within the head of the document.

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.

47.Which of the following is not an Absolute Unit?

a) px

b) em

c) pt

d) mm

Answer: b

Explanation: em is a Relative Unit

48.Which of the following element is used for linking a External Files to the html page?

a) <script>

b) <style>

c) <link>

d) all of the above

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.

51.What is true about XML Schema?

A. It is used to describe and validate the structure and the content of XML data.

B. XML schema defines the elements, attributes and data types.

C. It is similar to a database schema that describes the data in a database.

D. All of the above


Ans : D

Explanation: All of the above statement are true.

52.XML Schema is commonly known as ?

A. XZD

B. XAS

C. XSD

D. XFD

Ans : C

Explanation: XML Schema is commonly known as XML Schema Definition (XSD)

53.How is everything treated in HTML DOM?

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:

● The document itself is a document node.


● All HTML elements are element nodes.
● All HTML attributes are attribute nodes.
● Text inside HTML elements are text nodes.
● Comments are comment nodes.

54.How are the objects organized in the HTML DOM?


a) Class-wise

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.

55.Which of the following is a type of HTML DOM?

a) Legacy DOM

b) W3C DOM

c) IE4 DOM

d) All of the mentioned

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.

56.Which object is the top of the hierarchy?

a) Window Object

b) Document Object

c) Form Object

d) Form Control Elements


Answer: a

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.

57.What is the purpose of the Legacy DOM?

a) Makes the scripting easier

b) Allows access to few keys and elements

c) Modify the nodes

d) Making the script modular

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

b) Attributes don’t have attributes

c) Attributes have attributes

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) The domain name and IP address


B) Host address and Domain name
C) Domain name and server address
D) Server name and IP address

Answer- A) Domain name and IP address

60. How many standard color names does HTML supports?

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.

61.Which of the following is not set with font-style property?

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.

63.Which works similar to <i> element?

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.

<p><strong>Dog is</strong> an animal.</p>

Output: Dog is an animal.

65.Which element is used for abbreviation or acronym?

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>

Output: The Dr. is on the way.

66. What is the work of <address> element?

a) contains contact details for author

b) contains IP address

c) contains home 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

67.10. To show deleted text, which element is used?

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.

<p>This is <del>not</del> for deletion </p>

Output: This is not for deletion.

68.How <bdo> element works?

a) override text direction

b) stops writing in the current text direction

c) only override direction of rtl text


d) only changes the direction of ltr text

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.

69.For smaller text which element is used?

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.

<p>This is text in <small>small</small>.</p>

Output: This is text in small.

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.

72.how can you make an e-mail link?

a. <a href=”xxx@yyy”>
b. <mail href=”xxx@yyy”>
c. <mail>xxx@yyy</mail>
d. <a href=”mailto:xxx@yyy”>
Answer: d

73. In which part of the HTML metadata is contained?

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.

74.What is the role of charset attribute? It specifies

a) a scheme to be used to interpret the value of the content attribute

b) a name for the metadata

c) the character encoding for the HTML document

d) the character decoding for the HTML document

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.

75.Which of the following is not supported in HTML5?

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.

78.In OSI model USB lies under the layer ___________

a) data Link layer

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.

79. IP is used in the level ___________

a) presentation layer

b) network layer

c) application layer

d) data Link 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.

81.Which header field defines meta information?

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.

82.Which of the following is not the request method?

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

84. Which of the following is not a request-header field?

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.

85. Which of the following is not a response-header field?

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.

86.Protocols are set of rules to govern _________

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.

88. What is the correct syntax of doctype in HTML5?

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?

a) Browser finds the document in quirky mode

b) Browser finds a document in standard mode


c) Browser stops working

d) Browser crashes after showing the page

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.

90. Which tag supports Non-English language?

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.

91. Which element was not removed by HTML5?

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”.

92.Which of the following is not a type of attribute for input tag?

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

Explanation: Scripts are re-enabled by allow-scripts. Allow-forms re-enables from submission.


Allow-same-origin allows iframe content to be treated as being from the same origin. API’s are
re-enable by allow-pointer-lock.

97.Which of the following defines a group of related options in a drop-down list?

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.

99. Which of the following prints bold letters in traditional HTML?

i. <B>Go boldly</B>

ii. <B>Go boldly</b>

iii. <b>Go boldly</B>

iv. <b>Go boldly</b>

a) iv

b) i

c) i, ii, iii, and iv

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.

100. XHTML is case insensitive and HTML is case sensitive.


a) True

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)

Q 1 - Which of the following is correct about JavaScript?

A - JavaScript is a lightweight, interpreted programming language.

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.

D - All of the above.

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 User's machine running a Web browser

B. The Web server

C. A central machine deep within Netscape's corporate offices

D. None of the above

Q6. What should appear at the very end of your JavaScript?

The <script type="text/JavaScript">tag

A. The </script>

B. The <script>

C. The END statement

D. None of the above

Q7. Which of the following can't be done with client-side JavaScript?

A. Validating a form

B. Sending a form's contents by email

C. Storing the form's contents to a database file on the server

D. None of the above

Q8. What is the correct JavaScript syntax to write "Hello World"?

A. System.out.println("Hello World")

B. println ("Hello World")

C. document.write("Hello World")

D. response.write("Hello World")

Q9. Inside which HTML element do we put the JavaScript?

A. <js>

B. <scripting>

C. <script>

D. <javascript>
Q10. What is the correct syntax for referring to an external script called " abc.js"?

A. <script href=" abc.js">

B. <script name=" abc.js">

C. <script src=" abc.js">

D. None of the above

Q11. Which is the correct way to write a JavaScript array?

A. var txt = new Array(1:"tim",2:"kim",3:"jim")

B. var txt = new Array("tim","kim","jim")

C. var txt = new Array:1=("tim")2=("kim")3=("jim")

D. var txt = new Array="tim","kim","jim"

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";

C. para1.firstChild.nodeValue= "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

Q14. Which of the following best describes JavaScript?

A. a low-level programming language.

B. a scripting language precompiled in the browser.

C. a compiled scripting language.

D. an object-oriented scripting language.

Q15. What is the correct JavaScript syntax to change the content of the HTML element below?

<p id="demo">This is a demonstration.</p>


A. document.getElementById("demo").innerHTML = "Hello World!";
B. document.getElementByName("p").innerHTML = "Hello World!";
C. document.getElement("p").innerHTML = "Hello World!";
D. #demo.innerHTML = "Hello World!";

Q16. How do you write "Hello World" in an alert box?

A. alert("Hello World");
B. msg("Hello World");
C. msgBox("Hello World");
D. alertBox("Hello World");

Q17. How do you create a function in JavaScript?

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

Q21. avaScript Code is written inside file having extension __________.

A. .javascript
B. .jvs
C. .js
D. .jsc

Q22. hy JavaScript is called as Lightweight Programming Language ?

A. because JS is client side scripting


B. because we can add programming functionality inside JS
C. because JS is available free of cost.
D. because JS can provide programming functionality inside but up to certain extend.

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

Q26. Which was the first browser to support JavaScript ?

A. IE
B. Mozilla Firefox
C. Netscape
D. Google Chrome

Q27 Which of the data type is not available in JS?

A. float
B. var
C. boolean
D. undefined

Q28. Which company developed JavaScript?

A. Netscape

B. Bell Labs

C. Sun Microsystems

D. IBM

Q29. JavaScript is designed for following purpose -

A. to style HTML pages

B. to execute Queries related to databases on a server


C. to add interactivity to html pages

D. All of the above

Q30. What are the types of Pop up boxes available in JavaScript?

A. Alert

B. Prompt

C. Confirm

D. All of the above

Q31. How ++ works in Javascript? Find output of below Javascript code.

var a = 1;

document.write(a--);

document.write(a);

A. 00

B. 01

C. 11

D. 10

Q32. Find output of below Javascript addition code

document.write("1 plus 1 is " + 1 + 1);

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

B. It returns the decimal values in string form

C. If returns only the integer portion of the number


D. None of the listed option

Q34. What is the output of below Javascript code?

alert (typeof new Date() );

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

Q36. AJAX Stands for:

A. Asynchronous Javascript and XML

B. Abstract JSON and XML

C. Another Java Abstraction for X-Windows

D. Another Java and XML Library

Q37. What makes Ajax unique?

A. It works as a stand-alone Web-development tool.

B. It works the same with all Web browsers.

C. It uses C++ as its programming language.

D. It makes data requests asynchronously.

Q38. What does the XMLHttpRequest object accomplish in Ajax?

A. It’s the programming language used to develop Ajax applications.

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.

Q39. Ajax is a programming language.

A. True

B. False

Q40. AJAX based on ______ .

A. JavaScript and XML

B. JavaScript and Java

C. VBScript and XML

D. JavaScript and HTTP requests

Q41. Using AJAX we can made our web page.

A. more interactive and faster

B. easy to connect web page with server

C. more dynamic

Q42. What are the advantages of AJAX?

A. AJAX is a platform-independent technology


B. It provides partial-page updates
C. Improved performance
D. All of the above

Q43. What are the disadvantages of AJAX?

A. Dependent on JavaScript
B. Security issues
C. Debugging is difficult
D. All of the above

Q44. Which of the following technology is not used by Ajax?

A. JavaScript
B. XMLHttpRequest
C. Document Object Model
D. Flash

Q45. AJAX comes in ____.

A. 2003

B. 2005

C. 2004

D. 2006
Q46. AJAX made popular by

A. Microsoft

B. IBM

C. Sun Microsystem

D. Google

Q47. __ is more robust and secure than __.

A. POST, GET

B. GET, POST

C. Both A & B

D. None of the above

Q48. The ___ property defines a function to be executed when the readyState changes.

A. onreadystatechange

B. onreadystateup

C. onreadystatedown

D. None of the above

Q49. What are the advantages of Ajax?

A. Bandwidth utilization

B. More interactive

C. Speeder retrieval of data

D. All of these

Q50. __ get the response data as XML data.

A. responseXML

B. responseText

C. responseString

D. None of the above

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

Q54. Which of these is a full form of DNS?

a) Data Network Service

b) Data Name Service

c) Domain Network Service

d) Domain Name Service

Q55. Which of these class is used to encapsulate IP address and DNS?

a) DatagramPacket

b) URL

c) InetAddress

d) ContentHandle

Q56. What will be the output of the following Java program?

import java.net.*;

class networking

public static void main(String[] args) throws UnknownHostException

InetAddress obj1 = InetAddress.getByName("cisco.com");

System.out.print(obj1.getHostName());

a) cisco
b) cisco.com

c) www.cisco.com

d) none of the mentioned

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

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 : 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

ANSWER: Bean-managed transactions

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

5) Abbreviate the term JMS?

a. Java Message Service


b. Java Monitor Service
c. Java Message Session
d. Java Monitor Session
ANSWER: Java Message Service

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. Stateful Session Bean


b. Stateless Session Bean
c. Singleton Session Bean
d. None of the above
ANSWER: Singleton Session Bean

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

c. server and client side component

d. None of the above

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

13) EJB is like COM, Abbreviate the term COM?


- Published on 20 Jul 15

a. Component Object Model

b. Component Oriented Model

c. Common Object Model

d. Common Oriented Model

ANSWER: Component Object Model

14) JMS is also known as a messaging service.


- Published on 17 Jul 15

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

16) What represents a persistent global data from the database?


- Published on 16 Jul 15

a. Entity Bean

b. Session Bean

c. Both A & B

d. None of the above

ANSWER: Entity Bean

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

c. server and client side component

d. None of the above

ANSWER: Server-side component

18) In EJB, middleware services are provided by EJB Container automatically.


- Published on 15 Jul 15

a. True

b. False

ANSWER: True

19) Which middleware services are provided by EJB?


- Published on 15 Jul 15

a. Security

b. Transaction Management
c. Both A & B

d. None of the above

ANSWER: Both A & B

20) Which server-side component is required to be deployed on the server?


- Published on 13 Jul 15

a. EJB

b. RMI

c. Both A & B

d. None of the above

ANSWER: EJB

21) How many types of session beans are available in EJB?


- Published on 13 Jul 15

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

d. None of the above

ANSWER: Message-Driven Bean

23) Which middleware services are provided by EJB?


- Published on 10 Jul 15
a. Security

b. Transaction Management

c. Both A & B

d. None of the above

ANSWER: 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. Stateful Session Bean

b. Stateless Session Bean

c. Singleton Session Bean

d. None of the above

ANSWER: Stateless Session Bean

25) EJB technology is built on the top of Socket Programming


- 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

26) Which of the following is true about message driven bean?

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.

C - This type of bean represents persistent data storage.


D - None of the above.

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.

27) Which of the following is true about stateless bean?

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.

C - Both of the above.

D - None of the above.

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.

28) Which of the following is correct about mappedName attribute in @javax.ejb.Stateless


annotation?

A - It is used to specify name of the session bean.

B - it is used to specify the JNDI name of the session bean.

C - It is used to provide description of the session bean.

D - None of the above.

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.

B - it is used to specify the interface type of the referenced bean.

C - It is used to provide name of the referenced bean.

D - It is used to specify the JNDI name of the referenced bean.


Answer : A
Explaination

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

@javax.ejb.Local annotation is used to specify Local interface(s) of a session bean.

31) Which of the following is correct about @PostActivate annotation for a callback method?

A - Method is invoked when a bean is created for the first time.

B - Method is invoked when a bean is removed from the bean pool or is destroyed.

C - Method is invoked when a bean is loaded to be used.

D - Method is invoked when a bean is put back to bean pool.

Answer : C
Explaination

@PostActivate - method is invoked when a bean is loaded to be used.

32) Which annotation is used to inject an datasource into an ejb?

A - @EJB

B - @Resource

C - Both of the above.

D - None of the above.

Answer : B
Explaination

@Resource annotation is used to inject an datasource into an ejb.


33) Which of the following types of java classes can be mapped using @Lob annotation?

A - byte[]

B - String

C - Serializable Object

D - All of the above.

Answer : D
Explaination

All of the above classes can be mapped using @Lob annotation.

34) Which of the following is correct about a Success attrribute of Bean Managed Transactions
in EJB?

A - When to start a transaction in a business method.

B - Identify success scenario when a transaction is to be committed.

C - Identify failure scenario when a transaction is to be rollback.

D - None of the above.

Answer : B
Explaination

Success - Identify success scenario when a transaction is to be committed.

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.

C - Both of the above

D - None of the above.

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.

36) How to specify autowiring by name?

Options
A : @Qualifier

B : @Type

C : @Constructor

D : @Name

View Answer

37) What does setAutoCommit(false) do?

Options

A : commits transaction after each query

B : explicitly commits transaction

C : does not commit transaction automatically after each query

D : never commits transaction

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

40) Which attribute is used to specify destroy method?

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 & Explanation

Answer: Option D

Explanation:

42. The EJB specification architecture does NOT define

A. transactional components

B. client side security and encryption

C. distributed object components

D. server-side components

View Answer

Workspace

Report

Discuss

Answer & Explanation

Answer: Option B

Explanation:

43. Which of the following is true?

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

C. Both are correct

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

D. All mentioned above

View Answer

Workspace

Report

Discuss

Answer & Explanation

Answer: Option C

Explanation:

45. Which statement about session beans is true?

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

D. None of the above

View Answer

Workspace

Report

Discuss

Answer & Explanation

Answer: Option C
Explanation:

46) Which of the following is correct about Statement class of JDBC?

A - Statement encapsulates an SQL statement which is passed to the database to be parsed


and compiled.

B - Statement encapsulates an SQL statement which is passed to the database to be planned


and executed.

C - Both of the above.

D - none of the above.

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

D - None of the above.

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?

A - JDBC-ODBC Bridge plus ODBC driver

B - Native-API, partly Java driver

C - JDBC-Net, pure Java driver

D - Native-protocol, pure Java driver

Answer : D
Explanation

Native-protocol, pure Java driver, uses database native protocol.


49) Which of the following is not a valid type of statement in JDBC?

A - Statement

B - PreparedStatement

C - CallableStatement

D - QueryStatement

Answer : D
Explanation

QueryStatement is not a valid type of statement in JDBC.

50) Which of the following is correct about PreparedStatement?

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.

C - Both of the above.

D - None of the above.

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.

B - It uses a default mapping for most data types.

C - Both of the above.

D - None of the above.

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.

B - components like Apache Commons DBCP Component can be used to configure


connection pooling.

C - Both of the above.

D - None of the above.

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.

55) Which of the following is correct about setFetchSize(int)?

A - setFetchSize(int) defines the number of rows that will be read from the database when the
ResultSet needs more rows.

B - setFetchSize(int) affects how the database returns the ResultSet data.

C - Both of the above.

D - None of the above.

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.

56) Which of the following is true about 'dirty read'?

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.

C - Both of the above.

D - None of the above.

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.

59) What are the major components of the JDBC?

DriverManager, Driver, Connection, Statement, and ResultSet

DriverManager, Driver, Connection, and Statement

DriverManager, Statement, and ResultSet

DriverManager, Connection, Statement, and ResultSet

Workspace

Answer: a

Explanation:

DriverManager: Manages a list of database drivers.

Driver: The database communications link, handling all communication with the database.

Connection: Interface with all methods for contacting a 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.

60) Select the packages in which JDBC classes are defined?

A. jdbc and javax.jdbc


B. rdb and javax.rdb
C. jdbc and java.jdbc.sql
D. sql and javax.sql

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.

61) Thin driver is also known as?

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.

63) What is the correct sequence to create a database connection?

i. Import JDBC packages.

2.7M

Hello Java Program for Beginners

ii. Open a connection to the database.

iii. Load and register the JDBC driver.

iv. Execute the statement object and return a query resultset.

v. Create a statement object to perform a query.

vi. Close the resultset and statement objects.

vii. Process the resultset.

viii. Close the connection.

a) i, ii, iii, v, iv, vii, viii, vi


b) i, iii, ii, v, iv, vii, vi, viii
c) ii, i, iii, iv, viii, vii, v, vi
d) i, iii, ii, iv, v, vi, vii, viii

Workspace

Answer: b

Explanation: To create a database connection in Java, we must follow the sequence given below:

Import JDBC packages.

Load and register the JDBC driver.

Open a connection to the database.


Create a statement object to perform a query.

Execute the statement object and return a query resultset.

Process the resultset.

Close the resultset and statement objects.

Close the connection.

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

Explanation: The following table defines transaction isolation levels.

Transaction Isolation Level Description

TRANSACTION_READ_UNCOMMITTED Dirty reads, non-repeatable reads, and phantom


reads can occur.

TRANSACTION_READ_COMMITTED Dirty reads are prevented; non-repeatable reads and


phantom reads can occur.

TRANSACTION_REPEATABLE_READ Dirty reads and non-repeatable reads are prevented;


phantom reads can occur.

TRANSACTION_SERIALIZABLE Dirty reads, non-repeatable reads, and phantom


reads are prevented.

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.

67) Which methods are required to load a database driver in JDBC?

a) getConnection()
b) registerDriver()
c) forName()
d) Both b and c

Answer: d

Explanation: There are two ways to load a database driver in JDBC:

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.

68) Parameterized queries can be executed by?

a) ParameterizedStatement
b) PreparedStatement
c) CallableStatement and Parameterized Statement
d) All kinds of Statements

Answer: b

Explanation: The PreparedStatement interface extends the Statement interface. It represents a


precompiled SQL statement that can be executed multiple times. It accepts parameterized SQL quires.
We can pass 0 or more parameters to this query.

69) Which of the following is not a valid statement in JDBC?

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.

CallableStatement: It is used to execute SQL stored procedures.

QueryStatement: It is not supported by JDBC.

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.

71) What does setAutoCommit(false) do?

a) It will not commit transactions automatically after each query.


b) It explicitly commits the transaction.
c) It never commits the transactions.
d) It does not commit transaction automatically after each query.

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.

72) Stored procedure can be called by using the ????..?

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?

a) Connection, Statements, and then ResultSet


b) ResultSet, Connection, and then Statements
c) Statements, ResultSet, and then Connection
d) ResultSet, Statements, and then Connection

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).

74) A good way to debug JDBC-related problems is to enable???..?

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.

76) JDBC-ODBC driver is also known as?

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.

77) Which of the following driver is the fastest one?

a) JDBC-ODBC Bridge Driver


b) Native API Partly Java Driver
c) Network Protocol Driver
d) JDBC Net Pure Java Driver

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.

78) Which of the following is not a type of ResultSet object?

a) TYPE_FORWARD_ONLY
b) CONCUR_WRITE_ONLY
c) TYPE_SCROLL_INSENSITIVE
d) TYPE_SCROLL_SENSITIVE

Answer: b

Explanation: There are three types of ResultSet object:

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.

Based on the concurrency there are two types of ResultSet object.

CONCUR_READ_ONLY: The ResultSet is read-only, this is the default concurrency type.

CONCUR_UPDATABLE: We can use the ResultSet update method to update the rows data.

79) What is JDBC Savepoint?

a) An intermediate or checkpoint in a transaction


b) A point where we can store queries
c) A point where the JDBC application starts execution
d) A memory where we can store transaction

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

Explanation: There are following stages in a JDBC program:

Register the driver

Connecting to a database

Preparing SQL statements in Java

Executing the SQL statements on the database

Retrieving the results

Closing the connection

81) Which of the following is the correct to register a JdbcOdbcDriver?

a) jdbc.odbc.JdbcOdbcDriver obj = new sun.jdbc.odbc.JdbcOdbcDriver();


b) odbc.JdbcOdbcDriver obj = new sun.odbc.JdbcOdbcDriver();
c) jdbc.JdbcOdbcDriver obj = new sun.jdbc.JdbcOdbcDriver();
d) jdbc.odbc.JdbcOdbc obj = new sun.jdbc.odbc.JdbcOdbc();

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:

sun.jdbc.odbc.JdbcOdbcDriver obj = new sun.jdbc.odbc.JdbcOdbcDriver();

82) How many ways to register a driver?

a) 2
b) 3
c) 4
d) 5

Answer: c

Explanation: There are four ways to register a driver:

1. By creating an object of the Driver For example:

sun.jdbc.odbc.JdbcOdbcDriver obj = new sun.jdbc.odbc.JdbcOdbcDriver();


2. By sending the driver class object to the registerDriver() method of the DriverManager class. For
example:

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");

4. By using the getProperty() method of the System class. For example:

String dname = System.getProperty("driver");

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:

c:\> java -Ddriver = driverclassname Programname

For example:

c:\> java -Ddriver = sun.jdbc.odbc.JdbcOdbcDriver MyProgram

83) Identify the DSN in the following statement:

a) DriverManager.getConnection("jdbc:odbc:oradsn", "scott", "tiger")


b) jdbc
c) odbc
d) scott
e) oradsn

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.?

a) getConnection("jdbc::thin@localhost:1521:oracle", "scott", "tiger");


b) getConnection("jdbc:thin@localhost:1521:oracle", "scott", "tiger");
c) getConnection("jdbc::thin@localhost:1522:oracle", "scott", "tiger");
d) getConnection("jdbc::oracle@localhost:1521:thin", "scott", "tiger");

Answer: a

Explanation: We use the following statement to connect Oracle database using the thin driver.

DriverManager.getConnection("jdbc::thin@localhost:1521:oracle", "scott", "tiger");


85) What are the types of ResultSet in JDBC?

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.

86) What is blob in the following statement?

create table profilepic(photo blob);

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.

88) DatabaseMetaData interface is used to get?????..?

a) Comprehensive information about the database as a whole.


b) Comprehensive information about the table as a whole.
c) Comprehensive information about the column as a whole.
d) Both b and c

Answer: a

Explanation: DatabaseMetaData is an interface that is used to get Comprehensive information about


the database as a whole. It is implemented by driver vendors to let users know the capabilities of a
DBMS in combination with the JDBC driver that is used with it.

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.

90) Are ResultSets updateable?

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.

92) How many statement objects can be created using a Connection?

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.

94) Which statement(s) is/ are true about transactions?

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.

95). Which of the following contains both date and 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.

96) Which of the following is advantage of using JDBC connection pool?


a) Slow performance
b) Using more memory
c) Using less memory
d) Better performance

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.

97) Which of the following is advantage of using PreparedStatement in Java?

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.

98) Which one of the following contains date information?

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.

99) What does setAutoCommit(false) do?

a) commits transaction after each query


b) explicitly commits transaction
c) does not commit transaction automatically after each query
d) never commits transaction

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.

100) Which of the following is used to call stored procedure?

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.

102) Which of the following is method of JDBC batch process?

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.

103) Which of the following is used to rollback a JDBC transaction?

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.

104) Which of the following is not a JDBC connection isolation levels?

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.

105) Which of the following is not an Enterprise Beans type?

a) Doubleton
b) Singleton
c) Stateful
d) Stateless
Answer: a
Explanation: Stateful, Stateless and Singleton are session beans.

106) Which of the following is not true about Java beans?

a) Implements java.io.Serializable interface


b) Extends java.io.Serializable class
c) Provides no argument constructor
d) Provides setter and getter methods for its properties
View Answer

Answer: b
Explanation: java.io.Serializable is not a class. Instead it is an interface. Hence it cannot be extended.

107) Which file separator should be used by MANIFEST file?

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.

109) Java Beans are extremely secured?

a) True
b) False

Answer: b
Explanation: JavaBeans do not add any security features to the Java platform.

110) Which of the following is not a feature of Beans?

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.

112) Which attribute is used to specify initialization method?

a) init
b) init-method
c) initialization
d) initialization-method

Answer: b
Explanation: init-method is used to specify the initialization method.

113) Which attribute is used to specify destroy method?

a) destroy
b) destroy-method
c) destruction
d) destruction-method

Answer: b
Explanation: destroy-method is used to specify the destruction method.

114) How to specify autowiring by name?

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

response.encodeRedirectURL(url) encodes the specified URL for use in the sendRedirect


method or, if encoding is not needed, returns the URL unchanged.
Q 6 - Which of the following code can be used to add a header?
A - request.addHeader(name,value)
B - response.addDateHeader(name,value)
C - Header.addDateHeader(name,value)
D - None of the above.

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.

15. 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
a) i, ii, iii, vi
b) i, ii, iv, v
c) i, vi, iii, v
d) i, ii, iii, v

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.

20. Servlet are used to program which component in a web application?


a) client
b) server
c) tomcat
d) applet

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.

23. How does applet and servlet communicate?


a) HTTP
b) HTTPS
c) FTP
d) HTTP Tunneling

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

Q. 25 Servlet runs each request in a __________ ?


a. OS shell
b. JVM
c. Separate thread
d. JRE
Correct Answer : OPTION C, Separate thread.
Q. 26 GenericServlet class is encapsulated inside __________ package
a. java.lang
b. javax.servlet
c. java.servlet
d. javax.servlet.http
Correct Answer : OPTION B, javax.servlet
27. Which class provide implementation for service() method ?
a. GenericServlet
b. HttpServlet
c. Servlet
d. none of the above
Correct Answer : OPTION B, HttpServlet
28. _________ is responsible for managing execution of servlet

a. Web Container

b. Servlet Context

c. JVM

d. Server

Correct Answer : OPTION A, Web Container


29. When using HTML forms which of the following is true for POST method ? Select the one
correct answer.

a. POST allows users to bookmark URLs with parameters.


b. The POST method should not be used when large amount of data needs to be transferred.

c. POST method shows the send data in the URL.

d. POST method sends data in the body of the request.

Correct Answer : OPTION D, POST method sends data in the body of the request
30. Q. Deployment Descriptor(DD) is a _________ .

a. Servlet used to maintain other servlet.

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

Correct Answer : OPTION A, True


32. Q. Which method is called only once in Servlet life cycle ?

a. service()

b. initialize()

c. init()

d. all of the above

Correct Answer : OPTION C, init()


33. Q. Which of the following is not a valid HTTP/1.1 method. Select the correct answer.

a. CONNECT method

b. COMPARE method

c. OPTIONS method

d. TRACE method

Correct Answer : OPTION B, COMPARE method


34. Which of these classes define the getWriter() method that returns an object of type
PrintWriter ? Select the one correct answer. ?

a. HttpServletRequest

b. HttpServletResponse

c. ServletConfig

d. ServletContext

Correct Answer : OPTION B


Q.35 Which method defined in the HttpServletResponse may be used to set the content type ?
a. setType()
b. setContent()
c. setContentType()
d. setResponseContentType()
Correct Answer : OPTION C
36. Q. Which method of HttpServletResponse is used to redirect an HTTP request to another
URL ?

a. sendURL()

b. redirectURL()

c. sendRedirect()

d. getRequestDispatcher()

Correct Answer : OPTION C


37. Q. Given request is a HttpServletRequest object, which gets a binary input stream ?

a. BinaryInputStream s = request.getInputStream();

b. ServletInputStream s = request.getInputStream();

c. BinaryInputStream s = request.getBinaryStream();

d. ServletInputStream s = request.getInputStream();

Correct Answer : OPTION B


38. Q. Which method defined in the HttpServletRequest returns the object of RequestDispatcher
?

A. getRequestDispatcher()
b. getDispatcher()

c. getRequest()

d. requestDispatcher()

Correct Answer : OPTION A


39. Q. Which statement is true about include() method of RequestDispatcher interface ?

a. forwards a request from a servlet to another resource on the server.

b. includes the content of any resource inside the current servlet.

c. includes the content of only servlet inside the current servlet

d.None

Correct Answer : OPTION B


40. Which method of HttpServletRequest returns the name of the HTTP method with which the
request was made ?

a. getRequestMethod()

b. getHttpMethod()

c. getHttpRequestMethod()

d. getMethod()

Correct Answer : OPTION D


41. Q. When the Web Container initializes a servlet, it creates a ___________ object for the
servlet ?

a. ServletConfig

b. ServletInit

c. ServletContext

d. None of the above

Correct Answer : OPTION A


42. ____________ object is available to any servlet or JSPs that are part of the web app and
provides communication between servlets and JSPs.

a. Servlet

b. ServletConfig
c. ServletContext

d. HttpServletContext

Correct Answer : OPTION C

43. Q. Which types of objects can store attributes ?

a. ServletConfig

b. ServletResponse

c. RequestDispatcher

d. HttpServletRequest

Correct Answer : OPTION D


44. . If the client has disabled cookie in the browser, which session management mechanism
could the web container employ ?

a. Session Management using Cookies

b. Session Management using URL rewriting

c. Either Cookies or URL rewriting

d. Cookies and URL rewriting must be used together

Correct Answer : OPTION B


45. Which statement about HttpSession is not true?

a. HttpSession object is used to store entire session with a specific client

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

d. Attribute can be stored, retrieved and removed from HttpSession object

Correct Answer : OPTION C


46. Q. Given request is an HttpServletRequest, which code snippets will creates a session if one
doesn't exist?

a. request.getSession(false);

b. request.createSession();

c. request.getNewSession();
d. request.getSession();

Correct Answer : OPTION D


47. Q. Which method is used access the cookies that are added to response object?

a. getCookies()

b. getNewCookies();

c. cookies();

d. returnCookies();

Correct Answer : OPTION A


48. Q. Which method is used to get the parameter value from request object?

a. getParameterValue()

b. getParameter()

c. getValue()

d. requestParameter()

Correct Answer : OPTION B


49. Q. Which statement is true for request.getSession(true) method?

a. if session already exist, it return the existing session else create a new session

b. getSession(true) method always returns a new session

c. getSession(true) method always returns a pre existing session

d.none

Correct Answer : OPTION B


50. Q Which method returns a string containing the unique session id?

a. getSessionId()

b. getUniqueId()

c. getUniqueSessionId()

d. getId()

Correct Answer : OPTION D


51. Q. Cookies are stored on _______ side.
a. Client

b. Server

Correct Answer : OPTION A


52. Q. Which method is used to delete a session?

a. invalidateSession()

b. invalidate()

c. deleteSession()

d. delete()

Correct Answer : OPTION B


53. Q. Which method returns the time when the session was created?

a. getCreationTime()

b. getTime()

c. getStartingTime()

d. creationTime()

Correct Answer : OPTION A


54.What are the jobs of web-server? choose multiple answers.

a.Get the resources

b.Find the resources

c.Return the requested thing to user

d.Get the Request

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?

a.can be one physical machine

b.can be software

c.can be hardware

d.non of these

Ans:a,b,c

57.Which of the following protocol is used for web page browsing ?

a.https

b.http

c.ftp

d.none of these

Ans:a,b

58.Which html tag can be used to send the request to servlet?

a.<action>

b.<form>

c.<input>

d.all of these

Ans:b

59.Which statements are true about http protocol?

a.Runs on top of Tcp/IP

b.It has web specific feature

c.Web server processes http request

d.But it is not IETF standard

Ans:a,b,c

60.Html is part of httprequest, Is it true or false?


a.true

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

63.How to send data in get method?

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?

a.By comma separator

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

66.What is full form of MIME type?

a.Mail Interface Multiple Extension

b.Mail Internet Multiple Extension

c.Multiple Internet Mail Extension

d.Multiple Interface Mail Extension

Ans:c

67.Which of these are MIME types?

a.application/java

b.image/bmp

c.text/html

d.text/css

e.text/plain

Ans:all

68.What is true about MIME type?

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

69.What is the nature of HTML page ?

a.dynamic

b.static

c.both dynamic and static

d.none of these

Ans:b

70.Which of these are webserver?

a.Internet Information Services (IIS)

b.tomcat

c.Lighttpd

d.nginx

e.glassfish

Ans:a,b,c,d

71.Which of these is not a Application Server?

a.JBoss

b.JRun

c.WebLogic Server(BEA)

d.Apache HTTP Server

e.GlassFish

Ans:d

72.Web server serves only static page, tru or false?

a.true
b.false

Ans:a

73.Which tag doesn't belongs to web.xml?

a.web-app

b.welcome-file-list

c.servlet

d.servlet-mappings

Ans:d

JSP MCQ
1) JSP stands for ___.

A. Java Server Pages

B. Java Side Pages

C. Java Server Phase

D. All of the above

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

D. None of the above

Ans:A
3) Which of the following is the correct syntax to declare comments in JSP?

A. <%-- This is JSP comment --%>

B. <!-- This is JSP comment -->

C. //..

D. All of the above

Ans:A

4) Which of the following is not a directive?

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

D. None of the above

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

7) A JSP page consists of which tags?

A. HTML tags

B. JSP tags

C. Both A & B

D. None of the above

Ans:C

8) Which packages does a JSP API consist of?

A. javax.servlet.jsp

B. java.servlet

C. javax.servlet.jsp.tagext

D. Both A & C

Ans:D

9) JDBC stands for __.

A. Java Database Connectivity

B. Jar Database Connectivity

C. Java Database Content

D. None of the above

Ans:A

10) Is JSP technology extensible?

A. True

B. False

Ans:A

11) Which of the following is true about tag?


A. The <c:redirect > tag redirects the browser to an alternate URL by providing automatically
URL rewriting.

B. The <c:redirect > tag supports context-relative URLs.

C. The <c:redirect > tag supports <c:param> tag.

D. All of the above

Ans:D

12) What are the advantages of JSP?

A. platform independent

B. good performance and scalability

C. easily maintained

D. All of the above

Ans:D

13) What is the use of tag?

A. to catch any Throwable that occurs in its body and optionally exposes it.

B. to catch the runtime error and redirect to error page.

C. Both of the above.

D. None of the above.

Ans:A

14) Compilation process of JSP page involves:

A. Parsing of JSP

B. Turning JSP into servlet

C. Compiling the servlet

D. All of the above

Ans D

15) What is the use of tag?


A. It removes a item from a list

B. It removes the data row from the database.

C. It removes a variable from either a specified scope or the first scope where the variable is
found.

D. None of the above

Ans:C

16) What is the synatx of JSP Page directive?

A. <%@ page…%>

B. <% page…%>

C. <!@ page…!>

D. None of the above

Ans:A

17) Which syntax is used to defines the programming language (underlying language) being used
in the JSP?

A. <%@ page language="value" %>

B. <!@ page language="value" !>

C. <@ page language="value" >

D. None of the above

Ans:A

18) What JSTL stands for?

A. JSP Tag Library

B. JavaServer Pages Standard Tag Library

C. Java Standard Tag Library

D. None of the above.

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

D. None of the above

Ans:A

20) Which of the following is true about action?

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.

B. useBean is used to load java beans in jsp page.

C. Both of the above.

D. None of the above

Ans:C

21) Which one of the following is a syntax to create a simple JSP?

A. <html> <body> <% out.print(2*5); %> </body> </html>

B. <html> <body> <! out.print(2*5); !> </body> </html>

C. <html> <body> <%@ out.print(2*5); %> </body> </html>

Ans:A

D. None of the above

22) Application is instance of which class?

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?

A. Using <%jsp:param> tag

B. Using <%jsp:page> tag

C. Using <%jsp:useBean> tag

D. Using <%jsp:import> tag

Ans:B

24) Which option is true about session scope?

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

25) Default value of autoFlush attribute is?

A. True

B. False

Ans:A

26) Which one is the correct order of phases in JSP life cycle?

A. Compilation, Initialization, Execution, Cleanup

B. Cleanup, Compilation, Initialization, Execution

C. Initialization, Cleanup, Compilation, Execution

D. Initialization, Compilation, Cleanup, Execution

Ans:A

27) Request is instance of which one of the following classes in jsp:

A. ServletRequest

B. HttpServletRequest
C. Request

D. HttpRequest

Ans :B

28) Which is mandatory in tag?

A. id, type

B. type, property

C. type,id

D. id, class

Ans:D

29) The difference between Servlets and JSP is:

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

D. All of the above

Ans:B

Q31)_jspService() method of HttpJspPage class should not be overridden.

A - True

B - False
Answer : A
Explaination
JSP container creates _jspService() methods so it should not be overridden.

32) Which of the following is a server side technology?

A - html

B - jsp

C - javaScript

D - css

Answer : B
Explaination
jsp is a server side technology.

33)All jsp pages are required to be mapped and configured in web.xml.

A - True

B - False

Answer : B
Explaination
No, Jsp pages are not required to be mapped/configured in web.xml

34) isErrorPage is by default true.

A - True

B - False

Answer : B
Explaination
isErrorPage is required to be set true, it is false by default.

Q35)pageContext is instance of which class?

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.

36)What is default value of isELIgnored Attribute?

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.

37) Which of the following is true about isELIgnored Attribute?

A - The isELIgnored option gives you the ability to disable the evaluation of Expression
Language (EL) expressions.

B - The default value of the isELIgnored attribute is true.

C - Both of the above.

D - None of the above.

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.

B - Container invokes _jspService() method during Initialization phase.

C - Both of the above.

D - None of the above.


Answer : A
Explaination
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.

40) What is the use of <c:remove > tag?

A - It removes a item from a list

B - it removes the data row from the database.

C - It removes a variable from either a specified scope or the first scope where the variable is
found

D - None of the above.

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?

1. JSP technology is used to create web application.

2. The JSP pages are not easier to maintain than Servlet.

3. JSP page consists of HTML tags and JSP tags.

A.1 & 2

B.1 & 3

C.2 & 3

D.All of the above


Explanation
Correct Option :B.
42) Which of the following are the life cycle method of jsp?

A.jspInit()

B._jspService()

C.jspDestroy()

D.All of the above

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?

1. JSP page is translated into Servlet.

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

5. Compilation of JSP Page

6. Destroy

7. Translation of JSP Page

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

D.JSP include directive

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

D.All of the above

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

D.All of the above

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

D.All of the above

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

D.all of the above

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

D.All of the above

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

D.All of the above

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

D.All of the above

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

D.All of the above

E.Only A & B

Explanation
Correct Option :D.
All of the above is the correct answer

65)<%@ include ... %>


This jsp element helps to:

A.Includes a file during the translation phase

B.Includes plugins during the translation phase

C.Declares a tag library, containing custom actions, used in the page

D.there is no such jsp element available

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

B.Declare scripting language

C.Declare error page

D.All of the above

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

68)element in jsp is used to:

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

C.Includes a file during the translation phase

D.All of the above

E.Only A & B

Explanation
Correct Option :E.
Only A & B is the correct answer
69)jsp element is used to:

A.Forwards the processing of a request to a servlet or JSP page

B.Forwards the processing of a request to a third party plugins

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

73)<%! ... %>


above jsp element is known as:

A.scriptlet

B.expression

C.declaration

D.beans

E.taglib

Explanation
Correct Option :C.
declaration is the correct answer

74)Which of the following is not correct statement related to jsp?

A.A JSP page cannot be sent as-is to the browser

B.A JSP page can be sent as-is to the browser

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

76)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

E.Page, Request, Session, Application, Response, Global-Session

Explanation
Correct Option :C.
Page, Request, Session, Application is the correct answer

77)Which page directive should be used in JSP to generate a PDF page?

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

Thin driver is also known as?


Type 3 Driver
Type 2 Driver
Type 4 Driver
Type 1 Driver

Question 3

Which JDBC driver can be used in servlet and applet both?


answer choices
Type 3
Type 4
Type 3 and Type 2
Type 3 and Type 4
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.
Question 4

JDBC-ODBC driver is also known as?


Type 4
Type 3
Type 2
Type 1

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

JDBC API supports____________ and __________ architecture model for


accessing the database.
Two-tier
Three-tier
Both a and b
Only b

Question 8

which of the following driver is platform independent and database dependent?


answer choices
Type-2
Type-1
Type-3
Type-4

Question 9

In type-1 driver database is _______ and platform is _______.


dependent, dependent
independent, dependent
dependent, independent
independent, independent

Question 10

Which of the following driver are database and platform independent?


JDBC-ODBC driver
Network protocol driver
Native-API
Thin driver

Question 11

which of the following driver also known as pure java driver?


answer choices
Type-3
Type-4
Type-1
Type-2

Question 12

How many JDBC driver does Sun define?


one
two
three
four

Question 13
Driver types are used to categorize the technology used to connect to database.
True
False

Question 14

This is an application programming interface provided by Microsoft for access


the database. It use SQL as its database language.
JDBC
ODBC

Question 15

JDBC stands for:


Java Database Component
Java Database Connectivity
Java Database Control
None
JDBC Quiz

1-What are the major components of the JDBC?

a. DriverManager, Driver, Connection, Statement, and ResultSet


b. DriverManager, Driver, Connection, and Statement
c. DriverManager, Statement, and ResultSet
d. DriverManager, Connection, Statement, and ResultSet

2-Select the packages in which JDBC classes are defined?

a. jdbc and javax.jdbc


b. rdb and javax.rdb
c. jdbc and java.jdbc.sql
d. sql and javax.sql

3-What is the correct sequence to create a database connection?


i. Import JDBC packages.
ii. Open a connection to the database.
iii. Load and register the JDBC driver.
iv. Execute the statement object and return a query resultset.
v. Create a statement object to perform a query.
vi. Close the resultset and statement objects.
vii. Process the resultset.
viii. Close the connection.

a. i, ii, iii, v, iv, vii, viii, vi


b. i, iii, ii, v, iv, vii, vi, viii
c. ii, i, iii, iv, viii, vii, v, vi
d. i, iii, ii, iv, v, vi, vii, viii

4- Parameterized queries can be executed by?

a. ParameterizedStatement
b. PreparedStatement
c. CallableStatement and Parameterized Statement
d. All kinds of Statements

Explanation: The PreparedStatement interface extends the Statement interface.


It represents a precompiled SQL statement that can be executed multiple times.
It accepts parameterized SQL quires. We can pass 0 or more parameters to this
query.
5- Which of the following is not a valid statement in JDBC?

a. Statement
b. PreparedStatement
c. QueryStatement
d. CallableStatement

Explanation:

o 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.
o PreparedStatement: It represents the pre-compiled SQL statements that
can be executed multiple times.
o CallableStatement: It is used to execute SQL stored procedures.
o QueryStatement: It is not supported by JDBC.

6- Stored procedure can be called by using the ????..?

a. CallableStatement
b. Statement
c. CalledStatement
d. PreparedStatement

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.

7- Which of the following driver is the fastest one?

a. JDBC-ODBC Bridge Driver


b. Native API Partly Java Driver
c. Network Protocol Driver
d. JDBC Net Pure Java Driver

8- 5. What does setAutoCommit(false) do?


a) commits transaction after each query
b) explicitly commits transaction
c) does not commit transaction automatically after each query
d) never commits transaction

9-Which of the following is used to call stored procedure?


a) Statement
b) PreparedStatement
c) CallableStatment
d) CalledStatement

10-What must be the first characters of a database URL?

A. db,
B. db:
C. jdbc,
D. jdbc:
Explanation: All JDBC URLs begin with the protocol jdbc followed by a colon
as a delimiter.

11-Which of these obtains a Connection?

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

15-Transactions can be described with key properties:-


a) Atomicity
b) Consistency
c) Isolation
d) All of the mentioned

16- The term must be closed at the end of java program is

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

1- The java _______ specification defines an application programming


interface for communication between the Web server and the application
program.
a. Program
b. Servlet
c. Randomise
d. Server
2- The life cycle of servlet is managed by
a. The supporting protocol (http & https)
b. Servlet context
c. Servlet itself
d. Servlet container

3-Which of the following is true about servlets?


a. execute within the address space of web server
b. platform-independent because they are written in java
c. use the full functionality of the Java class libraries
d. All of above
4- Which of the following package contains servlet classes?

javax.servlet
javax.servlet.http
Both of the above.
None of the above.

5- identify the disadvantages of CGI?

If clients increases more time for sending response


each request has process & Web server limited processes
It uses platform dependent language e.g. C, C++, perl
All mentioned above

6- Servlet technology is used to create web application


a. True
b. false
7- which lifecyle method is called once in servlet life cycle

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()

3- _jspService() method of HttpJspPage class should not be overridden.


True
False

4-“request” is instance of which one of the following classes?


Request
HttpRequest
HttpServletRequest
ServletRequest

5-Which is not a directive?


include
page
export
useBean

6-Which is mandatory in <jsp:useBean /> tag?


id, class
id, type
type, property
type,id

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

8-Which tag is used to execute java source code in JSP?


Declaration Tag
Scriptlet tag
Expression tag
None of the above

9-Which one of the following is correct for directive in JSP?


<%@directive%>
<%!directive%>
<%directive%>
<%=directive%>

10-Java code is embedded under which tag in JSP?


Declaration
Scriptlet
Expression
Comment
11-The ASP and JSP technologies are quite similar in the way they support the
creation of Dynamic pages, using HTML templates, scripting code and
components for business logic.
True
False

12-Which two interfaces does the javax.servlet.jsp package have?


JspPage
HttpJspPage
JspWriter
PageContext
Both A & B

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

15-A JSP page consists of which tags?


HTML tags
JSP tags
Both A & B
None of the above

16-Which packages does a JSP API consist of?


javax.servlet.jsp
java.servlet
javax.servlet.jsp.tagext
Both A & C

17-For what JSP is used?


Server-side dynamic content generation
Client Side language for validation

18-What is full form of JSTL?


JSP Tag Library
JavaServer Pages Standard Tag Library
Java Standard Tag Library
None of the above.
→Telegram Channel 
→Telegram Group
@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Assessment Questions and Answers focuses on “Pointer to Objects”.
1. Which language among the following doesn’t allow pointers?
a) C++
b) Java
c) Pascal
d) C
Answer: b
Explanation: The concept of pointers is not supported in Java. The feature is not given in the language but can be used in some
ways explicitly. Though this pointer is supported by java too.
2. Which is correct syntax for declaring pointer to object?
a) className* objectName;
b) className objectName;
c) *className objectName;

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

a) Using object name


b) Using an integer pointer
TU

c) Using this pointer


d) Using void pointer
K

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

5. If pointer to an object is declared


a) It can store any type of address
b) It can store only void addresses
/
s:/

c) It can only store address of integer type


d) It can only store object address of class type specified
tp

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Can point to more than one objects at a time
c) Can point to only 2 objects at a time
d) Can point to whole class objects at a time
Answer: a
Explanation: The object pointer can point to only one object at a time. The pointer will be able to store only one address at a

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
time. Hence only one object can be referred.
8. Pointer to a base class can be initialized with the address of derived class, because of
a) derived-to-base implicit conversion for pointers
b) base-to-derived implicit conversion for pointers
c) base-to-base implicit conversion for pointers
d) derived-to-derived implicit conversion for pointers
Answer: a
Explanation: It is an implicit rule defined in most of the programming languages. It permits the programmer to declare a pointer
to the derived class from a base class pointer. In this way the programmer doesn’t have to declare object for derived class each
time it is required.

9. Can pointers to object access the private members of the class?


a) Yes, always
b) Yes, only if it is only pointer to object

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

11. Which among the following is true?


a) The pointer to object can hold address only
TU

b) The pointer can hold value of any type


c) The pointer can hold only void reference
d) The pointer can’t hold any value
K
A

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/

programmer to link more than one objects if required.


t.m

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Using $ symbol
c) Using & symbol
d) Using @ symbol
Answer: c
Explanation: The & symbol must be used. This should be done such that the object should be preceded by & symbol and then

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
the address should be stored in another variable. This is done to get the address where the object is stored.
15. What should be done to prevent changes that may be made to the values pointed by the pointer?
a) Usual pointer can’t change the values pointed
b) Pointer should be made virtual
c) Pointer should be made anonymous
d) Pointer should be made const
Answer: d
Explanation: The pointer should be declared as a const type. This prevents the pointer to change any value that is being pointed
from it. This is a feature that is made to access the values using pointer but to make sure that pointer doesn’t change those
values accidently.

16. References to object are same as pointers of object.


a) True
b) False

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Basic Object Oriented Programming using C++ Questions and Answers focuses on “Copy Constructor”.
1. Copy constructor is a constructor which
a) Creates an object by copying values from any other object of same class
b) Creates an object by copying values from first object created for that class
c) Creates an object by copying values from another object of another class
d) Creates an object by initializing it with another previously created object of same class
Answer: d
Explanation: The object that has to be copied to new object must be previously created. The new object gets initialized with the
same values as that of the object mentioned for being copied. The exact copy is made with values.
2. The copy constructor can be used to
a) Initialize one object from another object of same type
b) Initialize one object from another object of different type
c) Initialize more than one object from another object of same type at a time

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

class for initialization.


_N

4. The copy constructors can be used to


TU

a) Copy an object so that it can be passed to a class


b) Copy an object so that it can be passed to a function
c) Copy an object so that it can be passed to another primitive type variable
K

d) Copy an object for type casting


A

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. If a class implements some dynamic memory allocations and pointers then
a) Copy constructor must be defined
b) Copy constructor must not be defined
c) Copy constructor can’t be defined
d) Copy constructor will not be used

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: In the case where dynamic memory allocation is used, the copy constructor definition must be given. The implicit
copy constructor is not capable of manipulating the dynamic memory and pointers. Explicit definition allows to manipulate the
data as required.
8. What is the syntax of copy constructor?
a) classname (classname &obj){ /*constructor definition*/ }
b) classname (cont classname obj){ /*constructor definition*/ }
c) classname (cont classname &obj){ /*constructor definition*/ }
d) classname (cont &obj){ /*constructor definition*/ }
Answer: c
Explanation: The syntax must contain the class name first, followed by the classname as type and &object within parenthesis.
Then comes the constructor body. The definition can be given as per requirements.
9. Object being passed to a copy constructor

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

d) Is not passed by reference


ot

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

11. Copy constructor will be called whenever the compiler


a) Generates implicit code
K

b) Generates member function calls


A

c) Generates temporary object


d) Generates object operations
e/
t.m

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:/

12. The deep copy is possible only with the help of


tp

a) Implicit copy constructor


ht

b) User defined copy constructor


c) Parameterized constructor
d) Default constructor
Answer: b
Explanation: While using explicit copy constructor, the pointers of copied object point to the intended memory location. This is
assured since the programmers themselves manipulate the addresses.
13. Can a copy constructor be made private?
a) Yes, always
b) Yes, if no other constructor is defined
c) No, never
d) No, private members can’t be accessed
Answer: a
Explanation: The copy constructor can be defined as private. If we make it private then the objects of the class can’t be copied. It
can be used when a class used dynamic memory allocation.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. The arguments to a copy constructor
a) Must be const
b) Must not be cosnt
c) Must be integer type

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Must be static
Answer: a
Explanation: The object should not be modified in the copy constructor. Because the object itself is being copied. When the
object is returned from a function, the object must be a constant otherwise the compiler creates a temporary object which can die
anytime.
15. Copy constructors are overloaded constructors.
a) True
b) False
Answer: a
Explanation: The copy constructors are always overloaded constructors. They have to be. All the classes have a default
constructor and other constructors are basically overloaded constructors.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Interview Questions and Answers for Experienced people focuses on
“Passing Object to Functions”.
1. Passing object to a function
a) Can be done only in one way
b) Can be done in more than one ways
c) Is not possible
d) Is not possible in OOP
Answer: b
Explanation: The objects can be passed to the functions and this requires OOP concept because objects are main part of OOP.
The objects can be passed in more than one way to a function. The passing depends on how the object have to be used.
2. The object
a) Can be passed by reference
b) Can be passed by value

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

4. If object is passed by value


a) Copy constructor is used to copy the values into another object in the function
TU

b) Copy constructor is used to copy the values into temporary object


c) Reference to the object is used to access the values of the object
d) Reference to the object is used to created new object in its place
K
A

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:/

a) Affects the object in called function only


b) Affects the object in prototype only
tp

c) Affects the object in caller function


ht

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?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Function name
b) Object name itself
c) Caller function name
d) Class name of object

Answer: d

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The type of object is the class itself. The class name have to be specified in order to pass the objects to a function.
This allows the program to create another object of same class or to use the same object that was passed.
8. If an object is passed by value,
a) Temporary object is used in the function
b) Local object in the function is used
c) Only the data member values are used
d) The values are accessible from the original object
Answer: b
Explanation: When an object is called by values, copy constructor is called and object is copied to the local object of the function
which is mentioned in the argument list. The values gets copied and are used from the local object. There is no need to access
the original object again.
9. Can data members be passed to a function using the object?
a) Yes, it can be passed only inside class functions

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

b) The data members and member functions have to be passed separately


A

c) The values should be present in other variables


d) The object must be passed
e/
t.m

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:/

12. Which among the following is true?


tp

a) More than one object can’t be passed to a function


ht

b) Any number of objects can be passed to a function


c) Objects can’t be passed, only data member values can be passed
d) Objects should be passed only if those are public in class
Answer: b
Explanation: There is no restriction on passing the number of objects to a function. The operating system or the compiler or
environment may limit the number of arguments. But there is no limit on number of objects till that limit.

13. What will be the output if all necessary code is included (Header files and main function)?

void test (Object &y)


{
y = "It is a string";
}
void main()
{
Object x = null;

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
test (x);
System.out.println (x);
}

a) Run time error

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Compile time error
c) Null
d) It is a string
Answer: d
Explanation: This is because the x object is passed by reference. The changes made inside the function will be applicable to
original function too.
14. In which type is new memory location will be allocated?
a) Only in pass by reference
b) Only in pass by value
c) Both in pass by reference and value
d) Depends on the code
Answer: b
Explanation: The new memory location will be allocated only if the object is passed by value. Reference uses the same memory

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Interview Questions and Answers for freshers focuses on “Overriding
Member Functions”.
1. Which among the following best describes member function overriding?
a) Member functions having same name in base and derived classes
b) Member functions having same name in base class only
c) Member functions having same name in derived class only
d) Member functions having same name and different signature inside main function
Answer: a
Explanation: The member function which is defined in base class and again in the derived class, is overridden by the definition
given in the derived class. This is because the preference is given more to the local members. When derived class object calls
that function, definition from the derived class is used.
2. Which among the following is true?
a) Inheritance must not be using when overriding is used

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

4. Exactly same declaration in base and derived class includes


a) Only same name
TU

b) Only same return type and name


c) Only same return type and argument list
K

d) All the same return type, name and parameter list


A

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&lt;&lt;i;
}
void print()
{
cout &lt;&lt;i;
}
};
class B
{
int j;
void show()
{
cout&lt;&lt;j;
}

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
};
a) show()
b) print()
c) show() and print()

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Compile time error
Answer: a
Explanation: The declaration must be exactly same in the derived class and base class. The derived class have defined show()
function with exactly same declaration. This then shows that the function in base class is being overridden if show() is called from
the object of class B.
6. How to access the overridden method of base class from the derived class?
a) Using arrow operator
b) Using dot operator
c) Using scope resolution operator
d) Can’t be accessed once overridden
Answer: c
Explanation: Scope resolution operator :: can be used to access the base class method even if overridden. To access those,
first base class name should be written followed by the scope resolution operator and then the method name.

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

a) Non – virtual or static methods can’t be overridden


b) Non – virtual and static methods only can be overridden
A

c) Overriding is not allowed


e/

d) Overriding must be implemented using C++ code only


t.m

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

b) Method overriding is not supported


c) Method overriding is done with directive override
d) Method overriding is done with the directive virtually
Answer: c
Explanation: This is possible but only if the method to be overridden is marked as dynamic or virtual. It is inbuilt restriction of
programming language. This is done to reduce the accidental or unintentional overriding.
11. What should be used to call the base class method from the derived class if function overriding is used in Java?
a) Keyword super
b) Scope resolution
c) Dot operator
d) Function name in parenthesis
Answer: a
Explanation: The keyword super must be used to access base class members. Even when overriding is used, super must be

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
used with the dot operator. The overriding is possible.
12. In Kotlin, the function to be overridden must be
a) Private
b) Open
c) Closed

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Abstract
Answer: b
Explanation: The function to be overridden must be open. This is a condition in Kotlin for any function to be overridden. This
avoids accidental overriding.
13. Abstract functions of a base class
a) Are overridden by the definition in same class
b) Are overridden by the definition in parent class
c) Are not overridden generally
d) Are overridden by the definition in derived class
Answer: d
Explanation: The functions declared to be abstract in base class are redefined in derived classes. That is, the functions are
overridden by the definitions given in the derived classes. This must be done to give at least one definition to each undefined
function.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Interview Questions and Answers focuses on “Passing and Returning
Object with Functions”.
1. In how many ways can an object be passed to a function?
a) 1
b) 2
c) 3
d) 4
Answer: c
Explanation: The objects can be passed in three ways. Pass by value, pass by reference and pass by address. These are the
general ways to pass the objects to a function.
2. If an object is passed by value
a) A new copy of object is created implicitly
b) The object itself is used

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

address of the object.


_N

4. If an object is passed by reference, the changes made in the function


a) Are reflected to the main object of caller function too
TU

b) Are reflected only in local scope of the called function


c) Are reflected to the copy of the object that is made during pass
K

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

function whenever any modification is done.

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

b) Yes, must be called


c) No, since no constructor was called
ht

d) No, since same object gets used


Answer: b
Explanation: Even though the constructor is not called when the object is passed to a function, the copy of the object is still
created, where the values of the members are same. When the object have to be destroyed, the destructor is called to free the
memory and resources that the object might have reserved.
6. When an object is returned by a function, a is automatically created to hold the return value.
a) Temporary object
b) Virtual object
c) New object
d) Data member
Answer: a
Explanation: The temporary object is created. It holds the return value. The values gets assigned as required, and the temporary
object gets destroyed.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Is the destruction of temporary object safe (while returning object)?
a) Yes, the resources get free to use
b) Yes, other objects can use the memory space
c) No, unexpected side effects may occur

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) No, always gives rise to exceptions
Answer: c
Explanation: The destruction of temporary variable may give rise to unexpected logical errors. Consider the destructor which
may free the dynamically allocated memory. But this may abort the program if another is still trying to copy the values from that
dynamic memory.
8. How to overcome the problem arising due to destruction of temporary object?
a) Overloading insertion operator
b) Overriding functions can be used
c) Overloading parenthesis or returning object
d) Overloading assignment operator and defining copy constructor
Answer: d
Explanation: The problem can be solved by overloading the assignment operator to get the values that might be getting returned
while the destructor free the dynamic memory. Defining copy constructor can help us to do this in even simpler way.

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.

10. What will be the output of the following code?


oo
_B
Class A
es

{
int i;
ot

public : A(int n)
_N

{
i=n; cout&lt;&lt;”inside constructor ”;
TU

}
~A()
{
K

cout&lt;&lt;”destroying ”&lt;&lt;i;
A

}
void seti(int n)
e/

{
t.m

i=n;
}
/

int geti()
s:/

{
return I;
tp

}
ht

};
void t(A ob)
{
cout&lt;&lt;”something ”;
}
int main()
{
A a(1);
t(a);
cout&lt;&lt;”this is i in main ”;
cout&lt;&lt;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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) something destroying 2this is i in main destroying 1
Answer: a
Explanation: Although the object constructor is called only ones, the destructor will be called twice, because of destroying the
copy of the object that is temporarily created. This is the concept of how the object should be passed and manipulated.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
11. It is necessary to return the object if it was passed by reference to a function.
a) Yes, since the object must be same in caller function
b) Yes, since the caller function needs to reflect the changes
c) No, the changes are made automatically
d) No, the changes are made explicitly
Answer: c
Explanation: Having the address being passed to the function, the changes are automatically made to the main function. In all the
cases if the address is being used, the same memory location will be updated with new values.
12. How many objects can be passed to a function simultaneously?
a) Only 1
b) Only an array
c) Only 1 or an array
d) As many as required

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

b) No, 2 objects will be created


_N

c) Yes, Scopes are different


d) Yes, life span is different
TU

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Multiple Choice Questions & Answers focuses on “Private Member
Functions”.
1. Which is private member functions access scope?
a) Member functions which can only be used within the class
b) Member functions which can used outside the class
c) Member functions which are accessible in derived class
d) Member functions which can’t be accessed inside the class
Answer: a
Explanation: The member functions can be accessed inside the class only if they are private. The access is scope is limited to
ensure the security of the private members and their usage.
2. Which among the following is true?
a) The private members can’t be accessed by public members of the class
b) The private members can be accessed by public members of the class

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/

keyword is followed by normal function declaration.


t.m

5. If private member functions are to be declared in C++ then


a) private: <all private members>
/
s:/

b) private <member name>


c) private(private member list)
tp

d) private :- <private members>


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Only 7
c) Only 255
d) As many as required
Answer: d
Explanation: There are no conditions applied on the number of private member functions that can be declared in a class. Though

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
the system may restrict use of too many functions depending on memory.
8. How to access a private member function of a class?
a) Using object of class
b) Using object pointer
c) Using address of member function
d) Using class address
Answer: c
Explanation: Even the private member functions can be called outside the class. This is possible if address of the function is
known. We can use the address to call the function outside the class.
9. Private member functions
a) Can’t be called from enclosing class
b) Can be accessed from enclosing class
c) Can be accessed only if nested class is private

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

a) Call a public member function which calls private function


b) Call a private member function which calls private function
TU

c) Call a protected member function which calls private function


d) Not possible
K

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

13. Which error will be produced if private members are accessed?


a) Can’t access private message
b) Code unreachable
c) Core dumped
d) Bad code
Answer: a
Explanation: The private members access from outside the class produce an error. The error states that the code at some line
can’t access the private members. And denies the access terminating the program.
14. Can main() function be made private?
a) Yes, always
b) Yes, if program doesn’t contain any classes
c) No, because main function is user defined
d) No, never

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: The reason given in option “No, because main function is user defined” is wrong. The proper reason that the main
function should not be private is that it should be accessible in whole program. This makes the program flexible.

15. If a function in java is declared private then it

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Can’t access the standard output
b) Can access the standard output
c) Can’t access any output stream
d) Can access only the output streams
Answer: b
Explanation: The private members can access any standard input or output. There is no restriction on access to any input or
output stream. And since standard input can also be used hence only accessing the output stream is not true.

To practice 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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Problems focuses on “Types of Member Functions”.
1. How many types of member functions are possible in general?
a) 2
b) 3
c) 4
d) 5
Answer: d
Explanation: There are basically 5 types of member functions possible. The types include simple, static, const, inline, and friend
member functions. Any of these types can be used in a program as per requirements.
2. Simple member functions are
a) Ones defined simply without any type
b) Ones defined with keyword simple
c) Ones that are implicitly provided

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?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Functions defined inside the class only
b) Functions with keyword inline only
c) Functions defined outside the class
d) Functions defined inside the class or with the keyword inline

Answer: d

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The functions which are defined with the keyword inline or are defined inside the class are treated to be inline
functions. Definitions inside the class are implicitly made inline if none of the complex statements are used in the definition.
8. What are friend member functions (C++)?
a) Member function which can access all the members of a class
b) Member function which can modify any data of a class
c) Member function which doesn’t have access to private members
d) Non-member functions which have access to all the members (including private) of a class
Answer: d
Explanation: A non-member function of a class which can access even the private data of a class is a friend function. It is an
exception on access to private members outside the class. It is sometimes considered as a member functions since it has all
the access that a member function in general have.
9. What is the syntax of a const member function?
a) void fun() const {}

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

11. Member functions


a) Must be defined inside class body
TU

b) Can be defined inside class body or outside


c) Must be defined outside the class body
K

d) Can be defined in another class


A

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) stop
c) open
d) state
Answer: a
Explanation: The static keyword is used to declare any static member function in a class. The static members become common

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
to each object of the class being created. They share the same values.
15. Which keyword is used to define the inline member function?
a) no keyword required
b) inline
c) inlined
d) line
Answer: b
Explanation: The inline keyword is used to defined the inline member functions in a class. The functions are implicitly made inline
if defined inside the class body, but only if they doesn’t have any complex statement inside. All functions defined outside the
class body must be mentioned with an explicit inline keyword.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Abstract Class”.
1. Which among the following best describes abstract classes?
a) If a class has more than one virtual function, it’s abstract class
b) If a class have only one pure virtual function, it’s abstract class
c) If a class has at least one pure virtual function, it’s abstract class
d) If a class has all the pure virtual functions only, then it’s abstract class
Answer: c
Explanation: The condition for a class to be called abstract class is that it must have at least one pure virtual function. The
keyword abstract must be used while defining abstract class in java.
2. Can abstract class have main() function defined inside it?
a) Yes, depending on return type of main()
b) Yes, always

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

4. If a class is extending/inheriting another abstract class having abstract method, then


a) Either implementation of method or making class abstract is mandatory
TU

b) Implementation of the method in derived class is mandatory


c) Making the derived class also abstract is mandatory
d) It’s not mandatory to implement the abstract method of parent class
K
A

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:/

a) Program won’t run as all the methods are not defined by B


b) Program won’t run as C is not inheriting A directly
tp

c) Program won’t run as multiple inheritance is used


ht

d) Program runs correctly


Answer: d
Explanation: The program runs correctly. This is because even class B is abstract so it’s not mandatory to define all the virtual
functions. Class C is not abstract but all the virtual functions have been implemented will that class.
6. Abstract classes can instances.
a) Never have
b) Always have
c) Have array of
d) Have pointer of
Answer: a
Explanation: When an abstract class is defined, it won’t be having the implementation of at least one function. This will restrict the
class to have any constructor. When the class doesn’t have constructor, there won’t be any instance of that class.
7. We to an abstract class.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Can create pointers
b) Can create references
c) Can create pointers or references
d) Can’t create any reference, pointer or instance

Answer: c

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: Even though there can’t be any instance of abstract class. We can always create pointer or reference to abstract
class. The member functions which have some implementation inside abstract itself can be used with these references.
8. Which among the following is an important use of abstract classes?
a) Header files
b) Class Libraries
c) Class definitions
d) Class inheritance
Answer: b
Explanation: The abstract classes can be used to create a generic, extensible class library that can be used by other
programmers. This helps us to get some already implemented codes and functions that might have not been provided by the
programming language itself.
9. Use of pointers or reference to an abstract class gives rise to which among the following feature?
a) Static Polymorphism

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.

11. Abstract class can’t be final in java.


TU

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. How many abstract classes can a single program contain?
a) At most 1
b) At least 1
c) At most 127
d) As many as required

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: There is no restriction on the number of abstract classes that can be defined inside a single program. The
programs can use as many abstract classes as required. But the functions with no body must be implemented.
15. Is it necessary that all the abstract methods must be defined from an abstract class?
a) Yes, depending on code
b) Yes, always
c) No, never
d) No, if function is not used, no definition is required
Answer: b
Explanation: That is the rule of programming language that each function declared, must have some definition. There can’t be
some abstract method that remains undefined. Even if it’s there, it would result in compile time error.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on ”
Abstract Function”.
1. Which among the following best defines the abstract methods?
a) Functions declared and defined in base class
b) Functions only declared in base class
c) Function which may or may not be defined in base class
d) Function which must be declared in derived class
Answer: b
Explanation: The abstract functions must only be declared in base class. Their definitions are provided by the derived classes. It
is a mandatory condition.
2. Which among the following is true?
a) The abstract functions must be only declared in derived classes
b) The abstract functions must not be defined in derived classes

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

4. Which among the following is correct?


a) Abstract functions should not be defined in all the derived classes
TU

b) Abstract functions should be defined only in one derived class


c) Abstract functions must be defined in base class
d) Abstract functions must be defined in all the derived classes
K
A

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

other derived classes.


5. It is to define the abstract functions.
/
s:/

a) Mandatory for all the classes in program


b) Necessary for all the base classes
tp

c) Necessary for all the derived classes


ht

d) Not mandatory for all the derived classes


Answer: c
Explanation: The derived classes must define the abstract function of base class in their own body. This is a necessary
condition. Because the abstract functions doesn’t contain any definition in base class and hence becomes mandatory for the
derived class to define them. All the functions in a program must have some definition.
6. The abstract function definitions in derived classes is enforced at
a) Runtime
b) Compile time
c) Writing code time
d) Interpreting time
Answer: b
Explanation: When the program is compiled, these definitions are checked if properly defined. This compiler also ensure that the
function is being defined by all the derived classes. Hence we get a compile time error if not done.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. What is this feature of enforcing definitions of abstract function at compile time called?
a) Static polymorphism
b) Polymorphism
c) Dynamic polymorphism
d) Static or dynamic according to need

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: c
Explanation: The feature is known as Dynamic polymorphism. Because the definitions are resolved at runtime. Even though the
definitions are checked at compile time, they are resolved at runtime only.
8. What is the syntax for using abstract method?
a) <access-modifier>abstract<return-type>method_name (parameter)
b) abs<return-type>method name (parameter)
c) <access-modifier>abstract return-type method name (parameter)
d) <access-modifier>abstract <returning> method name (parameter)
Answer: a
Explanation: The syntax must firstly contain the access modifier. Then the keyword abstract is written to mention clearly to the
compiler that it is an abstract method. Then prototype of the function with return type, function name and parameters.
9. If a function declared as abstract in base class doesn’t have to be defined in derived class then
a) Derived class must define the function anyhow

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

11. Which among the following is true?


TU

a) Abstract methods can be static


b) Abstract methods can be defined in derived class
c) Abstract methods must not be static
K

d) Abstract methods can be made static in derived class


A

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:/

a) It must have different prototype in the derived class


b) It must have same prototype in both base and derived class
tp

c) It must have different signature in derived class


ht

d) It must have same return type only


Answer: b
Explanation: The prototype must be the same. This is to override the function declared as abstract in base class. Or else it will
not be possible to override the abstract function of base class and hence we get a compile time error.
13. If a class have all the abstract methods the class will be known as
a) Abstract class
b) Anonymous class
c) Base class
d) Derived class
Answer: a
Explanation: The classes containing all the abstract methods are known as abstract classes. And the abstract classes can never
have any normal function with definition. Hence known as abstract class.
14. The abstract methods can never be in a base class.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Private
b) Protected
c) Public
d) Default

Answer: a

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The base class must not contain the abstract methods. The methods have to be derived and defined in derived
class. But if it is made private it can’t be inherited. Hence we can’t declare it as a private member.
15. The abstract method definition can be made in derived class.
a) Private
b) Protected
c) Public
d) Private, public, or protected
Answer: d
Explanation: The derived class implements the definition of the abstract methods of base class. Those can be made private in
derived class if security is needed. There won’t be any problem in declaring it as private.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Abstraction”.
1. Which among the following best defines abstraction?
a) Hiding the implementation
b) Showing the important data
c) Hiding the important data
d) Hiding the implementation and showing only the features
Answer: d
Explanation: It includes hiding the implementation part and showing only the required data and features to the user. It is done to
hide the implementation complexity and details from the user. And to provide a good interface in programming.
2. Hiding the implementation complexity can
a) Make the programming easy
b) Make the programming complex

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

5. Abstraction gives higher degree of


a) Class usage
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Object
c) Inheritance
d) Interfaces
Answer: b
Explanation: Object can be viewed as abstraction of data and code. It uses data members and their functioning as data

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
abstraction. Code abstraction as use of object of inbuilt class.
8. Abstraction principle includes
a) Use abstraction at its minimum
b) Use abstraction to avoid longer codes
c) Use abstraction whenever possible to avoid duplication
d) Use abstraction whenever possible to achieve OOP
Answer: c
Explanation: Abstraction principle includes use of abstraction to avoid duplication (usually of code). It this way the program
doesn’t contain any redundant functions and make the program efficient.
9. Higher the level of abstraction, higher are the details.
a) True
b) False

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

11. In terms of stream and files


ot

a) Abstraction is called a stream and device is called a file


_N

b) Abstraction is called a file and device is called a stream


c) Abstraction can be called both file and stream
d) Abstraction can’t be defined in terms of files and stream
TU

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

d) Data is not sufficient to decide what is being used


ht

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. Which among the following is not a level of abstraction?
a) Logical level
b) Physical level
c) View level
d) External level

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: Abstraction is generally divided into 3 different levels, namely, logical, physical and view level. External level is not
defined in terms of abstraction.
15. Using higher degree of abstraction
a) May get unsafe
b) May reduce readability
c) Can be safer
d) Can increase vulnerability
Answer: c
Explanation: It will make the code safer. One may think it reduces the readability, but the fact is, it actually helps us understand
the code better. We don’t have to read the complex code which is of no use in understanding the program.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Access
Specifiers”.
1. How many types of access specifiers are provided in OOP (C++)?
a) 1
b) 2
c) 3
d) 4
Answer: c
Explanation: Only 3 types of access specifiers are available. Namely, private, protected and public. All these three can be used
according to the need of security of members.
2. Which among the following can be used together in a single class?
a) Only private
b) Private and Protected together

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/

But since nothing is specified we call it to default access.


t.m

5. Which specifier allows a programmer to make the private members which can be inherited?
a) Private
/
s:/

b) Default
c) Protected
tp

d) Protected and default


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Public
c) Protected
d) Default
Answer: b
Explanation: The implicit constructor will always be public. Otherwise the class wouldn’t be able to have instances. In turn, no

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
objects will be created and the class can only be used for inheritance.

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:/

12. If an abstract class has all the private members, then


tp

a) No class will be able to implement members of abstract class


ht

b) Only single inheritance class can implement its members


c) Only other enclosing classes will be able to implement those members
d) No class will be able to access those members but can implement.
Answer: a
Explanation: The classes which inherit the abstract class, won’t be able to implement the members of abstract class. The private
members will not be inherited. This will restrict the subclasses to implement those members.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
available from outside the class.
14. Which access specifier is usually used for data members of a class?
a) Private
b) Default

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Protected
d) Public
Answer: a
Explanation: All the data members should be made private to ensure the highest security of data. In special cases we can use
public or protected access, but it is advised to keep the data members private always.
15. Which specifier should be used for member functions of a class?
a) Private
b) Default
c) Protected
d) Public
Answer: d
Explanation: It is always advised that the member functions should be kept public so that those functions can be used from out of
the class. This is usually done to ensure that the features provided by the class can be used at its maximum.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Questions and Answers for Aptitude test focuses on “Member Operator
Function”.
1. Which among the following are valid ways of overloading the operators?
a) Only using friend function
b) Only using member function
c) Either member functions or friend functions can be used
d) Operators can’t be overloaded
Answer: c
Explanation: The operators can be overloaded by using the member function or even the friend functions can be used. This is
because both of these can access all the data members of a class.
2. Which among the following is mandatory condition for operators overloading?
a) Overloaded operator must be member function of the left operand
b) Overloaded operator must be member function of the right operand

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

b) Other operands are passed to compiler implicitly


c) Other operands must be passed using another member function
K

d) Other operands are passed as function arguments


A

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Why the left parameter is removed from parameter list?
a) Because it is of no use
b) Because it is never used in definitions
c) Because it becomes parameter pointed by *this

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Because it can’t be referred by *this pointer
Answer: c
Explanation: The left object is removed from being passed as a parameter, because it is implicitly passed. It is passed implicitly
because it is considered the object with respect to which the overloading function is being called.
8. Which object’s members can be called directly while overloading operator function is used (In function definition)?
a) Left operand members
b) Right operand members
c) All operand members
d) None of the members
Answer: a
Explanation: This is because the left operand is passed implicitly. It is pointed by *this. This in turn means we can use the direct
member names of the object because those are again converted to a syntax containing *this pointer implicitly.

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

11. Where in the parameter list is the implicit *this is added?


A

a) Right most parameter


b) Anywhere in parameter list
e/

c) Left most parameter


t.m

d) Not added to parameter list


Answer: c
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: Only the modulus operator among the given operators can be overloaded using either friend function or member
function. Other operators must be overloaded using only the member functions.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) True
b) False
Answer: b
Explanation: It is not the case that all the operators can be overloaded using the member operator overloading. There are some
cases where the operators must be overloaded using the friend function only. The reason behind is that the left operand should
be passed *this pointer, but the left operand in these cases might be object of some other class. Hence can’t be done.
15. Which operator among the following must be overloaded using the friend function?
a) << operator only
b) >> operator only
c) Both << and >> operators
d) It’s not mandatory to use friend function in any case
Answer: c
Explanation: In some cases it is mandatory to use the friend functions for overloading the operators. Here both the << and >>

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Assigning Objects”.
1. When value of an object is assigned to another object
a) It becomes invalid statement
b) Its values gets copied into another object
c) Its values gets address of the existing values
d) The compiler doesn’t execute that statement
Answer: b
Explanation: The values get copied to another object. No address is assigned to the object values. This is uses copy constructor
to copy the values.
2. If an object is created and another object is assigned to it, then
a) Copy constructor is called to copy the values
b) Object is copied directly to the object

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

4. Predict the output of the program.

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;&lt;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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: c
Explanation: While defining a copy constructor, we use reference const parameter, those are used for the assignment. The
assignment operator may or may not be defined by the programmer, if not, compiler implicitly defines member wise copy
assignment operator.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
6. Declaring a copy constructor doesn’t suppresses the compiler generated copy assignment operator.
a) True
b) False
Answer: a
Explanation: Even if the programmer doesn’t define or even if they define the copy constructor. The compiler still generates a
copy assignment operator. It doesn’t gets suppressed.
7. In copy constructor definition, if non const values are accepted only
a) Only const objects will be accepted
b) Only non – const objects are accepted
c) Only const members will not get copied
d) Compiler generates an error
Answer: b
Explanation: Only the non – const objects will be accepted by the compiler. If a const object is passed, the compiler produces an

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

b) Doesn’t changes its use, whatever the syntax might be


c) Assignment takes place in declaration and assignment syntax
ot

d) Doesn’t work in normal syntax, but only with declaration


_N

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

a) Can be made visible to specific objects


b) Will be specific to one object only
e/

c) From any object will be visible in all


t.m

d) Doesn’t changes the values of all objects


Answer: c
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: Only the reference value can be assigned to another reference value. This is because both deal with the address.
There is no type mismatch hence we can assign them.
13. Assigning reference to an object
a) Will create another copy of the object
b) Will create two different copies of the object

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Will not create any other copy of the object
d) Will not refer to the object
Answer: c
Explanation: When an object is assigned with another object. Same memory location is used. There is no other copy of the
object created.
14. Which among the following is true?
a) We can use direct assignment for any object
b) We can use direct assignment only for different class objects
c) We must not use direct assignment
d) We can use direct assignment to same class objects
Answer: d
Explanation: The direct assignment can be used with the same class objects. There is no restriction on them. But better if the
program have a predefined copy assignment operator.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Automatic Variable”.
1. What are automatic variables?
a) Global variables
b) Implicit/temporary variables
c) Local variables
d) System variables
Answer: c
Explanation: The local variables are also known as automatic variables. The variables in any local scope that are created and
destroyed as the program executes its scope.
2. The memory for automatic variables
a) Have to be allocated and deallocated explicitly
b) Are allocated and deallocated automatically

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

4. Which among the following is true for automatic variables in general?


a) Automatic variables are invisible to called function
TU

b) Automatic variables are always visible to the called function


c) Automatic variables can’t interact with the called function
d) Automatic variables can’t be variable
K
A

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

5. If an automatic variable is created and then a function is called then


a) The automatic variable created gets destroyed
/
s:/

b) The automatic variable doesn’t get destroyed


c) The automatic variable may or may not get destroyed
tp

d) The automatic variable can’t be used in this case


ht

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. The static variables of a function
a) Are also automatic variables
b) Are not automatic variables
c) Are made automatic by default
d) Can be made automatic explicitly

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: b
Explanation: The static members can’t be automatic. This is because the automatic variables are created and destroyed with
each call to a specific function. But the static members remain throughout the execution of program once created.
8. All variables declared within a block
a) Are not always automatic
b) Can be made non-automatic
c) Are static by default
d) Are automatic by default
Answer: d
Explanation: The variables declared inside a block, are make automatic by default. This is to ensure that the variables get
destroyed when not required. The variables remain live only till those are required, the life is dependent on the scope of a
variable.
9. What values does uninitialized automatic variables contain?

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

11. Does java contain auto or register keywords?


a) Yes, for declaring every type of variable
K

b) Yes, only to declare cache registers


c) No, because java doesn’t support automatic variables
A

d) No, java supports local variable concept


e/
t.m

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

12. The automatic variables


ht

a) Must be declared after its use


b) Must be declared before using
c) Must be declared, can be anytime
d) Must not be initialized
Answer: b
Explanation: All the automatic variables in a program must be declared before their use. The compiler won’t allow any use of
variable if those are not declared before their use.
13. Which error is produced if the automatic variables are used without declaration?
a) Undefined symbol
b) Memory error
c) Type mismatch
d) Statement missing
Answer: a
Explanation: If the automatic variables are used without declaration or are used before the declaration then the compiler throws

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
an error. The error that the symbol is undefined. The compiler must know everything before that can be used.
14. In Perl, using which operator are the local variables created?
a) Dot
b) Arrow

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Scope resolution
d) my
Answer: d
Explanation: The language perl supports local variables but the concept is bit different. And if the values are not assigned to the
local variables then it contains undef value.
15. How are automatic variables different from the instance variables?
a) Automatic variables are initialized automatically but instances are not
b) Automatic variables are given zero values initially and not instances
c) Instance variables have to be initialized explicitly and automatic implicitly
d) Instance variables are initialized implicitly while automatic are not
Answer: d
Explanation: The automatic variables have to be initialized explicitly. But in case of instances, those are initialized automatically
during execution of the program. The conventions are mandatory.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Base
Class”.
1. Which is most appropriate definition of a base class?
a) It is parent of any of its derived class
b) It is child of one of the parent class
c) It is most basic class of whole program
d) It is class with maximum number of members
Answer: a
Explanation: A class which is parent of another class, or from which other classes can be derived, is known as a base class. It is
mandatory that a class must have at least one derived class to be called as a base class.
2. A base class is also known as class.
a) Basic
b) Inherited

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

4. How many base classes can a single class inherit in java?


a) 1
TU

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

5. How to make a derived class a base class?


a) Change name of the class
/
s:/

b) Use keyword base


c) Make a class derive from it
tp

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Member functions
c) Access specifiers
d) Nothing
Answer: d
Explanation: Even a class that doesn’t have any members can be a base class. It is not mandatory to have any member or

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
attribute in base class.
8. Which type of members can’t be accessed in derived classes of a base class?
a) Protected
b) Private
c) Public
d) All can be accessed
Answer: b
Explanation: The private members can be accessed only inside the base class. If the class is derived by other classes. Those
members will not be accessible. This concept of OOP is made to make the members more secure.
9. If a class is enclosing more than one class, than it can be called as base class of those classes.
a) True
b) False

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

b) Yes, but not always


c) No, never
d) No, but we can call in some cases
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: This is because C++ allows multiple inheritance. A derived class can have more than one base class and hence
can derive all of their features.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) True
b) False
Answer: b
Explanation: The base class can be added with new members without affecting the subclasses. This is because the subclasses
may get some more features inherited but it won’t use them. But the base class will be able to use the new members as would
be required.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Questions and Answers for Campus interviews focuses on “Extern
Variable”.
1. What is extern variable?
a) Variables to be used that are declared in another object file
b) Variables to be used that are declared in another source file
c) Variables to be used that are declared in another executable file
d) Variables to be used that are declared in another program
Answer: b
Explanation: The variables that are declared in another source file can be accessed in other files using extern variables. The
extern variables must be mentioned explicitly. The source file is included to use its variables.
2. Which among the following is a correct statement for variables?
a) Variable can be declared many times
b) Variable can be declared only one time

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

4. To use extern variable


a) The source file must not be included in the new file code
TU

b) The source file itself must be used for a new program


c) The source file must be included in the new file
d) The source file doesn’t matter for extern variables
K
A

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

5. What does a header file contain for an extern variable?


a) Only declaration of variables
/
s:/

b) Only definition of variables


c) Both declaration and definition of variables
tp

d) Neither declaration nor definition


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) extern can’t be used
c) function is extern by default
d) it can’t be made extern
Answer: c
Explanation: Even if we don’t specify a function to be extern, by default all the functions are exter. The compiler adds the keyword

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
at the beginning of the function declaration. If there is an extern function to be used then it will be used otherwise the new function
only will be used.
8. Even if a variable is not declared as extern, it is extern by default.
a) True
b) False
Answerr: b
Explanation: The statement is false. The variables are not extern by default. If those are made extern by default, then the memory
will never be allocated for those extern variables. Hence we make the variables extern explicitly.
9. Which of the following results in the allocation of memory for the extern variables?
a) Declaration
b) Definition
c) Including file
d) Memory is not allocated for extern variables

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

mentioned by which it will be used in the program.


ot

11. Which is the correct syntax for extern function declaration?


_N

a) extern function_name(argument_list);
b) extern return_type function_name(argument_list);
c) extern (return_type)function_name(argument_list);
TU

d) return_type extern function_name(argument_list);


K

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

12. What will be the output of the program?


/
s:/

extern int var;


int main(void)
tp

{
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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) The extern variable must contain two definitions
d) Extern variable can’t be used in the program
Answer: a
Explanation: The program runs successfully. This is because only one definition of any variable is allowed. And hence the
definition from the source file that is included will be used.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. If extern variable is initialized with the declaration then
a) Also the header file with definition is required
b) The header file with definition must be included
c) There is no need to include any other header file for definition
d) The extern variable produces compile time error
Answer: c
Explanation: When the value for the extern variable is defined with its declaration, then there is no need to include any file for the
definition of the variable. The Initialization acts as a definition for the extern variable in the file itself.
15. Why are functions extern by default?
a) Because functions are always private
b) Because those are not visible throughout the program
c) Because those can’t be accessed in all parts of the program
d) Because those are visible throughout the program

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Catching Class Types”.
1. Which among the following is true for class exceptions?
a) Only base class can give rise to exceptions
b) Only derived class can give rise to exceptions
c) Either base class or derived class may produce exceptions
d) Both base class and derived class may produce exceptions
Answer: d
Explanation: It’s not mandatory that either base class or derived class can give rise to exceptions. The exceptions might get
produced from any class. The exceptions depends on code.
2. If both base and derived class caught exceptions
a) Then catch block of derived class must be defined before base class
b) Then catch block of base class must be defined before the derived class

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

4. The catching of base class exception in java.


a) After derived class is not allowed by compiler
TU

b) Before derived class is not allowed by compiler


c) Before derived class is allowed
d) After derived class can’t be done
K
A

Answer: b
Explanation: The catching of base class exception before derived class is not allowed in java. The compiler itself doesn’t allow
e/

this declaration. It produces an error.


t.m

5. If catching of base class exception is done before derived class in C++


a) It gives compile time error
/
s:/

b) It doesn’t run the program


c) It may give warning but not error
tp

d) It always gives compile time error


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Java 5
c) Java 6
d) Java 7
Answer: d
Explanation: None of the languages used to support multiple exception catch in a single catch block. Since java 7 the feature

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
was added to catch more than one exceptions in one catch block.
8. To catch more than one exception in one catch block, how are the exceptions separated in the syntax?
a) Vertical bar
b) Hyphen
c) Plus
d) Modulus
Answer: a
Explanation: Just the way we separate the arguments in a function definition using comma. Here we separate the exceptions by
using a vertical bar or we call it pipe symbol sometimes. This is just a convention followed to separate different exception list.
9. If a catch block accepts more than one exceptions then
a) The catch parameters are not final
b) The catch parameters are final
c) The catch parameters are not defined

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

11. If classes produce some exceptions, then


_N

a) Their respective catch block must be defined


b) Their respective catch blocks are not mandatory
TU

c) Their catch blocks should be defined inside main function


d) Their catch blocks must be defined at the end of program
K

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

12. Which among the following is true?


a) Only the base class catch blocks are important
b) Only the derived class catch blocks are important
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) False
Answer: b
Explanation: There is no specific condition that states that only base class catch box can handle more than one exception in
single box. Even the derived class catch clocks can handle more than one exceptions.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
15. Which condition among the following might result in memory exception?
a) False if conditions
b) Nested if conditions that are all false
c) Infinite loops
d) Loop that runs exactly 99 times
Answer: c
Explanation: The infinite loops doesn’t stop running once started. There must be a way to stop the loop but that is always an
improper termination. Infinite loops may keep on using more memory and hence would result in memory error.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Class
Use”.
1. Which among the following is the main characteristic of class?
a) Inheritance
b) Encapsulation
c) Polymorphism
d) Object creation
Answer: b
Explanation: The classes are made to encapsulate the data and properties that are most similar and can be grouped together
inside a single class. This single class can represent all of those features by creating its instances.
2. To group all the brands of cars, what should be used?
a) Class
b) Structure

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

a) Define a class to store details of each employee


A

b) Define a structure to store details of each employee


c) Define separate variable for each detail
e/

d) Define a generic type to store string and number details


t.m

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

5. Which class represents the most abstracted information?


a) Nested
ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
allowed to be encapsulated. Hence classes can represent an entity in a better way.
7. Which among the following is a feature of class?
a) Object orientation
b) Procedure orientation

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Both object and procedure orientation
d) Neither object nor procedure orientation
Answer: a
Explanation: Thee use of classes feature the object oriented programming. The OOP concept can be implemented by using
class and their objects. Procedures orientation is not a feature of OOP.
8. Class is of an object.
a) Basic function definition
b) Detailed description with values
c) Blueprint
d) Set of constant values
Answer: c
Explanation: The class is an overview for an object. It contains the basic details map of data that an object will contain. An object
is independent representation of class.

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

b) Provide predefined functions


c) Provide predefined data and functions
ot

d) Provide predeclared data to be overridden


_N

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

11. Which feature is exhibited by the inbuilt classes?


a) Code reusability
e/

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

12. Why do we use user defined classes?


a) To design a user intended code
b) To model real world objects
c) To design the interfaces
d) To model the functions
Answer: b
Explanation: The primitive classes are not sufficient for the programming complex algorithms. Some user defined classes are
required to represent a real world object and to define a blueprint of what the class should actually contain. The user defined
classes are as per the requirements and need of user.

13. Why do classes use accessor methods?


a) To make public data accessible to client
b) To make public data private to client
c) To make private data public for whole program
d) To make private data accessible to the client

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: The private data of a class is usually not accessible. But the data can be accessed by the user using accessor
functions. These functions allows the user to get the data stored as private in a class.

14. Why do classes use mutator methods?

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Allows client to modify the program
b) Allows client to modify/write the private members
c) Allows servers to access all the private data
d) Allows servers to access only protected members
Answer: b
Explanation: The client can have rights to access a file and write something to it. This is mandatory to keep the private data
updated. Also it is an advantage over the use of hidden class members.
15. Which among the following is the most abstract form of class?
a) Cars
b) BMW cars
c) Big cars
d) Small cars
Answer: a

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Classes”.
1. Which of the following is not type of class?
a) Abstract Class
b) Final Class
c) Start Class
d) String Class
Answer: c
Explanation: Only 9 types of classes are provided in general, namely, abstract, final, mutable, wrapper, anonymous, input-output,
string, system, network. We may further divide the classes into parent class and subclass if inheritance is used.
2. Class is pass by
a) Value
b) Reference

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

used. It is actually made to increase the privacy of data.


ot

4. Which is most appropriate comment on following class definition?


_N

class Student
{
TU

int a;
public : float a;
K

};
A

a) Error : same variable name can’t be used twice


e/

b) Error : Public must come first


t.m

c) Error : data types are different for same variable


d) It is correct
/
s:/

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

5. Which is known as a generic class?


a) Abstract class
b) Final class
c) Template class
d) Efficient Code
Answer: c
Explanation: Template classes are known to be generic classes because those can be used for any data type value and the
same class can be used for all the variables of different data types.
6. Size of a class is
a) Sum of the size of all the variables declared inside the class
b) Sum of the size of all the variables along with inherited variables in the class
c) Size of the largest size of variable
d) Classes doesn’t have any size

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: Classes doesn’t have any size, actually the size of object of the class can be defined. That is done only when an
object is created and its constructor is called.
7. Which class can have member functions without their implementation?
a) Default class

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) String class
c) Template class
d) Abstract class
Answer: d
Explanation: Abstract classes can have member functions with no implementation, where the inheriting subclasses must
implement those functions.
8. Which of the following describes a friend class?
a) Friend class can access all the private members of the class, of which it is a friend
b) Friend class can only access protected members of the class, of which it is a friend
c) Friend class don’t have any implementation
d) Friend class can’t access any data member of another class but can use it’s methods
Answer: a
Explanation: A friend class can access all the private members of another class, of which it is a friend. It is a special class

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

b) Member functions can be defined inside or outside the class body


A

c) Member functions need not be declared inside the class definition


d) Member functions can be made friend to another class using the friend keyword
e/
t.m

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:/

12. Which syntax for class definition is wrong?


tp

a) class student{ };
b) student class{ };
ht

c) class student{ public: student(int a){ } };


d) class student{ student(int a){} };
Answer: b
Explanation: Keyword class should come first. Class name should come after keyword class. Parameterized constructor
definition depends on programmer so it can be left empty also.
13. Which of the following pairs are similar?
a) Class and object
b) Class and structure
c) Structure and object
d) Structure and functions
Answer: b
Explanation: Class and structure are similar to each other. Only major difference is that a structure doesn’t have member
functions whereas the class can have both data members and member functions.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. Which among the following is false for class features?
a) Classes may/may not have both data members and member functions
b) Class definition must be ended with a colon
c) Class can have only member functions with no data members
d) Class is similar to union and structures

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: b
Explanation: Class definition must end with a semicolon, not colon. Class can have only member functions in its body with no
data members.
15. Instance of which type of class can’t be created?
a) Anonymous class
b) Nested class
c) Parent class
d) Abstract class
Answer: d
Explanation: Instance of abstract class can’t be created as it will not have any constructor of its own, hence while creating an
instance of class, it can’t initialize the object members. Actually the class inheriting the abstract class can have its instance
because it will have implementation of all members.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Constructors Overloading”.
1. Which among the following is true for constructors overloading?
a) Constructors can’t be overloaded
b) Constructors can be overloaded using different signatures
c) Constructors can be overloaded with same signatures
d) Constructors can be overloaded with different return types
Answer: b
Explanation: The constructors can be overloaded only if the definitions have different signatures. Constructors doesn’t have any
return type so can’t be overloaded using return type. If constructors have same signature then it will produce a compile time error.

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

the default constructors. So defining the default constructor is not mandatory.


ot

4. Which among the following is true?


_N

a) The constructors overloading can be done by using different names


b) The constructors overloading can be done by using different return types
c) The constructors can be overloaded by using only one argument
TU

d) The constructors must have the same name as that of class


K

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

5. Which among the following can be used in place of default constructor?


a) constructorName(int x, int y=0)
b) constructorName(int x=0, int y=0)
/
s:/

c) constructorName(int x=0, int y)


d) constructorName(int x, int y)
tp

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)

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) constructorName(default int x=0)
c) constructorName(int x=0)
d) constructorName()
Answer: c
Explanation: The constructors using the default arguments must initialize the arguments in the argument list. This is to make the

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
constructor use the default value when no arguments are passed. If no arguments are listed then it is a default constructor.

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

b) int className(int x, char c, char d);


c) className(int x, char c, int y);
K

d) char className(char c,int x);


A

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:/

12. Which constructor definition will produce a compile time error?


a) className(int x=0);
tp

b) className(char c);
ht

c) className(int x=0,char c);


d) className(char c,int x=0);
Answer: c
Explanation: The default arguments, just like with member functions, must be listed at last in the argument list. Hence this will
produce a compile time error. The compiler doesn’t allow the definition to be executed.
13. If there is a constructor with all the default arguments and arguments are not passed then
a) The default values given will not be used
b) Then all the null values will be used
c) Then all the default values given will be used
d) Then compiler will produce an error
Answer: c
Explanation: The constructors will use the default values listed for use. The null values are not used because those are not
specified. Though if it was compiler provided default constructor, then it would have initialized the members to null or zero values.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. Which is the correct statement for default constructors?
a) The constructors with all the default arguments
b) The constructors with all the null and zero values
c) The constructors which can’t be defined by programmer
d) The constructors with zero arguments

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: The closest answer to the question is that a default constructor is a constructor with zero arguments. But this is not
the actual case. Actually the constructors provided by the compiler are default constructors. And the constructors with zero
arguments defined by the programmer are zero argument constructors.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Constructors”.
1. Which among the following is called first, automatically, whenever an object is created?
a) Class
b) Constructor
c) New
d) Trigger
Answer: b
Explanation: Constructors are the member functions which are called automatically whenever an object is created. It is a
mandatory functions to be called for an object to be created as this helps in initializing the object to a legal initial value for the
class.
2. Which among the following is not a necessary condition for constructors?
a) Its name must be same as that of class

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

constructor is optional, if you are not using any other constructor.


_N

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

d) Any access specifier will work


A

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Default constructor must be defined, if parameterized constructor is defined and the object is to be created without arguments.
a) True
b) False

Answer: a

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: If the object is create without arguments and only parameterized constructors are used, compiler will give an error
as there is no default constructor defined. And some constructor must be called so as to create an object in memory.

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

a) The argument object is passed by reference


b) It can be defined with zero arguments
ot

c) Used when an object is passed by value to a function


_N

d) Used when a function returns an object


Answer: b
TU

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

11. If the object is passed by value to a copy constructor?


A

a) Only public members will be accessible to be copied


e/

b) That will work normally


t.m

c) Compiler will give out of memory error


d) Data stored in data members won’t be accessible
/
s:/

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

12. Which object will be created first?

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
in the sequence of how the objects are mentioned. This is done in sequence.
13. Which among the following helps to create a temporary instance?
a) Implicit call to a default constructor
b) Explicit call to a copy constructor
c) Implicit call to a parameterized constructor

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Explicit call to a constructor
Answer: d
Explanation: Explicit call to a constructor can let you create a temporary instance. This is because the temporary instances
doesn’t have any name. Those are deleted from memory as soon as their reference is removed.

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

that one argument with assignment operator.


TU

15. For constructor overloading, each constructor must differ in and


a) Number of arguments and type of arguments
b) Number of arguments and return type
K

c) Return type and type of arguments


A

d) Return type and definition


e/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Data
Members”.
1. What is the term used to indicate the variable and constants of a class?
a) Data members
b) Variables of class
c) Data characters
d) Constants
Answer: a
Explanation: The variables inside a class are termed data members of the class. It is not a mandatory rule but variables are used
to refer to usual variables used in functions or globally. The term is given because the values stored in those variables represent
some kind of data related to class.
2. Data members (C++)
a) Can be initialized with declaration in classes

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

c) The structure must be predefined


A

d) The structure type data members can’t be used


e/

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:/

5. How many data members can a class contain?


a) 27
tp

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. To create a pointer to a private data member of a class, outside the class, which among the following is correct?
a) Return the address of the private data member using a member function
b) Access the private member using a pointer outside class
c) Declare the member as pointer inside the class
d) Not possible to create pointer to a private member

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: We can call a public member function and return the address of any private data member. Though the pointer being
returned must be defined inside class itself. And the returned address can be stored in a pointer.
8. Which among the following is true for use of setter() and getter() function?
a) Considered best for manipulating data values
b) Considered the only proper way to manipulate the values
c) Considered specially for private members manipulation
d) Considered a red flag, and not recommended for large scale use
Answer: d
Explanation: This concept of getter and setter functions is not acceptable if used too much. This is considered to be
inappropriate in OOP perspective. Though it is commonly used, it doesn’t work according to OOP concepts at some higher level
of understanding.

9. What is the output of following code?

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

10. The static member functions can only use


e/

a) Static data members


t.m

b) Private data members


c) Protected data members
/

d) Constant data members


s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: b
Explanation: The keyword const can be used anywhere to make the variable have same value all the time. This restriction is
made to use the same value whenever required. Also, this can restrict accidental changes.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
13. Which data members can be inherited but are private to a class?
a) Private
b) Protected
c) Protected and Static
d) Privately inherited
Answer: b
Explanation: Static members inheritance also depends on the type of specifier they have. Only the protected members can be
inherited but remain private to class. If static members are defined in private access, they won’t be allowed for inheritance.
14. The arguments passed to member functions by reference are considered as data members of class.
a) True
b) False
Answer: b
Explanation: This is a wrong statement. As only the data defined inside class is considered as its member. But even if a variable

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Default
Arguments”.
1. What are default arguments?
a) Arguments which are not mandatory to be passed
b) Arguments with default value that aren’t mandatory to be passed
c) Arguments which are not passed to functions
d) Arguments which always take same data value
Answer: b
Explanation: The arguments which are assigned with some default value. Since some value is already given, it is not mandatory
to pass those arguments. They can be used directly.
2. Which is the correct condition for the default arguments?
a) Those must be declared as last arguments in argument list
b) Those must be declared first in the argument list

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

4. Which among the following function can be called without arguments?


a) void add(int x, int y=0)
TU

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

c) The function can use any value whichever is higher


d) The function will choose the minimum values
Answer: a
Explanation: The function will use the values passed explicitly to it. The default values will be ignored. The default values are used
only in case the values are not passed explicitly to the function.
6. Which among the following is correct?
a) void test(int x=0, int y, int z=0)
b) void test(int x=0, int=0)
c) void test(int x, int y=0)
d) void test(int x=’c, int y)
Answer: c
Explanation: The default arguments must be mentioned at last in the argument list. Also, the type of values assigned must match
with the argument type. All the default arguments must be mentioned at last, none of the normal arguments should come in
between the default arguments list.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. What function will be called with the independent syntax “test(5,6,7);”?
a) void test(int x, int y)
b) void test(int x=0, int y, int z)
c) int test(int x=0, y=0, z=0)

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) void test(int x, int y, int z=0)
Answer: d
Explanation: There are three arguments that are getting passed to the function test(). Only the last option have all the default
argument at last in the argument list. And the total number of the arguments is three. The third option is wrong because the return
type is int and the syntax given is independent which means it doesn’t return any value.

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

a) Those are not allowed with a declaration of pointer to functions


b) Those are not allowed with the reference to functions
ot

c) Those are not allowed with the typedef declarations


_N

d) Those are allowed with pointer and reference to function declaration


Answer: d
TU

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

statement to the rules defined for default arguments.


A

11. The non-template functions can be added with default arguments to already declared functions
e/

a) If and only if the function is declared again in the same scope


t.m

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Checked for feasibility
Answer: c
Explanation: The names given to the default arguments are bound at time of declaration but are only checked for accessibility
and to get bounded. This is mainly to bind those members during declaration.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. The default argument get bound during declaration
a) And are never executed
b) And are executed simultaneously
c) But are executed only if priority is given
d) But are executed during function call
Answer: d
Explanation: The default argument are bound at the time of declaration. That is an implicit functioning. But those are executed
only when the function is called. Otherwise, those will never get executed.
15. The virtual function overrides
a) Do not acquire base class declaration of default arguments
b) Do acquire base class declaration of default arguments
c) Do not link with the default arguments of base class
d) Do link with the default argument but only of derived classes

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Delete
Operator”.
1. What is a delete operator?
a) Deallocates a block of memory
b) Deallocates whole program memory
c) Deallocates only primitive data memory
d) Deallocates all the data reserved for a class
Answer: a
Explanation: The delete operator is the reverse process of a new operator. It deallocates all the memory allocated for an object.
The object can be of any type. The delete operator completely destroys an object so that the resources can be used for other
purposes.
2. If an object is allocated using new operator
a) It should be deleted using delete operator

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

done in reverse way as that new operator works.


_N

4. Which type of value has resulted from the delete operator?


a) void
TU

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:/

a) Then out of memory error arises


b) Then unreachable code error arises
tp

c) Then unpredictable errors may arise


ht

d) Then undefined variable error arises


Answer: c
Explanation: When the delete operator is used with the objects that were not allocated using new operator then unpredictable
errors may arise. This is because the delete can’t perform the required actions on the type of memory allocated for the object.
6. Delete operator
a) Can be used on pointers with null value
b) Can be used on pointers with void value
c) Can be used on pointer with value 0
d) Can be used on pointer with any value
Answer: c
Explanation: The delete operator can be used on pointers with the value 0. This actually means that when new operator fails and
return value 0 then deleting the result of failed new remains harmless. Hence the deletion is possible.
7. When delete operator is used (If object has a destructor)

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Object destructor is called after deallocation
b) Object destructor is called before deallocation
c) Object destructor is not used
d) Object destructor can be called anytime during destruction

Answer: b

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The destructor is called before the memory is deallocated for any object. The destructor call initiates the destruction
process and the deallocation of memory takes place.
8. If delete is applied to an object whose l-value is modifiable, then after the object is deleted.
a) Its value is defined as null
b) Its value is defined as void
c) Its value is defined as 0
d) Its value is undefined
Answer: d
Explanation: After performing delete operation on an object whole l-value is modifiable, its values becomes undefined. This is
done so as to denote that the memory space is available to be used for other purposes.
9. How many variants of delete operator are available?
a) Only 1
b) Only 2

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

the memory that was acquired by the object.


ot

11. Which is the correct syntax to delete an array of objects?


_N

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:/

c) delete [] on an object and delete on object array


d) Undefined result is never produced
tp

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Global user defined function is invoked
d) Local function to delete object is called
Answer: a
Explanation: The global delete operator is called to delete the objects that are not of class type. Class type includes class, union
or struct. All objects of these types can be deleted using the global delete operator.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
15. The delete operator
a) Can be defined for each class
b) Can’t be defined for each class
c) Can be defined globally only
d) Can’t be defined in a program explicitly
Answer: a
Explanation: The delete operator can be defined for each class explicitly. If there is a class for which delete is not defined then
the global delete operator is used. The definition of delete operator for each class is not necessary.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Derived Class”.
1. Which among the following is best definition of a derived class?
a) A child class
b) A class which inherits one or more classes
c) A class with keyword derived
d) A class with more than one constructor
Answer: b
Explanation: Any class which inherits one or more classes is a derived class. The only condition is it must inherit at least one
class in order to be called as a derived class.
2. Which among the following is inherited by a derived class from base class?
a) Data members only
b) Member functions only

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Friend function of base class can access derived class members
c) Friend function of derived class can access members of only derived class
d) Friend function can access private members of base class of a derived class
Answer: a
Explanation: The friend function of a class can access the non-private members of base class. The reason behind is that the

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
members of base class gets derived into the derived class and hence become members of derived class too. Hence a friend
function can access all of those.
8. If a class is being derived using more than two base classes, which inheritance will be used?
a) Single
b) Multi-level
c) Hierarchical
d) Multiple
Answer: d
Explanation: The statement given is the definition of multiple inheritance with respect to the derived class. The concept can be
illustrated with many other samples but the main aspects are base class and derived class only.
9. Derived class is also known as class.
a) Subclass
b) Small class

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

b) Must become another abstract class or define


c) Must become parent class for
K

d) Must implement 2 definitions of


A

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

defined as abstract of implement the function definition in it.


12. How many classes can be derived from a derived class?
/
s:/

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.

13. The members of a derived class can never be derived.


a) True
b) False
Answer: b
Explanation: This is not true that the members of a derived class can’t be derived. All the classes are considered to be a normal
class when used for derivation. The members can be derived with respect to their access specifiers.
14. Which feature is not related to the derived classes among the following?
a) Inheritance

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Encapsulation
c) Run time memory management
d) Compile time function references
Answer: c
Explanation: The memory management is the feature that is not necessary for derived classes that will be a part of whole

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
program. The functions references must be resolved for their proper use if inheritance is used.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on ”
Destructors”.
1. Which among the following describes a destructor?
a) A special function that is called to free the resources, acquired by the object
b) A special function that is called to delete the class
c) A special function that is called anytime to delete an object
d) A special function that is called to delete all the objects of a class
Answer: a
Explanation: It is used to free the resources that the object might had used in its lifespan. The destructors are called implicitly
whenever an object’s life ends.
2. When a destructor is called?
a) After the end of object life
b) Anytime in between object’s lifespan

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

b) ~B() then ~C() then ~A()


c) ~A() then ~B() then ~C()
K

d) ~C() then ~A() then ~B()


A

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

a) ~A(), ~B(), ~C()


b) ~B(), ~C(), ~A()
c) ~A(), ~C(), ~B()
d) ~C(), ~B(), ~A()
Answer: d
Explanation: In multiple inheritance, the constructors are called in the sequence of how they are written in inheritance sequence.
And the destructors will be called in the reverse order. This can be cross verified just by printing a message from each destructor
defined in classes.
6. When is the destructor of a global object called?
a) Just before end of program
b) Just after end of program
c) With the end of program
d) Anytime when object is not needed

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: This is because the lifespan of global object is from start of the program, till the end of the program. And hence
program end is the end of global object too. Just before the end of program, the destructor will be called to free the acquired
resources by the objects.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. How the constructors and destructors can be differentiated?
a) Destructor have a return type but constructor doesn’t
b) Destructors can’t be defined by the programmer, but constructors can be defined
c) Destructors are preceded with a tilde (~) symbol, and constructor doesn’t
d) Destructors are same as constructors in syntax
Answer: c
Explanation: The destructors are preceded with the tilde (~) symbol. The name is same as that of the class. These also doesn’t
have any return type.
8. Destructors doesn’t accept parameters.
a) True
b) False
Answer: a
Explanation: The destructors doesn’t accept the arguments. Those are just used to free up the resources.

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

resources are able to get free. And no resource is kept busy.


11. When is it advised to have user defined destructor?
K

a) When class contains some pointer to memory allocated in class


A

b) When a class contains static variables


c) When a class contains static functions
e/

d) When a class is inheriting another class only


t.m

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

b) Destructors can have only one parameter at maximum


c) Destructors are always called after object goes out of scope
d) There can be only one destructor in a class
Answer: d
Explanation: This is so because the destructors can’t be overloaded. And the destructor must have the same name as that of
class with a tilde symbol preceding the name of the destructor. Hence there can be only one destructor in a class. Since more
than one function with same name and signature can’t be present in same scope.

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;

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
C c;
a) ~A()
b) ~B()
c) ~C()
d) ~B() and ~C()

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: c
Explanation: The constructor that would have created at last, its destructor will be called first when the code goes out of scope.
This will help the program to manage the resources more efficiently.
14. When an object is passed to a function, its copy is made in the function and then
a) The destructor of the copy is called when function is returned
b) The destructor is never called in this case
c) The destructor is called but it is always implicit
d) The destructor must be user defined
Answer: a
Explanation: When an object is passed to a function, its copy is made in the function. This copy acts as a real object till the
function is live. When the function is returned, the copy’s destructor is called to free the resources held by it.
15. What happens when an object is passed by reference?
a) Destructor is not called

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Downcasting”.
1. What is downcasting?
a) Casting subtype to supertype
b) Casting supertype to subtype
c) Casting subtype to supertype and vice versa
d) Casting anytype to any other type
Answer: b
Explanation: The downcasting concept includes only the casting of supertypes to the sub types. This casting is generally done
explicitly. Larger size types are made to fit into small size types explicitly.
2. Which among the following is a mandatory condition for downcasting?
a) It must not be done explicitly
b) It must be done implicitly

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

c) Can result only in out of memory error


d) Can’t result in any error
K
A

Answer: a
Explanation: The result of downcasting can be unexpected. This is because downcasting is done on the objects into the objects
e/

which doesn’t contain any information of data in lateral object.


t.m

5. What should be used for safe downcast?


a) Static cast
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) null
c) void pointer
d) null pointer
Answer: d
Explanation: The null pointer is returned by the dynamic_cast, if it fails. The conversion sometimes fails because of too complex

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
type conversion. The conversion may also fail due to memory or some related issues.
8. Which is the proper syntax of dynamic_cast?
a) dynamic_cast(object)
b) dynamic_cast new (object)
c) dynamic_cast (object)
d) dynamic_cast(object)
Answer: c
Explanation: The dynamic_cast is the name of the operator, which is followed by the new type in which the object have to be
converted. Then the object name is given. This object name is then used after the type conversion.
9. Which is the exception handler for the exceptions of downcasting?
a) CastException
b) ClassCastingExeption
c) ClassCasting

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

whether the casting would be safe or not.


ot

11. Java supports direct downcasting.


_N

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

be checked for safe casting using instanceof function.


A

12. Which way the downcasting is possible with respect to inheritance?


e/

a) Upward the inheritance order


t.m

b) Downward the inheritance order


c) Either upward or downward the inheritance order
d) Order of inheritance doesn’t matter
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: c
Explanation: The downcasting can be used whenever there is a need to compare one object to another. Equals() function can be
used to compare whether the objects were of same age. We can use getClass() function too.

15. Why is downcasting possible in any language?

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Because inheritance follows has-a relationship
b) Because inheritance follows is-a relationship
c) Because inheritance doesn’t follow any relationship
d) Because inheritance is not involved in casting
Answer: b
Explanation: The downcasting is possible because the classes in inheritance follow is-a relationship. Hence the derived class is
a base class. Which in turn make the downcasting possible.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Encapsulation”.
1. Which among the following best describes encapsulation?
a) It is a way of combining various data members into a single unit
b) It is a way of combining various member functions into a single unit
c) It is a way of combining various data members and member functions into a single unit which can operate on any data
d) It is a way of combining various data members and member functions that operate on those data members into a single unit
Answer: d
Explanation: It is a way of combining both data members and member functions, which operate on those data members, into a
single unit. We call it a class in OOP generally. This feature have helped us modify the structures used in C language to be
upgraded into class in C++ and other languages.
2. If data members are private, what can we do to access them from the class object?
a) Create public member functions to access those data members

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

4. Which feature can be implemented using encapsulation?


a) Inheritance
K

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:/

5. Find which of the following uses encapsulation?


tp

a) void main(){ int a; void fun( int a=10; cout<<a); fun(); }


ht

b) class student{ int a; public: int b;};


c) class student{int a; public: void disp(){ cout<<a;} };
d) struct topper{ char name[10]; public : int marks; }
Answer: c
Explanation: It is the class which uses both the data members and member functions being declared inside a single unit. Only
data members can be there in structures also. And the encapsulation can only be illustrated if some data/operations are
associated within class.
6. Encapsulation helps in writing classes in java.
a) Mutable
b) Abstract
c) Wrapper
d) Immutable
Answer: d
Explanation: Immutable classes are used for caching purpose generally. And it can be created by making the class as final and

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
making all its members private.
7. Which among the following should be encapsulated?
a) The data which is prone to change is near future
b) The data prone to change in long terms

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) The data which is intended to be changed
d) The data which belongs to some other class
Answer: a
Explanation: The data prone to change in near future is usually encapsulated so that it doesn’t get changed accidentally. We
encapsulate the data to hide the critical working of program from outside world.
8. How can Encapsulation be achieved?
a) Using Access Specifiers
b) Using only private members
c) Using inheritance
d) Using Abstraction
Answer: a
Explanation: Using access specifiers we can achieve encapsulation. Using this we can in turn implement data abstraction. It’s
not necessary that we only use private access.

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

b) Using access declaration for public members of base class


c) Using access declaration for local variable of main() function
ot

d) Using access declaration for global variables


_N

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/

b) Using char* string pointer to be passed to non-member function


t.m

c) Using object array


d) Using any kind of pointer/array address in passing to another function
/
s:/

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;

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
}
a) This code is good to go
b) This code may result in undesirable conditions
c) This code will generate error

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) This code violates encapsulation
Answer: d
Explanation: This code violates the encapsulation. By this code we can get the address of the private member of the class,
hence we can change the value of private member, which is against the rules.

13. Consider the code and select the wrong choice.

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

15. Using encapsulation data security is


a) Not ensured
TU

b) Ensured to some extent


c) Purely ensured
K

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Questions and Answers for Entrance exams focuses on “Virtual Functions”.

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

4. Which keyword is used to declare virtual functions?


TU

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:/

a) Twice in base class


b) Derived class
tp

c) Base class and derived class


ht

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. In which access specifier should a virtual function be defined?
a) Private
b) Public
c) Protected
d) Default

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: b
Explanation: The virtual functions must be defined in public section of a class. This is to ensure that the virtual function is
available everywhere in the program. Also to avoid any error while resolving the method.
8. Virtual functions can never be made
a) Static function
b) Parameterized function
c) Default argument function
d) Zero parameter function
Answer: a
Explanation: The virtual function must not be static. Those functions are the property of individual objects and not of a class as a
whole. The functions should not be made common for all the objects of that class.
9. Virtual functions can’t be made friend function of other classes.
a) True

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

11. Which among the following is true for virtual functions?


a) Prototype must be different in base and derived class
TU

b) Prototype must be same in base class and derived class


c) Prototype must be given only in base class
d) Prototype must have different signature in base and derived class
K
A

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. Which among the following is true?
a) A class may have virtual destructor but not virtual constructor
b) A class may have virtual constructor but not virtual destructor
c) A class may have virtual constructor and virtual constructor
d) A class may have either virtual destructor or virtual constructor

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: Any class can contain virtual destructor. But is not possible to define a virtual constructor. The reason behind is that
the destructors can be overridden but constructors should not be.
15. If virtual function of base class is redefined in derived class then
a) It must be declared virtual in derived class also
b) It may or may not be declared virtual in derived class
c) It can must not be declared virtual in derived class
d) It must be declared normally in derived class
Answer: b
Explanation: The virtual functions may or may not be declared virtual in derived class. This is because if the overriding function
defined in derived class is not declared virtual explicitly, the compiler makes it virtual implicitly.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Exception Handling”.
1. What is an exception?
a) Problem arising during compile time
b) Problem arising during runtime
c) Problem in syntax
d) Problem in IDE
Answer: b
Explanation: The problems that might occur during execution of a program are known as exceptions. The exceptions are
unexpected sometimes and can be predicted. Also, the exceptions should be always considered for a better program.
2. Why do we need to handle exceptions?
a) To prevent abnormal termination of program
b) To encourage exception prone program

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

manage. If the input is invalid the program gets terminated.


_N

4. If a file that needs to be opened is not found in the target location then
a) Exception will be produced
TU

b) Exceptions are not produced


c) Exception might get produced because of syntax
K

d) Exceptions are not produced because of logic


A

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Which are the two blocks that are used to check error and handle the error?
a) Try and catch
b) Trying and catching
c) Do and while
d) TryDo and Check

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: Two blocks that are used to check for errors and to handle the errors are try and catch block. The code which might
produce some exceptions is placed inside the try block and then the catch block is written to catch the error that is produced.
The error message or any other processing can be done in catch block if the error is produced.
8. There can be a try block without catch block but vice versa is not possible.
a) True
b) False
Answer: a
Explanation: The try block may or may not have any catch block. But a catch block can’t be there in a program if there is no try
block. It is like else-block can only be written if and only if if-block is present in the program.
9. How many catch blocks can a single try block can have?
a) Only 1
b) Only 2

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

11. To catch the exceptions


a) An object must be created to catch the exception
TU

b) A variable should be created to catch the exception


c) An array should be created to catch all the exceptions
d) A string have to be created to store the exception
K
A

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

12. Multiple catch blocks


a) Are mandatory for each try block
/
s:/

b) Can be combined into a single catch block


c) Are not possible for a try block
tp

d) Can never be associated with a single try block


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) InputOutputExceptions
c) IOExceptions
d) ExceptionsIO
Answer: c
Explanation: There is a specific class to handle each type of exceptions that might be produced in a program. The input and

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
output exceptions can be handled by an object of class IOExcceptions. This class handles all type of input and output exceptions.
15. Why do we use finally block?
a) To execute the block if exception occurred
b) To execute a code when exception is not occurred
c) To execute a code whenever required
d) To execute a code with each and every run of program
Answer: d
Explanation: Sometimes there is a need to execute a set of code every time the program runs. Even if the exception occurs and
even if it doesn’t, there can be some code that must be executed at end of the program. That code is written in finally block. This
block is always executed regardless of exceptions occurring.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Questions and Answers for Experienced people focuses on “Execution of
Constructor or Destructor”.
1. Which among the following best describes the constructors?
a) A function which is called whenever an object is referenced
b) A function which is called whenever an object is created to initialize the members
c) A function which is called whenever an object is assigned to copy the values
d) A function which is called whenever an object is to be given values for members
Answer: b
Explanation: The constructors are special type of functions which are called whenever an object is created. This is to initialize the
data members of the class. The constructor allocates memory space for all the data members.
2. Which among the following best describes destructor?
a) A function which is called just before the objects are destroyed
b) A function which is called after each reference to the object

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

4. Which among the following is correct syntax for the destructors?


a) classname()
TU

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/

the tilde symbol (~).


t.m

5. Which among the following is true?


a) First the constructor of parent classes are called in sequence of inheritance
/
s:/

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

d) Constructors are called randomly


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Can’t have any argument
c) Can have more than one argument
d) Can’t have more than 3 arguments
Answer: b
Explanation: The destructors doesn’t have any arguments. The destructors have to be called implicitly whenever an object goes

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
out of scope. The user can’t pass argument to the implicit call.
8. Destructor calls (C++)
a) Are only implicit
b) Are only explicit
c) Can be implicit or explicit
d) Are made at end of program only
Answer: c
Explanation: The destructors are usually called implicitly whenever an object goes out of scope. The destructors can also be
called explicitly if required. The call must be made, implicitly or explicitly.
9. Number of destructors called are
a) Always equal to number of constructors called
b) Always less than the number of constructors called
c) Always greater than the number of constructors called

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

11. If a class have 4 constructors then it must have 4 destructors also.


_N

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

12. Which among the following is true for destructors?


A

a) Destructors can be overloaded


e/

b) Destructors can be define more than one time


t.m

c) Destructors can’t be overloaded


d) Destructors are overloaded in derived classes
/
s:/

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

13. The constructor


a) Have a return type
b) May have a return type
c) Of derived classes have return type
d) Doesn’t have a return type
Answer: d
Explanation: The constructors doesn’t have any return type. The constructors are intended to allocate the resources for the
object. Memory spaces are to be finalized.
14. The destructors
a) Have a return type
b) May have a return type
c) Of derived classes have return type
d) Doesn’t have a return type

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: The destructors are intended to free the memory space. And all the resources that were allocated for the object.
The return value is not supported since only memory has to be made free.
15. The destructor can be called before the constructor if required.
a) True

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) False
Answer: b
Explanation: The destructors can be called only after the constructor calls. It is not a mandatory rule but the deletion can only take
place if there is something created using the constructor.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Questions and Answers for Freshers focuses on “Overloading Member
Functions”.
1. What does memory allocation for objects mean?
a) Actual creation and memory allocation for object members
b) Creation of member functions
c) Creation of data members for a class
d) Actual creation and data declaration for object members
Answer: a
Explanation: The memory allocated for the object members indicates actual creation of the object members. This is known as
memory allocation for object.
2. Where is the memory allocated for the objects?
a) HDD
b) Cache

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

previously created object.


_N

4. Using new is type safe as


a) It require to be specified with type of data
TU

b) It doesn’t require to be specified with type of data


c) It requires the name of data
K

d) It allocated memory for the data


A

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

d) both malloc() and calloc()


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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) 20 Bytes
d) 18 Bytes
Answer: a
Explanation: The size of an object of the class given in question will be of size 22 bytes. This is because the size of an object is
always equal to the sum of sizes of the data members of the class, except static members.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Which keyword among the following can be used to declare an array of objects in java?
a) new
b) create
c) allocate
d) arr
Answer: a
Explanation: The keyword new can be used to declare an array of objects in java. The syntax must be specified with an object
pointer which is assigned with a memory space containing the required number of object space. Even initialization can be done
directly.
8. When is the memory allocated for an object gets free?
a) At termination of program
b) When object goes out of scope
c) When main function ends
d) When system restarts

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

10. Which function is called whenever an object goes out of scope?


_N

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

11. Which operator can be used to check the size of an object?


a) sizeof(objectName)
b) size(objectName)
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Its memory is allocated in heap
c) Its memory is allocated in HDD
d) Its memory is allocated in cache

Answer: a

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The memory for any data or object that are used in a user defined function are always allocated in the stack. This is
to ensure that the object is destroyed as soon as the function is returned. Also this ensures that the correct memory allocation
and destruction is performed.
14. In java takes care of managing memory for objects dynamically.
a) Free collector
b) Dust collector
c) Memory manager
d) Garbage collector
Answer: d
Explanation: The garbage collector in java takes care of the memory allocations and their deletions dynamically. When an object
is no more required then the garbage collector deletes the object and free up all the resources that were held by that object.
15. Which operator can be used to free the memory allocated for an object in C++?
a) Free()

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Hierarchical Inheritance”.
1. Which among the following is best to define hierarchical inheritance?
a) More than one classes being derived from one class
b) More than 2 classes being derived from single base class
c) At most 2 classes being derived from single base class
d) At most 1 class derived from another class
Answer: a
Explanation: When two or more classes get derived from a single base class, it is known as hierarchical inheritance. This gives
us freedom to use same code with different scopes and flexibility into different classes.
2. Do members of base class gets divided among all of its child classes?
a) Yes, equally
b) Yes, depending on type of inheritance

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

4. How many classes must be there to implement hierarchical inheritance?


a) Exactly 3
TU

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/

have common characteristics from base class.


t.m

5. Base class
a) Can be made abstract
/
s:/

b) Can’t be made abstract


c) Must be abstract
tp

d) If made abstract, compile time error


ht

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.

7. Which class uses hierarchical inheritance in following code?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
class A
{
int a;
};
class B:class A
{

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
int b;
};
class C:class A,class B
{
int c;
};
class D:class A
{
int d;
};
a) Class A, B, C
b) Class B, C, D
c) Class A, C, D
d) Class D, A, B

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&lt;&lt;a;
}
_N

};
class C:private A
TU

{
public void incr()
{
K

a++;
A

}
e/

}
void main()
t.m

{
B b.disp();
/
s:/

}
tp

a) Compile time error


b) Runtime error
ht

c) Program runs and o/p is 0


d) Program runs and o/p is garbage value
Answer: a
Explanation: The derived class D have not implemented the undefined function. Here the main concept involves hierarchical
inheritance with abstract base class.
9. How many classes can be derived from the base class using hierarchical inheritance?
a) As many as required
b) Only 7
c) Only 3
d) Up to 127
Answer: a
Explanation: The number of classes that can be derived from a base class doesn’t have any restriction and hence will be able to
derive as many classes as required. This feature gives more flexibility and code reusability.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
10. If one class have derived the base class privately then another class can’t derive the base class publically.
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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The classes are independent and can access the base class and inherit it in whichever way it is required. The
classes can use the base base class members privately or publically maintaining the security of data and methods.
11. Which among the following is true?
a) Hierarchical inheritance is subset of multiple inheritances
b) Hierarchical inheritance is strongest inheritance type
c) Hierarchical inheritance uses only 2 classes for implementation
d) Hierarchical inheritance allows inheritance of common features to more than one class
Answer: d
Explanation: Hierarchical inheritance is used to make all the inherited classes have some common features obtained from a
single base class. This allows all the classes to maintain a group or to be classified under one class.
12. Hierarchical inheritance can be a subset of
a) Hybrid inheritance
b) Multiple inheritance

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

b) Derived class constructor


c) Firstly created derived class constructor
d) Last created derived class constructor
K
A

Answer: a
Explanation: The base class must be initialised first hence the constructor of base class is called first. This makes everything
e/

ready for the new object being created.


t.m

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Hybrid
Inheritance”.
1. Which among the following best defines the hybrid inheritance?
a) Combination of two or more inheritance types
b) Combination of same type of inheritance
c) Inheritance of more than 7 classes
d) Inheritance involving all the types of inheritance
Answer: a
Explanation: When more than one type of inheritance are used together, it results in new type of inheritance which is in general
known as hybrid inheritance. This may of may not have better capabilities.
2. How many types of inheritance should be used for hybrid?
a) Only 1
b) At least 2

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

4. Diamond problem includes hybrid inheritance.


a) Hierarchical and Multiple
TU

b) Hierarchical and Hierarchical


c) Multiple and Multilevel
d) Single, Hierarchical and Multiple
K
A

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

5. If inheritance is done continuously, it is similar to tree structure.


a) Hierarchical
/
s:/

b) Multiple
c) Multilevel
tp

d) Hierarchical and Multiple


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Hierarchical
c) Multilevel
d) None
Answer: d
Explanation: The use of any specific type is not necessary. Though the final structure should not be the same, it should represent

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
more than one type of inheritance if class diagram is drawn.
8. The private member’s are made public to all the classes in inheritance.
a) True
b) False
Answer: b
Explanation: The private member’s scope can’t be changed and those can never be accessed in other classes. Only the class
containing private member’s can access its own members.

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:/

c) Only parent and parent


d) Base and Derived
tp

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Reverse of constructors being called
b) Reverse of classes being made
c) Reverse of objects being created
d) Reverse of code calling objects

Answer: a

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The destructors are always called in reverse order of constructors being called always. The type of inheritance
doesn’t matter. The only important concept is the sequence of classes being inherited.
15. Overloading operators are possible only by using hybrid inheritance.
a) True
b) False
Answer: b
Explanation: The overloading concept is not related to the types of inheritance being used. Overloading operators can be done
without using inheritance. You don’t even have to use more than one class for operator overloading.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Inbuilt
Classes”.
1. What are inbuilt classes?
a) The predefined classes in a language
b) The classes that are defined by the user
c) The classes which are meant to be modified by the user
d) The classes which can’t be used by the user
Answer: a
Explanation: The classes that are already provided in a programming language for use are inbuilt classes. These classes
provide some functions or objects that can be used by the programmer for easier code.
2. Inbuilt class
a) Must be included before use
b) Are not necessary to be included for use

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

4. Which among the following not an inbuilt class in C++?


a) System
TU

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/

contain some special functions to be used in programming.


t.m

5. What is the InputStream class meant for?


a) To handle all input streams
/
s:/

b) To handle all output streams


c) To handle all input and output streams
tp

d) To handle only input from file


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) To use the mathematical functions
c) To suppress the use of mathematical functions
d) To complex the calculations
Answer: b
Explanation: The Math class is provided with some special functions. These functions can be used to calculate and get result of

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
some special and usual mathematical functions. We don’t have to write the code to calculate the trigonometric function results,
instead we can use Math functions.
8. DataInputStream is derived from
a) StreamingInput
b) StreamedInput
c) StreameInput
d) StreamInput
Answer: d
Explanation: The DataInputStream is more specific class for operating on specific type of data inputs. This is used to read data
of specific type. The same can be used to read data in a specific format.
9. Which attribute can be used to get the size of an array?
a) Size.Array
b) Array.Size

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/

indicated the type of error occurred.


t.m

12. Which class contain runFinalization() method?


a) Finalize
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) out
c) in
d) put
Answer: d
Explanation: Put is not a System class variable. The most general and basic variables are err, out and in. The variables can

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
handle most of the tasks performed in a program.
15. Which package contains the utility classes?
a) java.lang
b) java.utility
c) java.util
d) java.io
Answer: c
Explanation: The package java.util contains all the utility classes. This package also contains generic data structures, date, time
etc. These can be used in any java program, you just have to include java.util package.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Inheritance”.
1. Which among the following best describes the Inheritance?
a) Copying the code already written
b) Using the code already written once
c) Using already defined functions in programming language
d) Using the data and functions into derived segment
Answer: d
Explanation: It can only be indicated by using the data and functions that we use in derived class, being provided by parent class.
Copying code is nowhere similar to this concept, also using the code already written is same as copying. Using already defined
functions is not inheritance as we are not adding any of our own features.
2. How many basic types of inheritance are provided as OOP feature?
a) 4

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

4. Which among the following is correct for multiple inheritance?


a) class student{public: int marks;}s; class stream{int total;}; class topper:public student, public stream{ };
b) class student{int marks;}; class stream{ }; class topper: public student{ };
K

c) class student{int marks;}; class stream:public student{ };


A

d) class student{ }; class stream{ }; class topper{ };


e/

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:/

5. Which programming language doesn’t support multiple inheritance?


tp

a) C++ and Java


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
be there.
7. Which is the correct syntax of inheritance?
a) class derived_classname : base_classname{ /*define class body*/ };
b) class base_classname : derived_classname{ /*define class body*/ };

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) class derived_classname : access base_classname{ /*define class body*/ };
d) class base_classname :access derived_classname{ /*define class body*/ };
Answer: c
Explanation: Firstly, keyword class should come, followed by the derived class name. Colon is must followed by access in which
base class has to be derived, followed by the base class name. And finally the body of class. Semicolon after the body is also
must.
8. Which type of inheritance leads to diamond problem?
a) Single level
b) Multi-level
c) Multiple
d) Hierarchical
Answer: c
Explanation: When 2 or more classes inherit the same class using multiple inheritance and then one more class inherits those

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

d) Only private members of base, become private of derived class


TU

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

add vulnerability in the program.


A

11. Members which are not intended to be inherited are declared as


e/

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

inheritance can only inherit protected and public members.


12. While inheriting a class, if no access mode is specified, then which among the following is true? (in C++)
a) It gets inherited publicly by default
b) It gets inherited protected by default
c) It gets inherited privately by default
d) It is not possible
Answer: c
Explanation: If the access mode is not specified during inheritance, the class is inherited privately by default. This is to ensure
the security of data and to maintain OOP features. Hence it is not mandatory to specify the access mode if we want the class to
be inherited privately.
13. If a derived class object is created, which constructor is called first?
a) Base class constructor
b) Derived class constructor
c) Depends on how we call the object

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Not possible
Answer: a
Explanation: First the base class constructor is invoked. When we create a derived class object, the system tries to invoke its
constructor but the class is derived so first the base class must be initialized, hence in turn the base class constructor is invoked

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
before the derived class constructor.
14. The private members of the base class are visible in derived class but are not accessible directly.
a) True
b) False
Answer: a
Explanation: Consider that a variable is private in base class and the derived class uses public inheritance to inherit that class.
Now if we also have a global variable of same name as that of base class private variable, neither the global variable nor the
base class private variable will be accessible from derived class. This is because we can’t have 2 variables with same name in
same local scope. Hence the private members are accessible but not directly.
15. How can you make the private members inheritable?
a) By making their visibility mode as public only
b) By making their visibility mode as protected only
c) By making their visibility mode as private in derived class

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “IO
Class”.
1. What is the use of IO class?
a) To handle all the input operations
b) To handle all the output operations
c) To handle all the input and output operations
d) To handle all the input and output to the standard input
Answer: c
Explanation: The IO class provides functions that can be used to handle input and output operations. All the inputs from standard
input and standard output, and also from the files can be handled. This gives the flexibility to make the programs more user
friendly.
2. IO class provides input and output through
a) Data streams

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

c) An abstract which can be used to represent path names or file


A

d) An abstract which can represent a file in any format


e/

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

b) A handle for program specific structure of an open file


ht

c) A handle for compiler specific structure of an open file


d) A handle for representing device files structure
Answer: a
Explanation: The machine specific structure of an open file have to be handled in some special ways. FileDescriptor class can
handle those files. The FileDescriptor can also handle open socket, another source, sink of bytes.
6. FileInputStream
a) Gets the input stream from any device file
b) Gets the input stream from any open socket
c) Gets the input stream from any cache
d) Gets the input stream from any open file only
Answer: d
Explanation: The most specific answer is that the FileInputStream can only be used for the opened files. The class can work only
for the file type. No socket or another source are allowed to be accessed.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. What does FilePermission class do?
a) This class is used to give permission rights to a file
b) This class is used to restrict the use of permissions
c) This class is used to represent device access permissions
d) This class is used to represent file access permissions

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: The FilePermission can’t get access to the device access permissions. The Permission is given to a file when it is
created or otherwise when a privileged user changes it. Then these permission rights can be accessed using the
FilePermission class.
8. Which class among the following makes incorrect assumptions?
a) LineNumberInputStream
b) LineNumberReader
c) LineReader
d) LineBuffer
Answer: a
Explanation: The LineNumberInputStream class makes false assumptions. The false assumption is that it assumes, all the byte
data is a character. Which is actually not the case, instead the character have one byte memory space.
9. Reader class is

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

to handle any case that involves the execution interrupt.


TU

11. StringReader handles


a) Any character stream
b) A character stream whose source is an array
K

c) A character stream whose source is character array


A

d) A character stream whose source is String only


e/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Write to a random access file
c) Read and write to a random access file
d) Restricts read and write to a random access file
Answer: c
Explanation: The RandomAccessFile class instance can be created to handle input and output operations to a random access

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
file. It first checks the permissions on the file and then any required operation can be done on a random access file.
Comparatively faster than other files access.
15. Which among the following is a serialization descriptor for any class?
a) StreamClass
b) ObjectStreamClass
c) ObjectStream
d) StreamObjectClass
Answer: b
Explanation: The ObjectStreamClass object can be created to handle serializations. The class is provided specially for the
serializations. It is descriptor like we have a file descriptor to handle/access files.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Local
Class”.
1. What are local classes?
a) Classes declared inside a package
b) Classes declared inside a function
c) Classes declared inside a class
d) Classes declared inside structure
Answer: b
Explanation: The classes declared inside a package are available to all the functions and classes, hence can’t be called local.
This is somewhat similar concept that we use to denote variables of a function. The classes declared inside functions will be
local to them.
2. All member functions of a local class must be
a) Defined outside class body

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

ambiguity in variables and their access rules.


4. Which type of data can a local class access from the function in which it is defined?
TU

a) Static and extern


b) Abstract and static
K

c) Void and extern


A

d) Const and static


e/

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. All the member functions of local classes are by default.
a) Static
b) Inline
c) Abstract

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Virtual
Answer: c
Explanation: All the members are defined inside the class body. And when the member functions are defined inside the class
body, they are made inline by default. If the definition is too complex, those are made normal functions.
8. The enclosing function has no special access to the members of the local class.
a) True
b) False
Answer: a
Explanation: This is a rule that the enclosing function doesn’t have any special access to the members of the local class. This is
done to maintain the security of class members. And to adhere to the rules of OOP.
9. Which language can use inheritance with local classes?
a) Kotlin

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

11. All the data members of local class must be


a) Defined with declaration
TU

b) Defined in constructor
c) Declared and defined in constructor
K

d) Declared using a member function


A

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

Then their definition must be given using the constructors.


12. Can two different functions have local class with same name?
/
s:/

a) Yes, since local


b) No, names must be different
tp

c) No, scope doesn’t work here


d) No, ambiguity arises
ht

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?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Yes, using object
b) Yes, using direct call
c) Yes, using pointer
d) No, can’t access

Answer: d

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The local classes are local to the specific enclosing function. Other functions can’t access the class. Even if the
pointers are used, the class must be alive when the pointer is used. But this will not happen if the enclosing function is returned.
15. Which among the following is the main advantage of using local classes?
a) Make program more efficient
b) Makes program execution faster
c) Helps to add extra functionality to a function
d) Helps to add more members to a function
Answer: c
Explanation: The closest answer is to add more functionalities to a function or to make some specific functions to be generic.
Adding more members to a function can be done directly but to add some special functionality that are encapsulated, can be
done using local classes.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ MCQs focuses on “Object Use”.
1. Which among the following is the main use of object?
a) To create instance of a function
b) To create instance of a program
c) To create instance of class
d) To create instance of structures
Answer: c
Explanation: The objects are used to create an instance of a class. Objects can represent a class in an independent form. The
basic blueprint, that contains the information of the type of data that can be stored in an object, is given by the class.
2. Which among the following is not a property of an object?
a) Identity
b) Properties
c) Attributes

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

more like a function rather than an object.


ot

4. Immutable object are used


_N

a) To set up as a fixed state


b) To set up variable object
TU

c) To set up an object of abstract class


d) To set up an object of derived class
K

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

5. Which object can be used to contain other objects?


a) First class object
b) Derived class object
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) The objects that are alive throughout the program
d) The objects that are created and then deleted without use
Answer: b
Explanation: If a class has only one object created and that is the only object of the class. Then the object is known as the
singleton object. But only if that object is the only object of the class and no other object is created for that class.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
8. Object cout and cin
a) Can be used directly with << and >> symbols respectively
b) Can be used directly with >> and << symbols respectively
c) Must be used as a function which accepts 2 arguments
d) Must be used as a function which accepts 3 arguments
Answer: a
Explanation: The cin and cout objects can be used directly with the >> and << operators respectively. The objects are of
iostream class. Class iostream is an inbuilt class.
9. Objects type
a) Can be changed in runtime
b) Can’t be changed in runtime
c) Can be changed in compile time
d) May or may not get changed

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

11. Objects can be used


a) To access any member of a class
ot

b) To access only public members of a class


_N

c) To access only protected members of a class


d) To access only private members of a class
TU

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

12. Which among the following is not a use of object?


e/

a) Defining a member function


t.m

b) Accessing data members


c) Creating instance of a class
d) Using class members
/
s:/

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

Objects can only access the members and use them.


13. Which object can be used to access the standard input?
a) System.inner
b) cin
c) System.stdin
d) console.input
Answer: b
Explanation: Object cin can be used to take input from the standard input. It is used in C++. In java we can use System.in for the
standard input stream. The syntax changes from language to language.
14. A single object can be used
a) As only two class types at a time
b) As only three class types at a time
c) As only one class type at a time
d) As of as many class types as required

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: c
Explanation: The object can be of only one type. The type of an object can’t be changed. Object type is mandatory to be of one
class type to ensure the type and number of data members it have.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Its compile time error
b) Its runtime error
c) It’s not an error
d) Program suns smooth
Answer: a
Explanation: It is a compile time error as the compiler doesn’t allow the same name objects to be declared more than once.
Compiler produces multiple declaration errors. Every object must have a different name.

To practice MCQs 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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Member Functions”.
1. Which among the following best describes member functions?
a) Functions which are defined within the class
b) Functions belonging a class
c) Functions in public access of a class
d) Functions which are private to class
Answer: b
Explanation: We can’t say that only functions that are defined inside class are member functions. There can be some inherited
functions. Though they doesn’t belong to the class but are property of the objects once inheritance is used. So the nearest
definition is functions belonging to a class.
2. How many types of member functions are generally there in C++?
a) 2

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

4. What are inline member functions?


a) Member functions which can be called without object
b) Member functions whose definition is expanded in place of its call
K

c) Member functions whose definition is faster than simple function


A

d) Member function which is defined in single line


e/

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. How to access members of the class inside a member function?
a) Using this pointer only
b) Using dot operator
c) Using arrow operator

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Used directly or with this pointer
Answer: d
Explanation: The members of a class can be used directly inside a member function. We can use this pointer when there is a
conflict between data members of class and arguments/local function variable names.
8. For overloading “( )”, “[ ]” or “->” operators, a class
a) Must use static member functions
b) Must use non-static member functions
c) Must be non-static member and should not be friend of class
d) Must use static member function or a friend member function
Answer: c
Explanation: For overloading those operators for a class, the class must use non-static member function so that doesn’t remain
common to all the objects, and each object can use it independently. The friend functions is also restricted so as to keep the
security of data.

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

c) To be made generic explicitly


d) Given default type as double
ot
_N

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

11. Member function of a class can


A

a) Access all the members of the class


b) Access only Public members of the class
e/

c) Access only the private members of the class


t.m

d) Access subclass members


Answer: a
/
s:/

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
13. A member function can of the same class.
a) Call other member functions
b) Call only private member functions
c) Call only static member functions
d) Call only const member functions

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: We can call one function inside another function to access some data of class. A public member function can be
used to call a private member function which directly manipulates the private data of class.
14. Which member function doesn’t require any return type?
a) Static
b) Constructor
c) Const
d) Constructor and destructor
Answer: d
Explanation: All the member functions work same as normal functions with syntax. But the constructor and destructor are also
considered as member functions of a class, and they never have any data type.
15. Which among the following is not possible for member function?
a) Access protected members of parent class

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Multilevel Inheritance”.
1. Which among the following best defines multilevel inheritance?
a) A class derived from another derived class
b) Classes being derived from other derived classes
c) Continuing single level inheritance
d) Class which have more than one parent
Answer: b
Explanation: Only if the class is being derived from other derived class, it can be called as multilevel inheritance. If a class is
derived from another class, it is single level inheritance. There must be more than one level of inheritance.

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

4. Which Class is having highest degree of abstraction in multilevel inheritance of 5 levels?


a) Class at 1st level
K

b) Class 2nd last level


A

c) Class at 5th level


d) All with same abstraction
e/
t.m

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:/

5. If all the classes use private inheritance in multilevel inheritance then


tp

a) It will not be called multilevel inheritance


b) Each class can access only non-private members of its parent
ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
the members available to all the new classes and to add their own functionalities. The code reusability is used too.
7. What is the minimum number of levels for a implementing multilevel inheritance?
a) 1
b) 2

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) 3
d) 4
Answer: c
Explanation: There must be at least 3 levels of inheritance. Otherwise if less, it will be single level inheritance or would have got
no inheritance implemented. There must be a derived class from which another class is derived.
8. In multilevel inheritance one class inherits
a) Only one class
b) More than one class
c) At least one class
d) As many classes as required
Answer: a
Explanation: The classes inherit only from one class. This continues as each class inherits only one class. There should not be
any class that inherits from two or more classes or which have more than one subclass.

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

c) At least one less than number of levels


d) Can’t be used
A
e/

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

d) Only object of first class can be created, which is first parent


Answer: b
Explanation: Each class constructor must be called before creating the object of any subclass. Hence it will be mandatory to call
the constructors of parent classes explicitly with parameters. This will make all the previous class member be initialized and then
the class in use will be able to create the object.
13. In multilevel inheritance, which is the most significant feature of OOP used?
a) Code readability
b) Flexibility
c) Code reusability
d) Code efficiency
Answer: c
Explanation: The classes using multilevel inheritance will use the code in all the subsequent subclasses if available. Hence the
most significant feature among the options given is code reusability. This feature is generally intended to use the data values

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
and reuse the redundant functions.

14. Does following code show multiple inheritance?

class A

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
{
int a;
};
class B
{
int b;
};
class C:public A, public B
{
int c;
};
class D:public C
{
int d;
};

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

d) No, Constructor must not be defined


ot

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Multiple
Inheritance”.
1. Multiple inheritance is
a) When a class is derived from another class
b) When a class is derived from two or more classes
c) When a class is derived from other two derived classes
d) When a class is derived from exactly one class
Answer: b
Explanation: The multiple inheritance is used when a class is being derived using two base classes or more. This way a single
class can have features of more than one classes inherited into a single unit. This lets us combine two class members into a
single class.
2. Which problem arises due to multiple inheritance, if hierarchical inheritance is used previously for its base classes?
a) Diamond

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

4. Which programming language restricts the use of multiple inheritance?


a) C++
TU

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

more secure and unambiguous way to implement multiple inheritance.


5. Is it possible to have all the abstract classes as base classes of a derived class from those?
/
s:/

a) Yes, always
b) Yes, only if derived class implements all the methods
tp

c) No, because abstract classes doesn’t have constructors


ht

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Why does diamond problem arise due to multiple inheritance?
a) Methods with same name creates ambiguity and conflict
b) Methods inherited from the superclass may conflict
c) Derived class gets overloaded with more than two class methods

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Derived class can’t distinguish the owner class of any derived method
Answer: a
Explanation: All the derived classes can distinguish the base class members, but if a method is being inherited to the base
classes from another class which again gets inherited into same class (diamond shape), that may create conflict in using the
function from two available.
8. How many base classes can a derived class have which is implementing multiple inheritance?
a) Only 2
b) At least 2
c) At most 2
d) As many as required
Answer: d
Explanation: The classes can derive from as many classes as required since the multiple inheritance feature is made to
combine or group together the functions that are from different classes. This make the derived class stronger in terms of its

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

a) Derived class object


b) Parent class objects
ot

c) Use Abstract derived class


_N

d) Derive a class from derived class


Answer: a
TU

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

a) There won’t be any use of multiple inheritance


e/

b) It will make those members public


t.m

c) Derived class can still access them in multiple inheritance


d) Compile time error
/
s:/

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

inheritable. It leads to no use of multiple inheritance.


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: When a class having nested classes is being derived into another class. It indirectly means a simple class is being
inherited to another class. This is single level inheritance.
14. Which members can’t be accessed in derived class in multiple inheritance?
a) Private members of base

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Public members of base
c) Protected members of base
d) All the members of base
Answer: a
Explanation: The private member’s are available for only the class containing those members. Derived classes will have access
to protected and public members only.
15. Can the derived class be made abstract if multiple inheritance is used?
a) No, because other classes must be abstract too
b) Yes, if all the functions are implemented
c) Yes, if all the methods are predefined
d) No, since constructors won’t be there
Answer: d
Explanation: The derived class must not be abstract. This is because the abstract classes doesn’t have constructor and hence

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Nested
Class”.
1. Which among the following best describes a nested class?
a) Class inside a class
b) Class inside a function
c) Class inside a package
d) Class inside a structure
Answer: a
Explanation: If a class is defined inside another class, the inner class is termed as nested class. The inner class is local to the
enclosing class. Scope matters a lot here.
2. Which feature of OOP reduces the use of nested classes?
a) Encapsulation
b) Inheritance

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

4. Non-static nested classes have access to from enclosing class.


a) Private members
TU

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

5. Static nested classes doesn’t have access to from enclosing class.


a) Private members
/
s:/

b) Protected members
c) Public members
tp

d) Any other members


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Decreases
c) Doesn’t affect
d) Slightly decreases
Answer: a
Explanation: The use of nested class increases encapsulation as the inner class is getting even more grouped into the enclosing

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
class. Firstly the class encapsulate the data, having nested classes can increase the encapsulation even further.
8. Which among the following is the correct advantage/disadvantage of nested classes?
a) Makes the code more complex
b) Makes the code unreadable
c) Makes the code efficient and readable
d) Makes the code multithreaded
Answer: c
Explanation: The use of nested classes makes the code more streamed towards a single concept. This allows to group the most
similar and related classes together and makes it even more efficient and readable.
9. How to access static nested classes?
a) OuterClass.StaticNestedClass
b) OuterClass->StaticNestedClass
c) OuterClass(StaticNestedClass)

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

11. How to create object of the inner class?


ot

a) OuterClass.InnerClass innerObject = outerObject.new InnerClass();


_N

b) OuterClass.InnerClass innerObject = new InnerClass();


c) InnerClass innerObject = outerObject.new InnerClass();
TU

d) OuterClass.InnerClass = outerObject.new InnerClass();


Answer: a
K

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/

12. What will be the output of the following code?


t.m

public class Test


{
/
s:/

public int a=0;


class innerClass
tp

{
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)

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
value of x = 55
value of this.x = 0
value of Test.this.x = 1

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b)

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

b) Inner declaration shadows outer declaration in


c) Declaration gives compile time error
K

d) Declaration gives runtime error


A

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

shadow the enclosing class members. This process is known as shadowing.


15. A static nested class is class in behavior that is nested in another class.
/

a) Top level, top level


s:/

b) Top level, low level


tp

c) Low level, top level


d) Low level, low level
ht

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “New
Operator”.
1. What is the new operator?
a) Allocates memory for an object or array
b) Allocates memory for an object or array and returns a particular pointer
c) Used as return type when an object is created
d) Used to declare any new thing in a program
Answer: b
Explanation: The new keyword is used to allocate memory of an object or array. The new object or array can be of any type. Then
it returns a suitable non zero pointer to the object.
2. Microsoft C++ Components extensions support new keyword to
a) Modify a vtable
b) Replace a vtable slot entry

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:/

a) Before the allocation of memory


b) After the allocation of memory
tp

c) Constructor is called to allocate memory


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Type name can’t contain const
b) Type name can’t contain volatile
c) Type name can’t contain class declarations
d) Type name can’t contain const, volatile, class declaration or enumerations

Answer: d

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The declaration of any data where we use new operator, any of the mentioned types are not allowed. This is
because the new operator allocated memory based on the type of data which can be allocated dynamically.
8. The new operator
a) Can allocate reference types too
b) Doesn’t allocate reference types
c) Can allocate reference to objects
d) Doesn’t allocate any data
Answer: b
Explanation: The new operator doesn’t allocate reference types. This is because the reference types are not objects. The new
operator is used to allocate memory to the direct objects.
9. Which among the following is true?
a) New operator can’t allocate functions but pointer to functions can be allocated
b) New operator can allocate functions as well as pointer to functions

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

b) Are used to defined multidimensional arrays


c) Can’t be specified for arrays
d) Can’t be specified for any data
K
A

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

12. The objects allocated using new operator


a) Are destroyed when they go out of scope
/
s:/

b) Are not destroyed even if they go out of scope


c) Are destroyed anytime
tp

d) Are not destroyed throughout the program execution


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
keyword new?
a) Colon
b) Arrow
c) Dot
d) Scope resolution

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: As usual, scope resolution operator is used to get the scope of parent or the global entities. Hence we can use
scope resolution operator with the new operator to call the global new operator even if new operator is defined for the class
explicitly.
15. How does compiler convert “::operator new” implicitly?
a) ::operator new( sizeof( type ) )
b) ::operator new( sizeof( ) )
c) new operator :: type sizeof( type )
d) new sizeof( type ) operator
Answer: a
Explanation: The compiler implicitly converts the syntax so that the instruction can be understood by the processor and proper
machine code can be generated. The conversion is done implicitly and no explicit syntax is required.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Object
Array”.
1. What is an array of objects?
a) An array of instances of class represented by single name
b) An array of instances of class represented by more than one name
c) An array of instances which have more than 2 instances
d) An array of instances which have different types
Answer: a
Explanation: The array of objects an array of instances of a class. The array is represented by a single name. The array name is
itself a pointer. Array name represents the first object.
2. Which among the following is a mandatory condition for array of objects?
a) All the objects should be of different class
b) All the objects should be of same program classes

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

4. If array of objects is declared as given below, which is the limitation on objects?

Class_name arrayName[size];
TU

a) The objects will have same values


K

b) The objects will not be initialized individually


c) The objects can never be initialized
A

d) The objects will have same data


e/
t.m

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

a) The class should have separate constructor for each object


b) The class must have no constructors
ht

c) The class should not have any member function


d) The class must have a default or zero argument constructor
Answer: d
Explanation: The class must have a default/zero argument constructor. Since the declaration is done by only specifying the size
of array, the class must have default a construct to be called by default to reserve memory for each object. Also, we can’t specify
the arguments in this type of declaration hence the class should provide a default initialization.
6. When are the array of objects without any initialization useful?
a) When object data is not required just after the declaration
b) When initialization of object data is to be made by the compiler
c) When object data doesn’t matter in the program
d) When the object should contain garbage data
Answer: a
Explanation: Sometimes the object data is not mandatory to be used just after the declaration or may be the program requires

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
the data to be updated according to what user inputs. Hence only declaration us also useful.
7. If constructor arguments are passed to objects of array then if the constructors are overloaded.
a) It is mandatory to pass same number of arguments to all the objects
b) It is mandatory to pass same type of arguments to all the objects
c) It is not mandatory to call same constructor for all the objects

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) It is mandatory to call same constructor for all the constructors
Answer: c
Explanation: It is not mandatory to call the same constructor for all the objects in an array if initialized with the declaration. The
objects can be passed with different set of arguments in the same syntax, separated by commas.
8. How the objects of array can be denoted?
a) Indices
b) Name
c) Random numbers
d) Alphabets
Answer: a
Explanation: Different objects in an array can be denoted with the indices of array. The first object is denoted by 0. And the
further indices denote the next objects in sequence of array.

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

not used for the execution of programs.


K

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

12. Can we have two dimensional object array?


a) Yes, always
b) Yes, only if primitive type array
c) No, since two indices are impossible
d) No, never
Answer: a
Explanation: A two dimensional array can always be created. There is no rule that only primitive type objects can have more than
one dimension. The object array can also be made 2 dimensional.
13. From which index does the array of objects start?
a) 0
b) 1
c) 2
d) 3

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: The index must start from 0. The index ends at size – 1 index. This is because the index is always till n-1 where n is
the total number of beads.
14. Two dimensional array can’t be initialized with the declaration.
a) True

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) False
Answer: b
Explanation: The two dimensional arrays can also be initialized using curly brackets. For each set, values in curly bracket. And
then another bracket is added at first and end. This ensures that all the code belongs to the user.
15. Is an array of characters always a string?
a) Yes, always
b) Yes, if each character is terminated by null
c) No, since each character is terminated by null
d) No, never
Answer: d
Explanation: The character arrays are not the same as string. The string once created then remains the same. The character
array values may change.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Object
Reference”.
1. What is reference to an object?
a) It is address of an object
b) It is address of where the variables and methods of object are stored
c) It is pointer having address of an object
d) It is address of only variables and not the methods of an object
Answer: b
Explanation: Reference indicates the address where the object’s variables and methods are stored. It is not actual address of
the object. This is done to directly use the variables and methods whenever required.
2. Whenever an object is assigned to a variable or passed to a method
a) Actually the objects aren’t used
b) Actually only the objects are used

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

4. What will be the output of the following code?


TU

import java.awt.Point;
class Testing
K

{
A

public static void main(String[] args)


{
e/

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

System.out.println(“Point 2: ” + p2.x + ”, “ + p2.y);


ht

}
}

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d)
Point 1: 200, 200
Point 2: 200, 200

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: The expected output would be like p2 with values 100, 100. But this is not the case. The tricky part is assignment
used (p2=p1;). Here a reference is created from object p1 to p2, and not any new object that would copy p1’s values. Hence
when we change the values of p1 object members. There changes are reflected to the object p2 also.

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.

7. What will be the output of the following code? oo


_B
import java.awt.Point;
class Testing
es

{
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/

System.out.println(“Point 1: ” + p1.x + ”, “ + p1.y);


t.m

}
}
/
s:/

a) Point 1: 200, 200


b) Point 1: 100,100
tp

c) Point 1: 300, 300


ht

d) Point 1: 300, 500


Answer: d
Explanation: When references are used, all the variables point to the same object. Whenever any of the variable changes any
values, it will be reflected to all the variables pointing to the same object.
8. If a reference variable is declared final then
a) It can never be reassigned to refer to a different object
b) It can be assigned to refer to any object anytime
c) It can never be assigned with any object
d) It can be assigned with 2 or more objects simultaneously
Answer: a
Explanation: Since the variable is declared final. It will have a constant value throughout the program. It can refer to only one
object at a time. And if it was made to refer to none of the object, it would have got no use.
9. Which of the members are referred by this pointer usually (Java)?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Members of class where this is used
b) Member of the parent class where this is used
c) Members that are passed as argument to the object
d) Pointers are not applicable in java

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: We use this pointer to differentiate the members of the class where this is used to the other inherited or passed
variables. The local variables are denoted with this. Or specifically the members of class only.
10. How to refer to method of nested class?
a) enclosingClassObject.innerClassObject.method();
b) innerClassObject.method();
c) method();
d) depends on where the method is being called
Answer: d
Explanation: This depends on where the method is being called. If the method is called inside the enclosing class itself. Then we
can’t use object of enclosing class. If the method is being called within the inner class itself, then its object will also be of no use.
11. How many objects can be referenced from the same variables?
a) One at a time

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

13. Which among the following is true?


TU

a) Object referencing refers to methods address


b) Object referencing refers to variable of object
c) Object referencing points to same address, if assigned by variables
K

d) Object referencing is used to point methods


A

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Objects”.
1. Which definition best describes an object?
a) Instance of a class
b) Instance of itself
c) Child of a class
d) Overview of a class
Answer: a
Explanation: An object is instance of its class. It can be declared in the same way that a variable is declared, only thing is you
have to use class name as the data type.

2. How many objects can be declared of a specific class in a single program?


a) 32768
b) 127

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

we can’t use members of that class.


ot

4. Which of the following is incorrect?


_N

a) class student{ }s;


b) class student{ }; student s;
TU

c) class student{ }s[];


d) class student{ }; student s[5];
K

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

its size. It’s a mandatory field.


e/

5. The object can’t be


t.m

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.

6. What is size of the object of following class (64 bit system)?


class student { int rollno; char name[20]; static int studentno; };
a) 20
b) 22
c) 24
d) 28
Answer: c
Explanation: The size of any object of student class will be of size 4+20=24, because static members are not really considered
as property of a single object. So static variables size will not be added.
7. Functions can’t return objects.
****** Telegram:- @AKTU_Notes_Books_Quantum ******
@AKTU_Notes_Books_Quantum
a) True
b) False
Answer: b
Explanation: Functions can always return an object if the return type is same as that of object being returned. Care has to be

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
taken while writing the prototype of the function.
8. How members of an object are accessed?
a) Using dot operator/period symbol
b) Using scope resolution operator
c) Using member names directly
d) Using pointer only
Answer: a
Explanation: Using dot operator after the name of object we can access its members. It is not necessary to use the pointers. We
can’t use the names directly because it may be used outside the class.
9. If a local class is defined in a function, which of the following is true for an object of that class?
a) Object is accessible outside the function
b) Object can be declared inside any other function
c) Object can be used to call other class members

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

11. Object declared in main() function


a) Can be used by any other function
TU

b) Can be used by main() function of any other program


c) Can’t be used by any other function
d) Can be accessed using scope resolution operator
K
A

Answer: c
Explanation: The object declared in main() have local scope inside main() function only. It can’t be used outside main() function.
e/

Scope resolution operator is used to access globally declared variables/objects.


t.m

12. When an object is returned


a) A temporary object is created to return the value
/
s:/

b) The same object used in function is used to return the value


c) The Object can be returned without creation of temporary object
tp

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?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
class student{
int marks;
int cgpa;
public: student(int i, int j){
marks=I;

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
cgpa=j
}
};
a) student s[3]={ s(394, 9); s(394, 9); s(394,9); };
b) student s[2]={ s(394,9), s(222,5) };
c) student s[2]={ s1(392,9), s2(222,5) };
d) student s[2]={ s[392,9], s2[222,5] };
Answer: b
Explanation: It is the way we can initialize the data members for an object array using parameterized constructor. We can do this
to pass our own intended values to initialize the object array data.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ online quiz focuses on “Types of Constructors”.
1. How many types of constructors are available, in general, in any language?
a) 2
b) 3
c) 4
d) 5
Answer: b
Explanation: There are 3 types of constructors in general, namely, default constructors, parameterized constructors and copy
constructors. Default one is called whenever an object is created without arguments.

2. Choose the correct option for the following code.

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

3. Which constructor is called while assigning some object with another?


a) Default
ot

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

4. It’s necessary to pass object by reference in copy constructor because


e/

a) Constructor is not called in pass by reference


t.m

b) Constructor is called in pass by reference only


c) It passes the address of new constructor to be created
d) It passes the address of new object to be created
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Default constructor can be called explicitly
d) Default constructor is and always called implicitly only
Answer: c
Explanation: Default constructors can be called explicitly anytime. They are specifically used to allocate memory space for the
object in memory, in general. It is not necessary that these should always be called implicitly.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Which type of constructor can’t have a return type?
a) Default
b) Parameterized
c) Copy
d) Constructors don’t have a return type
Answer: d
Explanation: Constructors don’t return any value. Those are special functions, whose return type is not defined, not even void.
This is so because the constructors are meant to initialize the members of class and not to perform some task which can return
some value to newly created object.
8. Why do we use static constructors?
a) To initialize the static members of class
b) To initialize all the members with static value
c) To delete the static members when not required
d) To clear all the static members initialized values

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

10. Which among the following is true for static constructor?


ot

a) Static constructors are called with every new object


_N

b) Static constructors are used initialize data members to zero always


c) Static constructors can’t be parameterized constructors
TU

d) Static constructors can be used to initialize the non-static members also


Answer: c
K

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

11. Within a class, only one static constructor can be created.


a) True
b) False
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Before first instance is created
d) At time of creation of first instance
Answer: c
Explanation: The static constructor is called before creation of the first instance of that class. This is done so that even the first

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
instance can use the static value of the static members of the class and manipulate as required.
14. If constructors of a class are defined in private access, then
a) The class can’t be inherited
b) The class can be inherited
c) Instance can be created only in another class
d) Instance can be created anywhere in the program
Answer: a
Explanation: If the constructors are defined in private access, then the class can’t be inherited by other classes. This is useful
when the class contains static members only. The instances can never be created.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ online test focuses on “OOP Basic Concepts”.
1. Which was the first purely object oriented programming language developed?
a) Java
b) C++
c) SmallTalk
d) Kotlin
Answer: c
Explanation: SmallTalk was the first programming language developed which was purely object oriented. It was developed by
Alan Kay. OOP concept came into the picture in 1970’s.
2. Which of the following best defines a class?
a) Parent of an object
b) Instance of an object
c) Blueprint of an object

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

4. What is the additional feature in classes that was not in structures?


_N

a) Data members
b) Member functions
TU

c) Static data allowed


d) Public access specifier
K

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

5. Which is not feature of OOP in general definitions?


a) Code reusability
b) Modularity
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Inheritance
Answer: d
Explanation: Using inheritance we can reuse the code already written and also can avoid creation of many new functions or
variables, as that can be done one time and be reused, using classes.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
8. Which language does not support all 4 types of inheritance?
a) C++
b) Java
c) Kotlin
d) Small Talk
Answer: b
Explanation: Java doesn’t support all 4 types of inheritance. It doesn’t support multiple inheritance. But the multiple inheritance
can be implemented using interfaces in Java.
9. How many classes can be defined in a single program?
a) Only 1
b) Only 100
c) Only 999
d) As many as you want

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

11. Why Java is Partially OOP language?


a) It supports usual declaration of primitive data types
ot

b) It doesn’t support all types of inheritance


_N

c) It allows code to be written outside classes


d) It does not support pointers
TU

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

12. Which concept of OOP is false for C++?


e/

a) Code can be written without using classes


t.m

b) Code must contain at least one class


c) A class must have member functions
d) At least one object should be declared in code
/
s:/

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

code if its class is defined/included via header file.


13. Which header file is required in C++ to use OOP?
a) iostream.h
b) stdio.h
c) stdlib.h
d) OOP can be used without using any header file
Answer: d
Explanation: We need not include any specific header file to use OOP concept in C++, only specific functions used in code need
their respective header files to be included or classes should be defined if needed.
14. Which of the two features match each other?
a) Inheritance and Encapsulation
b) Encapsulation and Polymorphism
c) Encapsulation and Abstraction

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Abstraction and Polymorphism
Answer: c
Explanation: Encapsulation and Abstraction are similar features. Encapsulation is actually binding all the properties in a single
class or we can say hiding all the features of object inside a class. And Abstraction is hiding unwanted data (for user) and

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
showing only the data required by the user of program.
15. Which feature allows open recursion, among the following?
a) Use of this pointer
b) Use of pointers
c) Use of pass by value
d) Use of parameterized constructor
Answer: a
Explanation: Use of this pointer allows an object to call data and methods of itself whenever needed. This helps us call the
members of an object recursively, and differentiate the variables of different scopes.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “OOP
Features”.
1. Which feature of OOP indicates code reusability?
a) Encapsulation
b) Inheritance
c) Abstraction
d) Polymorphism
Answer: b
Explanation: Inheritance indicates the code reusability. Encapsulation and abstraction are meant to hide/group data into one
element. Polymorphism is to indicate different tasks performed by a single entity.

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

4. Which of the following is not a feature of pure OOP?


a) Classes must be used
K

b) Inheritance
A

c) Data may/may not be declared using object


d) Functions Overloading
e/
t.m

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:/

5. Which among the following doesn’t come under OOP concept?


tp

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.

6. Which feature of OOP is indicated by the following code?

class student{ int marks; };


class topper:public student{ int age; topper(int age){ this.age=age; } };
a) Inheritance
b) Polymorphism
c) Inheritance and polymorphism
d) Encapsulation and Inheritance

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: Encapsulation is indicated by use of classes. Inheritance is shown by inheriting the student class into topper class.
Polymorphism is not shown here because we have defined the constructor in the topper class but that doesn’t mean that default
constructor is overloaded.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Which feature may be violated if we don’t use classes in a program?
a) Inheritance can’t be implemented
b) Object must be used is violated
c) Encapsulation only is violated
d) Basically all the features of OOP gets violated
Answer: d
Explanation: All the features are violated because Inheritance and Encapsulation won’t be implemented. Polymorphism and
Abstraction are still possible in some cases, but the main features like data binding, object use and etc won’t be used hence the
use of class is must for OOP concept.
8. How many basic features of OOP are required for a programming language to be purely OOP?
a) 7
b) 6
c) 5
d) 4

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

Also, message reading is not a feature of OOP.


ot

10. underlines the feature of Polymorphism in a class.


_N

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/

to class and use represents polymorphism.


t.m

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) True
b) False
Answer: a
Explanation: Exception handling is a feature of OOP as it includes classes concept in most of the cases. Also it may come

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
handy while using inheritance.
14. Which among the following, for a pure OOP language, is true?
a) The language should follow 3 or more features of OOP
b) The language should follow at least 1 feature of OOP
c) The language must follow only 3 features of OOP
d) The language must follow all the rules of OOP
Answer: d
Explanation: The language must follow all the rules of OOP to be called a purely OOP language. Even if a single OOP feature is
not followed, then it’s known to be a partially OOP language.
15. Does OOP provide better security than POP?
a) Always true for any programming language
b) May not be true with respect to all programming languages
c) It depends on type of program

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Overloading Constructors”.
1. Which among the following best describes constructor overloading?
a) Defining one constructor in each class of a program
b) Defining more than one constructor in single class
c) Defining more than one constructor in single class with different signature
d) Defining destructor with each constructor
Answer: c
Explanation: If more than one constructors are defined in a class with same signature, then that results in error. The signatures
must be different. So that the constructors can be differentiated.
2. Can constructors be overloaded in derived class?
a) Yes, always
b) Yes, if derived class has no constructor

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

4. Which among the following is possible way to overload constructor?


a) Define default constructor, 1 parameter constructor and 2 parameter constructor
TU

b) Define default constructor, zero argument constructor and 1 parameter constructor


c) Define default constructor, and 2 other parameterized constructors with same signature
d) Define 2 default constructors
K
A

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&lt;&lt;i;
}
A(int x=0)
{
i=x; cout&lt;&lt;I;
}
};
A obj1;
a) Default constructor
b) Parameterized constructor
c) Compile time error
d) Run time error

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: c
Explanation: When a default constructor is defined and another constructor with 1 default value argument is defined, creating
object without parameter will create ambiguity for the compiler. The compiler won’t be able to decide which constructor should
be called, hence compile time error.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
6. Which among the following is false for a constructor?
a) Constructors doesn’t have a return value
b) Constructors are always user defined
c) Constructors are overloaded with different signature
d) Constructors may or may not have any arguments being accepted
Answer: b
Explanation: The constructors are not always user defined. The construct will be provided implicitly from the compiler if the used
doesn’t defined any constructor. The implicit constructor makes all the string values null and allocates memory space for each
data member.
7. When is the constructor called for an object?
a) As soon as overloading is required
b) As soon as class is derived
c) As soon as class is created
d) As soon as object is created

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

9. Why do we use constructor overloading?


ot

a) To use different types of constructors


_N

b) Because it’s a feature provided


c) To initialize the object in different ways
TU

d) To differentiate one constructor from another


Answer: c
K

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

10. If programmer have defined parameterized constructor only, then


a) Default constructor will not be created by the compiler implicitly
b) Default constructor will be created by the compiler implicitly
/
s:/

c) Default constructor will not be created but called at runtime


d) Compile time error
tp
ht

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?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
class A
{
int i;
A()
{

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
i=0;
}
A(int x)
{
i=x+1;
}
A(int y, int x)
{
i=x+y;
}
};
A obj1(10);
A obj2(10,20);
A obj3;
a) A(int x)

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

14. Which among the following is false?


TU

a) Constructor can’t be overloaded in Kotlin


b) Constructors can’t be called recursively in java
c) Constructors can be overloaded in C++
K

d) Constructors overloading depends on different signatures


A

Answer: a
e/

Explanation: Kotlin language allows constructor overloading. This is a basic feature for the constructors. The constructor
t.m

overloading allows the object to be initialized according to the user.


/

15. Which is correct syntax?


s:/

a) classname objectname= new() integer;


b) classname objectname= new classname;
tp

c) classname objectname= new classname();


ht

d) classname objectname= new() classname();


Answer: c
Explanation: The syntax for object creating in java with calling a constructor for is it is as in option c. The syntax must contain the
classname followed by the object name. The keyword new must be used and then the constructor call with or without the
parameters as required.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “This
Pointer”.
1. Which is the pointer which denotes the object calling the member function?
a) Variable pointer
b) This pointer
c) Null pointer
d) Zero pointer
Answer: b
Explanation: The pointer which denotes the object calling the member function is known as this pointer. The this pointer is usually
used when there are members in the function with same name as those of the class members.
2. Which among the following is true?
a) this pointer is passed implicitly when member functions are called
b) this pointer is passed explicitly when member functions are called

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

4. An object’s this pointer


a) Isn’t part of class
TU

b) Isn’t part of program


c) Isn’t part of compiler
K

d) Isn’t part of object itself


A

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

doesn’t take up any space for the data to be stored or pointed.


5. The result of sizeof() function
/
s:/

a) Includes space reserved for this pointer


b) Includes space taken up by the address pointer by this pointer
tp

c) Doesn’t include the space taken by this pointer


d) Doesn’t include space for any data member
ht

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);

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) object.function(&this, parameter)
b) object(&function,parameter)
c) function(&object,&parameter)
d) function(&object,parameter)

Answer: d

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The function name is specified first and then the parameter lists. The parameter list is included with the object name
along with & symbol. This denotes that the address of the object is being passed as an argument.
8. The address of the object
a) Can’t be accessed from inside the function
b) Can’t be accessed in the program
c) Is available inside the member function using this pointer
d) Can be accessed using the object name inside the member function
Answer: c
Explanation: The address of the object with respect to which the member functions are being called, are stored in this pointer.
This pointer is hence used whenever there are members with same name as those of the variables inside the function.
9. Which among the following is true?
a) This pointer can be used to guard against any kind of reference
b) This pointer can be used to guard against self-reference

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

doesn’t refer itself.


_N

11. The this pointers


a) Are modifiable
TU

b) Can be assigned any value


c) Are made variables
K

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:/

a) Never allowed assignment to this pointer


b) Allowed no assignment to this pointer
tp

c) Allowed assignments to this pointer


ht

d) Never allowed assignment to any pointer


Answer: c
Explanation: The earlier, most initial versions of C++ used to allow assignments to this pointers. That used to allow modifications
of this pointer. Later that feature got disabled.
13. This pointer can be used directly to
a) To manipulate self-referential data structures
b) To manipulate any reference to pointers to member functions
c) To manipulate class references
d) To manipulate and disable any use of pointers
Answer: a
Explanation: This is a feature provided, that can be used directly. The manipulation of self-referential data structures is just an
application of this feature. Other conditions fails as this pointer doesn’t deal with those things.
14. Which among the following is/are type(s) of this pointer?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) const
b) volatile
c) const or volatile
d) int

Answer: c

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The this pointer can be declared const or volatile. This depends on need of program and type of code. This is just
an additional feature.
15. Which is the correct syntax for declaring the type of this in a member function?
a) classType [cv-qualifier-list] *const this;
b) classType const[cv-qualifier-list] *this;
c) [cv-qualifier-list]*const classType this;
d) [cv-qualifier-list] classType *const this;
Answer: d
Explanation: The syntax contains the cv-qualifier-list that can be determined from the member function declaratory that can be
either const or volatile or can be made both. Hence we write it as list. classType denotes the name of class to mention to which
class does the object belong to. And *const this denotes that the this pointer is having a constant value.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Polymorphism”.
1. Which among the following best describes polymorphism?
a) It is the ability for a message/data to be processed in more than one form
b) It is the ability for a message/data to be processed in only 1 form
c) It is the ability for many messages/data to be processed in one way
d) It is the ability for undefined message/data to be processed in at least one way
Answer: a
Explanation: It is actually the ability for a message / data to be processed in more than one form. The word polymorphism
indicates many-forms. So if a single entity takes more than one form, it is known as polymorphism.
2. What do you call the languages that support classes but not polymorphism?
a) Class based language
b) Procedure Oriented language

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

responding to the same message in different ways, hence polymorphism.

5. Which class/set of classes can illustrate polymorphism in the following code?


/
s:/

abstract class student


tp

{
public : int marks;
ht

calc_grade();
}
class topper:public student
{
public : calc_grade()
{
return 10;
}
};
class average:public student
{
public : calc_grade()
{
return 20;
}
};

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
class failed{ int marks; };
a) Only class student can show polymorphism
b) Only class student and topper together can show polymorphism
c) All class student, topper and average together can show polymorphism

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Class failed should also inherit class student for this code to work for polymorphism
Answer: c
Explanation: Since Student class is abstract class and class topper and average are inheriting student, class topper and
average must define the function named calc_grade(); in abstract class. Since both the definition are different in those classes,
calc_grade() will work in different way for same input from different objects. Hence it shows polymorphism.
6. Which type of function among the following shows polymorphism?
a) Inline function
b) Virtual function
c) Undefined functions
d) Class member functions
Answer: b
Explanation: Only virtual functions among these can show polymorphism. Class member functions can show polymorphism too
but we should be sure that the same function is being overloaded or is a function of abstract class or something like this, since

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

8. Which among the following can’t be used for polymorphism?


a) Static member functions
ot

b) Member functions overloading


_N

c) Predefined operator overloading


d) Constructor overloading
TU

Answer: a
Explanation: Static member functions are not property of any object. Hence it can’t be considered for overloading/overriding. For
K

polymorphism, function must be property of object, not only of class.


A

9. What is output of the following program?


e/
t.m

class student
{
public : int marks;
/
s:/

void disp()
{
tp

cout<<”its base class”


ht

};
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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Its derived class Its base class
Answer: a
Explanation: You need to focus on how the output is going to be shown, no space will be given after first message from base
class. And then the message from derived class will be printed. Function disp() in base class overrides the function of base

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
class being derived.
10. Which among the following can show polymorphism?
a) Overloading ||
b) Overloading +=
c) Overloading <<
d) Overloading &&
Answer: c
Explanation: Only insertion operator can be overloaded among all the given options. And the polymorphism can be illustrated
here only if any of these is applicable of being overloaded. Overloading is type of polymorphism.

11. Find the output of the following program.

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

a) Its school education system


b) Its education system
c) Its school education systemIts education system
K

d) Its education systemIts school education system


A

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.
/

12. Polymorphism is possible in C language.


s:/

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. Which among the following is not true for polymorphism?
a) It is feature of OOP
b) Ease in readability of program
c) Helps in redefining the same functionality
d) Increases overhead of function definition always

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: d
Explanation: It never increases function definition overhead, one way or another if you don’t use polymorphism, you will use the
definition in some other way, so it actually helps to write efficient codes.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Private
Access Specifier”.

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

d) Only the object with some parameters can be created


ot

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

private : int marks; char name[20];


e/

public :
t.m

A(int x=100)
{
marks=x;
/
s:/

}
};
tp
ht

a) Objects can be created with one parameter or without parameter


b) Object can be created only with one parameter
c) Object can be created with more than one parameter
d) Objects can be create only without parameter
Answer: a
Explanation: The constructor here has a default argument constructor. Hence we can pass one parameter, but that is optional. If
an object is created without parameter, the default value will be used in the constructor definition.
4. Which among the following is correct to call a private member from outside the class?
a) object.memberfunction( parameters );
b) object->memberfunction( parameters );
c) object->memberfunction( parameteres); or object.memberfunction( parameters );
d) Not possible
Answer: d
Explanation: The private member function will not be accessible from outside the class. Hence any syntax will not work to access

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
the private members. If you have the address of the member, may be you can access those members, but that is a totally
different case and concept.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Specifier must be changed
b) Friend function should be used
c) Other public members should be used
d) It is not possible
Answer: b
Explanation: For calling the function directly, we can’t use another function because that will be indirect call. Using friend function,
we can access the private members directly.
6. Which access specifier is/are most secure during inheritance?
a) Private
b) Default
c) Protected
d) Private and default
Answer: a

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

8. Which option is false for the following code?


ot

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&lt;&lt;sum(x,y);
/

}
s:/

};
tp

a) Constructor can be created with zero argument


ht

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.

9. Which member will never be used from the following class?

class A()
{
int marks; char name[20];
public : A()
{
marks=100;

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
}
void disp()
{
cout&lt;&lt;”Marks= ”&lt'&lt;marks;
cout&lt;&lt;”Student”;

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
}
};
a) name variable will never be used
b) marks variable will never be used
c) constructor will never be used
d) disp() function will never be used
Answer: a
Explanation: Variable name will never be used. It is a private member. None other than class members can access name, also,
neither the constructor nor the disp() function are accessing the variable name. Hence it will never be accessible.
10. Private member functions can be overloaded.
a) True
b) False

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:/

d) All will be used


tp

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: b
Explanation: The default variables can be inherited in some special cases but the public members can never be inherited.
Hence the most secure data member in the class is b.

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
class A
{
private : A()
{
}
public : A(int x)
{
}
};
A a;
A b(100);
a) Program will give compile time error
b) Program will run fine
c) Program will give runtime error
d) Program will give logical error

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Public
Access Specifier”.

1. Which among the following is true for the code given below?

class A
{
int marks;
public : disp()
{
cout&lt;&lt;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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: b
Explanation: The statement given is false. This is because when we inherit the members they can either be made more secure
or be at same access. But the visibility reduction is not possible, for example, if a member is protected in parent class, then it
can only be made protected or private in subclass and not public in any case.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
6. If members of a super class are public, then
a) All those will be available in subclasses
b) None of those will be available in subclasses
c) Only data members will be available in subclass
d) Only member functions will be available in subclass
Answer: a
Explanation: All the members will be available in subclasses. Though it is not guaranteed whether the members will be available
in subsequent subclasses from the first subclass.
7. How many public class(s) (outermost) can be there in a java program?
a) 1
b) 2
c) 3
d) As required

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

a) Output is: object created


A

b) Output is: object createdobject created


c) Compile time error
e/

d) Run time error


t.m

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

9. Which among the following for public specifier is false?


a) The static members can’t be public
ht

b) The public members are available in other packages too


c) The subclasses can inherit the public members privately
d) There can be only one public class in java program
Answer: a
Explanation: The static members are not property of any object of the class. Instead, those are treated as property of class. This
allows us to have public static members too.
10. A class has its default constructor defined as public. Class B inherits class A privately. The class
a) B will not be able to have instances
b) Only A can have instances
c) Only B can have instances
d) Both classes can have instances
Answer: d
Explanation: Class A can have instances as it has public default constructor. Class will have its own constructors defined. Hence

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
both classes can have instances.
11. Which specifier can be used to inherit protected members as protected in subclass but public as public in subclass?
a) Private
b) Default

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Public
d) Protected
Answer: c
Explanation: The specifier that can make protected member’s protected in subclass and public member’s public in subclass, is
public. This is done to maintain the security level of protected members of parent class.
12. Which among the following is true for public class?
a) There can be more than one public class in a single program
b) Public class members can be used without using instance of class
c) Public class is available only within the package
d) Public classes can be accessed from any other class using instance
Answer: d
Explanation: The public class is a usual class. There is no special rule but the members of the class can be accessed from other
classes using instance of the class. This is usually useful to define main() function.

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

b) Will not be inherited after one subclass inheritance


c) Will not be available to be called outside class
ot

d) Will not be able to allocated with any memory space


_N

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

d) Private and Protected


Answer: d
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Public
Member Functions”.
1. What are public member functions?
a) Functions accessible outside the class but not in derived class
b) Functions accessible outside the class directly
c) Functions accessible everywhere using object of class
d) Functions that can’t be accessed outside the class
Answer: c
Explanation: The most suitable definition would be that public member functions are accessible everywhere using object of the
class. If derived classes are using those, derived class object can be used to call those functions.
2. Which among the following is true for public member functions?
a) Public member functions doesn’t have a return type
b) Public member functions doesn’t have any security

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

b) public void functionName(parameters)


A

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:/

5. Which syntax is applicable to declare public member functions in C++?


tp

a) public: <function declaration>


b) public(<function declaration>)
ht

c) public void <function declaration>


d) public::<function declaration>
Answer: a
Explanation: The syntax in C++ must contain the public keyword followed by a colon. Thereafter, all the public members can be
declared. But in few other language, public have to be mentioned explicitly with each member.
6. In java, which rule among the following is applicable?
a) Keyword public can’t be preceded with all the public members
b) Keyword public must be preceded with all the public members
c) Keyword public must be post mentioned the function declaration
d) Keyword public is not mandatory
Answer: b
Explanation: The public members in java must be preceded with the keyword public. It must be mentioned with each public
member, unlike C++ where we mention it only once. In java, each member must have explicit declaration of specifier type.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. How many public members are allowed in a class?
a) Only 1
b) At most 7
c) Exactly 3

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) As many as required
Answer: d
Explanation: The number of public members that can be defined in a class doesn’t have any limit. Though the programmer
should not use too many functions, instead should use another class for more specific functions to reduce the readability
complexity.
8. Which is not a proper way to access public members of a class?
a) Using object pointer with arrow operator
b) Using object of class in main function
c) Using object of class with arrow operator
d) Using object anywhere in the program
Answer: c
Explanation: The public members can be accessed anywhere in the program using the object of the class. And if object pointer
is used, then arrow operator is used to access class members. If normal object is used with arrow operator, an error will be

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

c) object.functionName void (parameters)


_N

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

a) Make the function private


b) Use private inheritance
c) Use public inheritance
/
s:/

d) Use protected inheritance


tp

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Program shut down the computer
Answer: a
Explanation: If the function is called directly without using any object then the compiler doesn’t gets to know that the function have
to be called from a specific class. And if there are no global or in-scope function with same name then the compiler produces an

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
error stating that the called function is undeclared.
14. The function main() must always be public.
a) True
b) False
Answer: a
Explanation: The main() function must always be public. This is because the whole function and the operating system that is out
of the package have to access the main function throughout the program execution. Hence the main() function should be public
so as to be available everywhere in the program.
15. All the public member functions
a) Can’t access the private members of a class
b) Can’t access the protected members of a class
c) Can access only public members of a class
d) Can access all the member of its class

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Quiz focuses on “Constant Member Functions”.
1. What are the constant member functions?
a) Functions which doesn’t change value of calling object
b) Functions which doesn’t change value of any object inside definition
c) Functions which doesn’t allow modification of any object of class
d) Functions which doesn’t allow modification of argument objects
Answer: a
Explanation: The constant member functions are a special type of member functions. These are intended to restrict any
modification in to the values of object which is used to invoke that function. This is done to ensure that there are no accidental
modifications to the object.

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

a) Can be called only from non-const object


b) Can be called only from const object
c) Can be called both by const and non-const object
K

d) Can’t be called with object


A

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:/

5. Which is the correct condition on const member functions?


a) Const member functions can’t call non-const member functions
tp

b) Const member functions can’t call any other function


ht

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.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Can a constructor function be constant?
a) Yes, always
b) Yes, only if permissions are given
c) No, because objects are not involved

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) No, never
Answer: d
Explanation: The constructors can’t be made const. This is to ensure that the constructor is capable of initializing the values to
the members of the object. If it is made constant then it won’t be able to initialize any data member values.
8. A function can have both the const and non-const version in the same program.
a) True
b) False
Answer: a
Explanation: The functions in a program can be made both const and non-const. This feature is made available to make
programming more flexible. This ensures the security too as we can call const function whenever required.
9. How is it possible to have both const and non-const version of a function?
a) Function overriding

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

inside both the const and non-const version of functions.


_N

11. If a function is to be made const, which is the correct syntax?


a) const functionName(parameters);
TU

b) const returnType functionName(parameters);


c) const functionName(returnType)(Parameters);
K

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:/

12. Functions which differ in const-ness are considered


a) To have same signature
tp

b) To have different signature


c) To produce compile time error
ht

d) To produce runtime error


Answer: b
Explanation: The functions are considered to have different signature. This is because the const-ness also defines the type of
function or the working of functions. And hence the functions can be considered different. This is the reason that we can use
function overloading for const and non-const version of same function.
13. If const version of a function when overloading is used, the function
a) Returns reference to object
b) Returns volatile reference
c) Returns mutable reference
d) Returns const reference
Answer: d
Explanation: The function returns a const reference. This is to ensure that the value of object calling the function is not modified.
This is a security feature.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. Which among the following is recommended for const functions?
a) Const function use should be reduced in a program
b) Const function use should be more in a program
c) Const function use should not matter in a program
d) Const function use should be able to modify the values

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: b
Explanation: The const member functions should be used more in a program. The reason behind is to ensure there is no
accidental modification of data of object. Also to ensure any unintended modification which may result in unexpected termination
of program.
15. Use of const member function in a program
a) Is mandatory, always
b) Is optional, always
c) Is mandatory, if objects are used
d) Is optional, if const objects are used
Answer: b
Explanation: The use of const member functions is not mandatory. If const objects are involved then there is a high use of const
member functions too. But there is no mandatory condition.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Returning Objects”.
1. In which of the following way(s) can the object be returned from a function?
a) Can only be returned by value
b) Can only be returned by reference
c) Can be returned either by value or reference
d) Can neither be returned by value nor by reference
Answer: c
Explanation: The objects can be returned either by value or reference. There is no mandatory condition for the way it should be
used. The way of returning object can be decided based on the requirement.
2. Whenever an object is returned by value
a) A temporary object is created
b) Temporary object is not created

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

4. Which is the correct syntax for returning an object by value?


a) void functionName ( ){ }
TU

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/

specified class type. Only the class name should be specified.


t.m

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?

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) 1
b) 2
c) 3
d) 4

Answer: a

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: Only one object can be returned at a time. This is because a function is only capable of returning a single value at a
time. Though array of objects can be returned from a function.
8. Which error will be produced if a local object is returned by reference outside a function?
a) Out of memory error
b) Run time error
c) Compile time error
d) No error
Answer: c
Explanation: If the local object is returned outside the function then the compile-time error arises. While the program is being
converted and the processes happening during compile time, the compiler won’t be able to resolve the statement.
9. If object is passed by reference
a) Temporary object is created
b) Temporary object is created inside the function

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

11. Can we return an array of objects?


a) Yes, always
TU

b) Ye, only if objects are having same values


c) No, because objects contain many other values
d) No, because objects are single entity
K
A

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

12. If an object is passed by reference to a function then it must be returned by reference.


a) True
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Its member values are not used
d) Its member values are copied using copy constructor
Answer: d
Explanation: When an object is returned by value, it will be returned to another object or will be directly used. Still in all the
conditions the copy constructor will be used to copy all the values from the temporary object that gets created.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
15. Why temporary object is not created in return by reference?
a) Because compiler can’t create temporary objects
b) Because the temporary object is created within the function
c) Because return by reference just make the objects points to values memory location
d) Because return by reference just make the object point to null
Answer: c
Explanation: A reference to the memory location where the returned object is stored is made. This allows the new object which
takes the return value, point to the memory location and hence access the same values.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Single
Level Inheritance”.
1. Which among the following defines single level inheritance?
a) One base class derives another class
b) One derived class inherits from one base class
c) One base class inherits from one derived class
d) One derived class derives from another derived class
Answer: b
Explanation: If only one base class is used to derive only one subclass, it is known as single level inheritance. The reason of this
name is that we inherit the base class to one more level and stop the inheritance any further.
2. If class A and class B are derived from class C and class D, then
a) Those are 2 pairs of single inheritance
b) That is multilevel inheritance

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

4. Single level inheritance supports inheritance.


a) Runtime
TU

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

5. Which method in the code below is single level inherited?


/
s:/

class A
{
tp

protected int a, b;
public: void show()
ht

{
cout&lt;&lt;a&lt;&lt;b;
}
};
class B: public A
{
public: void disp()
{
cout&lt;&lt;a++&lt;&lt;b++;
}
};
class C: private A, public B
{
void avg()
{
cout&lt;&lt;(a+b)/2;

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
}
};
a) Class A
b) Class B

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) Class C
d) None
Answer: b
Explanation: Class B is using single level inheritance. Class C is using multiple inheritance. And class A is parent of other two
classes.

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

9. Single level inheritance is safer than


e/

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

inheritance not so safe as it might result in some ambiguity.


10. Which language doesn’t support single level inheritance?
a) Java
b) C++
c) Kotlin
d) All languages support it
Answer: d
Explanation: All the languages support single level inheritance. Since any class can inherit other classes as required, if single
level inheritance was not allowed it would result in failing a lot of features of OOP.

11. What is the output of the following program?

class A
{

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
protected: int a,b;
public: void disp()
{
cout&lt;&lt;a&lt;&lt;b;
}

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
};
class B:public A
{
int x,y;
};
a) Garbage value
b) Compile time error
c) Runtime error
d) Runs but gives random values as output
Answer: b
Explanation: The compiler doesn’t find the main function and hence will throw an error main() missing. This program is using
single level inheritance but the program is incomplete. Every program must implement main function.

12. What is the output of the following program?

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 salary is: 4000.0


TU

Bonus of B is: 10000

b)
K
A

B salary is 10000
Bonus of B is: 4000.0
e/
t.m

c) Compile time error


d) Runtime error
/
s:/

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

13. Single level inheritance will be best for


a) Inheriting a class which performs all the calculations
b) Inheriting a class which can print all the calculation results
c) Inheriting a class which can perform and print all calculations
d) Inheriting all the classes for different calculations
Answer: b
Explanation: Inheriting a class which can perform the most common task will be more efficient. If class which can perform all the
calculations is inherited then there won’t be any problem to print the result too. But if a class which can do the most common task
for all the other tasks, it will make real use of inheritance.
14. Which constructor will be called first from the classes involved in single inheritance from object of derived class?
a) Base class constructor
b) Derived class constructor
c) Both class constructors at a time
d) Runtime error

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: a
Explanation: The base class constructor will be called first from the object of derived class constructor. When the derived class
members are to be initialized and allocated memory, the base class members should also be confirmed with the memory
allocation.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
15. If base class contains 2 nested classes, will it be possible to implement single level inheritance?
a) Yes, always
b) Yes, only if derived class also have nested classes
c) No, it will use more than 2 classes which is wrong
d) No, never
Answer: a
Explanation: The nested classes are also members of a class. They behave as a used defined data type with some methods
implementation. So the inheritance will be as usual with the nested classes being member of base class and of derived class if
not private.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Static
Data Members”.
1. Which among the following best defines static variables members?
a) Data which is allocated for each object separately
b) Data which is common to all the objects of a class
c) Data which is common to all the classes
d) Data which is common to a specific method
Answer: b
Explanation: The static data members are made common to all the object of a class. They doesn’t change from object to object.
Those are property of class rather than of any individual object.
2. Which keyword should be used to declare static variables?
a) static
b) stat

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

4. Which is the correct syntax for declaring static data member?


a) static mamberName dataType;
TU

b) dataType static memberName;


c) memberName static dataType;
d) static dataType memberName;
K
A

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

5. The static data member


a) Must be defined inside the class
/
s:/

b) Must be defined outside the class


c) Must be defined in main function
tp

d) Must be defined using constructor


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Must not be static member functions
b) Must not be member functions
c) Must be static member functions
d) Must not be member function of corresponding class

Answer: c

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: Only the static member functions can access the static data members. The definition of static members is made
common and hence the member function should be capable of manipulating the static data members.
8. The static data member
a) Can be accessed directly
b) Can be accessed with any public class name
c) Can be accessed with dot operator
d) Can be accessed using class name if not using static member function
Answer: d
Explanation: The static data members can be accessed using the class name also. If the member functions is not used or is not
to be used then we can call the static data members directly by using its corresponding class name.
9. Which among the following is the correct syntax to access static data member without using member function?
a) className -> staticDataMember;
b) className :: staticDataMember;

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

11. What is the output of the following program?


TU

class Test
{
K

private: static int x;


A

public: static void fun()


{
e/

cout &lt;&lt; ++x &lt;&lt; “ ”;


t.m

}
};
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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
d) Only one object uses the static data
Answer: a
Explanation: The static data is same for all the objects. Instead of creating the same data each time an object is created, the
compiler created only one data which is accessed by all the objects of the class. This saves memory and reduces redundancy.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
13. If object of class are created, then the static data members can be accessed
a) Using dot operator
b) Using arrow operator
c) Using colon
d) Using dot or arrow operator
Answer: d
Explanation: The static data members can be accessed in usual way as other members are accessed using the objects. The dot
operator is used generally. Arrow can be used with the pointers.

14. What will be the output of the following program?

class Test
{
public: Test()
{

um
cout &lt;&lt; "Test's Constructor is Called " &lt;&lt; endl;
}

nt
};

ua
class Result
{

_Q
static Test a;
public:

ks
Result()
{
cout &lt;&lt; "Result's Constructor is Called " &lt;&lt; endl; oo
_B
}
};
es

void main()
ot

{
Result b;
_N

}
TU

a) Test’s Constructor is Called


b) Result’s Constructor is Called
c) Result’s Constructor Called Test’s Constructor is Called
K

d) Test’s Constructor Called Result’s Constructor is Called


A
e/

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

b) dataType className :: memberName =value;


ht

c) static dataType memberName;


d) className : dataType -> memberName;
Answer: d
Explanation: The syntax given in option d doesn’t belong to any particular declaration or definition. First one is to access the
static members using the class name. Second is to define the static data outside the class. Third syntax id to declare a data
member as static in a class.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Static
Member Functions”.
1. Which among the following is correct definition for static member functions?
a) Functions created to allocate constant values to each object
b) Functions made to maintain single copy of member functions for all objects
c) Functions created to define the static members
d) Functions made to manipulate static programs
Answer: b
Explanation: The functions which are made common, with respect to definition and data usage, to all the objects. These functions
are able to access the static data members of a class.
2. The static member functions
a) Have access to all the members of a class
b) Have access to only constant members of a class

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

b) className -> functionName;


c) className : functionName;
d) className :: functionName;
K
A

Answer: d
Explanation: The scope resolution operator must be used to access the static member functions with class name. This indicates
e/

that the function belongs to the corresponding class.


t.m

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Created with each new object
b) Created twice in a program
c) Created as many times a class is used
d) Created and initialized only once

Answer: d

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The static members are created only once. Then those members are reused whenever called or invoked. Memory
is allocated only once.
8. Which among the following is true?
a) Static member functions can be overloaded
b) Static member functions can’t be overloaded
c) Static member functions can be overloaded using derived classes
d) Static member functions are implicitly overloaded
Answer: b
Explanation: The static member functions can’t be overloaded because the definition must be the same for all the instances of a
class. If an overloaded function have many definitions, none of them can be made static.
9. The static member functions
a) Can’t be declared const
b) Can’t be declared volatile

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

11. The keyword static is used


a) With declaration inside class and with definition outside the class
TU

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Can’t be mutable
c) Can’t be integer
d) Can’t be characters
Answer: b
Explanation: The static data members can never be mutable. There copies are not made. Since those are common and created

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
only once.
15. If static data member are made inline,
a) Those should be initialized outside the class
b) Those can’t be initialized with the class
c) Those can be initialized within the class
d) Those can’t be used by class members
Answer: c
Explanation: Since the members are created once and are common for all the instances, those can be initialized inside the
class. Those doesn’t change with each object being created hence can be defined inside the class once for all.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “String
Class”.
1. Which is a true statement for object of String class?
a) Object are immutable
b) Object are mutable
c) Object are created only once
d) Object can’t be created
Answer: a
Explanation: The object of string class are mostly immutable. This means that the String objects are constant. These can’t be
changed once created.
2. How to declare an object of class String?
a) String object_Name = value;
b) String object_name = new;

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:/

a) It returns the character at the specified position


b) It returns the string of length 1 from the specified index
tp

c) It returns the string from specified index till the end


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Replace old string by new string
b) Add two strings
c) Append one string at end of another string
d) Remove a string from end of one string

Answer: c

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The concat function is used to append string into another string. The new string is always appended at the end of
source string. The target string is appended as it is and the whole string is then ended by null character.
8. The function lastIndexOf() is used to
a) Get the index of last occurrence of specified character in argument
b) Get the index of first occurrence of specified character in argument
c) Get the index of last occurrence of first character in string
d) Get the index of last occurrence of last character of string
Answer: a
Explanation: The function is used to get the last occurrence index of a character present in a string. The return type is char.
Single character is returned. The function is used with a string object and the target character is passed as its argument.
9. Function equals() is and equalIgnoreCase() is
a) Case Insensitive, case insensitive
b) Case sensitive, Case insensitive

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

11. String class provides function toUpper() to


a) Convert first character to uppercase
TU

b) Convert last character to uppercase


c) Convert the whole string characters to uppercase
K

d) Convert uppercase to lower and lower to uppercases


A

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

same. But if some character is in lowercase then it will be converted to uppercase.


12. String trim() function is used to
/
s:/

a) Remove all the white spaces from the string


b) Remove white space from start of string
tp

c) Remove white space at end of string


ht

d) Remove white space from both the ends of string


Answer: d
Explanation: The function is used to remove any white space from both the ends of a given string. The white space include
space, tab, next line etc. It will be removed both from the starting of string and from the end of string.
13. Function replace() accepts arguments.
a) 1
b) 2
c) 3
d) 4
Answer: b
Explanation: The first argument is the target character. This target character will be replaced by another character. The new
character is the second argument to the function. Only the characters can be passed as argument, not a string.
14. If two arguments are passed to the indexOf() function then

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
a) Second argument indicates the occurrence number of specified character from starting
b) Second argument indicates the occurrence number of specified character from end
c) Second argument indicates the index of the character in first argument
d) Second argument indicates the index of the character from the last of the string

Answer: a

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The string may have more than one occurrence of a character. We use this function to get the index at which the
specified number of times a specific character has occurred in a string. For example, we can get the index of 5th occurrence of
character “j” in a string.
15. The string class deals with string of only character type.
a) True
b) False
Answer: a
Explanation: The string class objects can be used for any string consisting of characters. The characters include numbers,
alphabets and few special characters. String class is not necessary to be used but provides a huge set of inbuilt functions to
make the string operations easier.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Template Class”.
1. A template class can have
a) More than one generic data type
b) Only one generic data type
c) At most two data types
d) Only generic type of integers and not characters
Answer: a
Explanation: The template class can support more than one data type. The only thing is to add all the data types required in a list
separated by comma within template specification.
2. Which among the following is the proper syntax for the template class?
a) template <typename T1, typename T2>;
b) Template <typename T1, typename T2>;

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

4. What is the syntax to use explicit class specialization?


a) template <int> class myClass<>{ }
TU

b) template <int> class myClass<int>{ }


c) template <> class myClass<>{ }
d) template <> class myClass<int>{ }
K
A

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) 8-bit character and wide characters
c) 32-bit character and locale characters
d) 64-bit characters and locale characters
Answer: b
Explanation: The I/O specialization is made with wide character and 8-bit characters. Wide characters are used to store the

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
characters that might take more than 1 byte of space in memory or any size that is different from the one that the machine is
using.
8. Can typeid() function be used with the object of generic classes?
a) Yes, only if default type is given
b) Yes, always
c) No, generic data can’t be determined
d) No, never possible
Answer: b
Explanation: The typeid() function can be used with the objects of generic classes. An instance of a template class will take the
type of data that is being used with it. Hence when typeid() function is used, the data type would have already been defined and
hence we can get desired result from typeid() function.
9. The class is a specialization of a more general template class.
a) String

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

perform the same task on given different types of data.


_N

11. What if static members are declared inside template classes?


a) All instances will share the static variable
TU

b) All instances will have their own static variable


c) All the instances will ignore the static variable
K

d) Program gives compile time error


A

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

static members are not shared usually.

12. What is the output of following program?


/
s:/

template <typename T>


tp

void test(const T&x)


{
ht

static int count = 0;


cout &lt;&lt; "x = " &lt;&lt; x &lt;&lt; " count = " &lt;&lt; count &lt;&lt; endl;
++count;
return;
}

void main()
{
test<int> (2);
test<int>(2);
test<double>(2.2);
}

a)
x = 2 count = 0

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
x = 2.2 count = 0
x = 2.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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
x = 2 count = 0
x = 2.2 count = 0

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/

15. Template classes must have at least one static member.


t.m

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ test focuses on “Memory Allocation of Object”.
1. What does memory allocation for objects mean?
a) Actual creation and memory allocation for object members
b) Creation of member functions
c) Creation of data members for a class
d) Actual creation and data declaration for object members
Answer: a
Explanation: The memory allocated for the object members indicates actual creation of the object members. This is known as
memory allocation for object.
2. Where is the memory allocated for the objects?
a) HDD
b) Cache
c) RAM

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

4. Using new is type safe as


a) It require to be specified with type of data
b) It doesn’t require to be specified with type of data
TU

c) It requires the name of data


d) It allocated memory for the data
K
A

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

d) malloc() and calloc()


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
c) 20 Bytes
d) 18 Bytes
Answer: a
Explanation: The size of an object of the class given in question will be of size 22 bytes. This is because the size of an object is
always equal to the sum of sizes of the data members of the class, except static members.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
7. Which keyword among the following can be used to declare an array of objects in java?
a) new
b) create
c) allocate
d) arr
Answer: a
Explanation: The keyword new can be used to declare an array of objects in java. The syntax must be specified with an object
pointer which is assigned with a memory space containing the required number of object space. Even initialization can be done
directly.
8. When is the memory allocated for an object gets free?
a) At termination of program
b) When object goes out of scope
c) When main function ends
d) When system restarts

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

10. Which function is called whenever an object goes out of scope?


_N

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

11. Which operator can be used to check the size of an object?


a) sizeof(objectName)
b) size(objectName)
/
s:/

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Its memory is allocated in heap
c) Its memory is allocated in HDD
d) Its memory is allocated in cache

Answer: a

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The memory for any data or object that are used in a user defined function are always allocated in the stack. This is
to ensure that the object is destroyed as soon as the function is returned. Also this ensures that the correct memory allocation
and destruction is performed.
14. In java, takes care of managing memory for objects dynamically.
a) Free collector
b) Dust collector
c) Memory manager
d) Garbage collector
Answer: d
Explanation: The garbage collector in java takes care of the memory allocations and their deletions dynamically. When an object
is no more required then the garbage collector deletes the object and free up all the resources that were held by that object.
15. Which operator can be used to free the memory allocated for an object in C++?
a) Free()

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on “Types
of Inheritance”.
1. How many types of inheritance are possible in C++?
a) 2
b) 3
c) 4
d) 5
Answer: d
Explanation: There are five types of inheritance that are possible in C++. Single level, Multilevel, multiple, hierarchical and hybrid.
Here we count hybrid also because it sometimes can bring up a new form of inheritance, Like inheritance using multiple and
hierarchical, which sometimes results in diamond problem.
2. Which among the following is true?
a) Java supports all types of inheritance

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?

class student{ public: int marks; };


class topper: public student { public: char grade; };
oo
_B
class average{ public: int makrs_needed; };
class section: public average{ public: char name[10]; };
es

class overall: public average{ public: int students; };


ot

a) Single level
_N

b) Multilevel and single level


c) Hierarchical
TU

d) Hierarchical and single level


Answer: d
K

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

4. Which among the following best describes multiple inheritance?


a) Two classes being parent of any other classes
b) Three classes being parent of other classes
/
s:/

c) More than one class being parent of other child classes


d) More than one class being parent of single child
tp

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Hybrid
c) Hierarchical
d) Multilevel
Answer: b
Explanation: In diamond problem, hierarchical inheritance is used first, where two different classes inherit the same class and

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
then in turn a 4th class inherits the two classes which had inherited the first class. Using more than one type of inheritance here, it
is known as hybrid inheritance.
7. If 6 classes uses single level inheritance with pair classes (3 pairs), which inheritance will this be called?
a) Single
b) Multiple
c) Hierarchical
d) Multilevel
Answer: a
Explanation: Here all the pairs are using single inheritance. And no different pairs are inheriting same classes. Hence it can’t be
called hybrid or multilevel inheritance. You can say the single inheritance is used 3 times in that program.

8. Which among the following is correct for the following code?

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

a) Multi-level inheritance is used, with nested classes


ot

b) Multiple inheritance is used, with nested classes


c) Single level inheritance is used, with enclosing classes
_N

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

9. Which among the following is false?


a) If one class inherits the inherited class in single level inheritance, it is multi-level inheritance
e/

b) Hybrid inheritance always contains multiple inheritance


t.m

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

of specific type always.


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: This is so because few classes might not be involved in any type of inheritance in whole program whereas other
classes might be participating in more than one type of inheritance at the same time.
12. Which type of inheritance cannot involve private inheritance?
a) Single level

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) Multiple
c) Hybrid
d) All types can have private inheritance
Answer: d
Explanation: This is a common type of inheritance where the protected and public members of parent class become private
members in child class. There is no type which doesn’t support private inheritance.
13. How many classes can be inherited by a single class in multiple inheritance (C++)?
a) Only 2
b) Only 27
c) Only 1024
d) Any number of classes can be inherited
Answer: d
Explanation: Any class can inherit any number of classes. There is no limit defined for the number of classes being inherited by a

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

a) Only till class C


b) Only till class J
ot

c) Only till class Z


_N

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming (OOPs) using C++ Multiple Choice Questions & Answers (MCQs) focuses on
“Upcasting”.
1. What is upcasting?
a) Casting subtype to supertype
b) Casting super type to subtype
c) Casting subtype to super type and vice versa
d) Casting anytype to any other type
Answer: a
Explanation: The upcasting concept includes only the casting of subtypes to the super types. This casting is generally done
implicitly. Smaller size types can fit into larger size types implicitly.
2. Which among the following is true for upcasting in inheritance?
a) Downward to the inheritance tree
b) Upward to the inheritance tree

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

4. Which among the following is the best situation to use upcasting?


a) For general code dealing with only subtype
TU

b) For general code dealing with only supertype


c) For general code dealing with both the supertype and subtype
d) For writing a rigid code with respect to subtype
K
A

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

5. Which property is shown most when upcasting is used?


a) Code reusability
/
s:/

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
{

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
public :int a;
}
class B:public A
{
int b;
}

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
main()
{
B b=new A(); //casting 1
A a=new B(); //casting 2
}
a) Casting 1
b) Casting 2
c) casting 1 and casting 2
d) casting 1 nor casting 2
Answer: b
Explanation: The casting 2 is correct. The objects casting must be done from derived class object to a parent class object. That
is, the object of the superclass can be made an object of subclass only. Vice versa is not possible.
8. If multiple inheritance is implemented, which upcasting will be correct?

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

objects. It is not compulsory to upcast to nearest parent.


10. Upcasting is without an explicit type cast.
TU

a) Always allowed for public inheritance


b) Always allowed for protected inheritance
K

c) Always allowed for private inheritance


A

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:/

11. Which concept is needed because of implicit type casting use?


a) Static binding
tp

b) Dynamic binding
ht

c) Compile time binding


d) Source code binding
Answer: b
Explanation: Since the implicit type casting allows casting of a base class pointer to refer to its derived class object or even
base class object. We need dynamic type casting so that the references can be resolved during execution of program.
12. When are the pointer types known for upcasting the objects?
a) Compile time
b) Runtime
c) Source code build time
d) Doesn’t apply to pointer types
Answer: a
Explanation: The pointer or reference types are known at compile time for the upcasting of an object. This is because the
addresses must be known for casting the derived class to base class object.

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
13. When are the object type known for upcasting the objects?
a) Compile time
b) Runtime
c) Source code build time
d) Doesn’t apply to objects directly

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Answer: b
Explanation: The upcasting with objects directly requires runtime resolving. The objects are fixed and address are allocated at
compile time. But the execution of a program requires runtime knowledge of object types, for implicit type cast.
14. If two classes are defined “Parent” and “Child” then which is the correct type upcast syntax in C++?
a) Parent *p=child;
b) Parent *p=*child;
c) Parent *p=&child;
d) Parent *p=Child();
Answer: c
Explanation: The syntax must contain the base class name first. So that the parent class object pointer can be declared. Then the
object is assigned with the derived class object with & symbol. & symbol is added to get the address of the derived class object.
15. Which among the following is true?
a) Upcasting is possible only for single level inheritance

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
This set of Object Oriented Programming using C++ Question Bank focuses on “Protected Access Specifier”.
1. Which among the following best describes the protected specifier?
a) Members are most secure and can’t be used outside class
b) Members are secure but can be used outside the class
c) Members are secure as private, but can be inherited
d) Members are secure like private, but can’t be inherited
Answer: c
Explanation: The members which are made protected, are most secure if inheritance is not used. But, this facility is provided to
keep those members private and with that, they can be inherited by other classes. This is done to make the code more flexible.
2. If a constructor is defined in protected access, then?
a) It’s instance can be created inside the subclasses
b) It’s instance can be created anywhere in the program
c) It’s instance can be created inside the subclasses and main() function

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

b) The instances can be created only in main() function


A

c) The instances can be created only in parent class


d) The instances can be created anywhere in the program
e/
t.m

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:/

argument can be created anywhere in the program.


tp

4. If the protected members are to be made accessible only to the nearest subclass and no further subclasses, which access
ht

specifier should be used in inheritance?


a) The sub class should inherit the parent class privately
b) The sub class should inherit the parent class as protected
c) The sub class should inherit the parent class as public
d) The sub class can use any access modifier
Answer: a
Explanation: The sub class should use private inheritance. This will allow only the nearest sub classes to inherit the protected
members and then those members will become private. Hence further inheritance of those members will not be possible.

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)
{

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
marks=x;
}
public : A()
{
marks=100;

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
}
}
class B
{
A a;
A b=100;
};
main()
{
A a, b=100;
B c;
}
a) Program runs fine
b) Program gives runtime error
c) Program gives compile time error

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&lt;&lt;”marks=”&lt;&lt;marks;
}
};
K

class B: protected A
A

{
e/

};
B b;
t.m

b.disp();
/

a) Object b can’t access disp() function


s:/

b) Object b can access disp() function inside its body


c) Object b can’t access members of class A
tp

d) Program runs fine


ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
Explanation: The instances can be created anywhere in the program. This is because the constructors are not considered
among the members defined in protected mode. Hence the default implicit constructor will be used whenever an object is
created.

9. Which among the following is correct for the code given?

class A
{
private: int marks;
A()
{
}
Public : disp()
{
cout&lt;&lt; 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

members. In turn, the object of B will not be created.


ot

10. If protected inheritance is used then


_N

a) Public members become public in subclass


b) Protected members become public in subclass
TU

c) Protected members become protected in subclass


d) Protected and Public members become protected in subclass
K

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
/

b) Members must accessed using class pointers


s:/

c) Members must be accessed as usual


d) Members must be made public
tp
ht

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

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
b) False
Answer: b
Explanation: The statement given is true. The clear difference is protected members are available in other packages also, but
the default members are available within the package only.

um
nt
ua
_Q
ks
oo
_B
es
ot
_N
TU
K
A
e/
/ t.m
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


@AKTU_Notes_Books_Quantum
14. If a class have default constructor defined in private access, and one parameter constructor in protected mode, how will it be
possible to create instance of object?
a) Define a constructor in public access with different signature
b) Directly create the object in the subclass
c) Directly create the object in main() function
d) Not possible
Answer: a
Explanation: If a new constructor is defined in public access. That will be available to the whole program. Only restriction will be
of the way to use it.

15. What will be the output of the program given below?

class A
{
Public : A(int a=0)

um
{
cout&lt;&lt;”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

To practice Object Oriented Programming Question Bank using C++, .


TU
K
A
e/
t.m
/
s:/
tp
ht

****** Telegram:- @AKTU_Notes_Books_Quantum ******


→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 2 Develop Java programs for window/web-based applications

CO 3 Design web pages using HTML, XML, CSS and JavaScript.

CO 4 Creation of client-server environment using socket programming

CO 5 Building enterprise level applications and manipulate web databases using JDBC

CO 6 Design interactive web applications using Servlets and JSP


DETAILED SYLLABUS

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

Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans


Properties, Types of beans, Stateful Session bean, Stateless Session bean, Entity bean Java
IV Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating,
Databases with JDBC, Prepared Statements, Transaction Processing, Stored Procedures

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

1. Unit-I : Introduction ………………………...………………………………….….3

2. Unit-II : Web Page Designing ………………………………….…………...…….23

3. Unit-III : Scripting & Introduction to Networking …………………..….....…... 31

4. Unit-IV: Enterprise Java Bean & Database Connectivity (JDBC): ………..….45

5. Unit-V: Servlets & Java Server Pages (JSP)………………….....................…….52

2 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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

Q4. Which is valid about java.lang.Exceptions?


A.The class Exception and all its subclasses that are not also subclasses of
RuntimeException arechecked exceptions
B.The class Error and all its subclasses are unchecked exceptions
C.The class RuntimeException and all its subclasses are unchecked exceptions
D.All
Ans D

Q5. What is disadvantage/invalid about try-with-resource


A. introduced in java 7
B. we need not to write explicit code for closing file
C. Using multiple resources inside Try-with-resources is also allowed
d. None
Ans D

Q6. FileInputStream implements which interface for closing file automatically


in java7?
A. java.lang.AutoClose
B. java.lang.CloseAutomatically
C. java.lang.AutoCloseable
D. java.lang.Closeable
Ans C
Q7. Web page editors works on a ____ principle.
(A) WWW
(B) HTML
(C) WYSIWYG
(D) WYGWYSI
Ans: C

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

Q10. How many colour names are used by the browsers?


(A) 8
(B) 10
(C) 12
(D) 16
Ans: D

Q11. What is the abbreviation of HTTP?


(A) Hypertext tag path
(B) Hyper Text Transfer Protocol
(C) Hypertext transfer path
(D) None
Ans: B

Q12. The entire web document is contained within ____


(A) Comments
(B) Tags
(C) Web page
(D) HTML element
Ans: D

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

Q17. Which of these events is generated when a button is pressed?


A. WindowEvent
B. ActionEvent
C. WindowEvent
D. KeyEvent
Ans: B

Q18. Which of these events is generated when a button is pressed?


A. WindowEvent
B. ActionEvent
C. WindowEvent
D. KeyEvent
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

Q20. Package of drawstring() method is in?


A. java.applet
B. java.io
C. java.awt
D. javax.swing
Ans: C
Q21. Predict the output of following Java program
class Main {
public static void main(String args[]) {
try {
throw 10;
}
catch(int e) {
System.out.println("Got the Exception " + e);
}
}
}
A. Got the Exception 10
B. Got the Exception 0
C. Compiler Error
Answer: (C)

Q22. Predict the output of following Java program

class Base extends Exception {}


class Derived extends Base {}
public class Main {
public static void main(String args[]) {
// some other stuff
try {
// Some monitored code
throw new Derived();
}
catch(Base b) {
System.out.println("Caught base class exception");
}
catch(Derived d) {
System.out.println("Caught derived class exception");
}
}
}

(A) Caught base class exception


(B) Caught derived class exception
(C) Compiler Error because derived is not throwable
(D) Compiler Error because base class exception is caught before derived class
Answer: (D)

Q23. What block is always executed, independently of an exception being raised?


A. throws
B. finally
C. catch
D. throw
Ans D
Q24. Exception and Error are direct subclasses of?
A. BaseException
B. Throwable
C. Object
D. RuntimeException
Ans B

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

Q27. Which of these are java.lang.Error in exception handling in java


A. VirtualMachineError
B. IOError
C. AssertionError
D. ThreadDeath
E. All
Ans E

Q28. What is invalid statements for automatic resource management in java?


A. Allows us to catch more than one exception in one catch block
B. We could separate different exceptions using pipe ( | )
C. Increases developer efforts of writing multiple catch blocks.
D. None
Ans C

Q29. Which of these functions is called to display the output of an applet?


a) display()
b) paint()
c) displayApplet()
d) PrintApplet()
Answer: b

Q30. In Servlet Terminology what provides runtime environment for JavaEE (j2ee)
applications. It performs many operations that are given below:

1. Life Cycle Management


2. Multithreaded support
3. Object Pooling
4. Security etc.
A. Server
B. Webserver
C. Container
D. Application Server
Answer: C. Container

Q31. The following example shows the creation of a


import java.applet.*;
import java.awt.*;

public class Main extends Applet{


public void paint(Graphics g){
g.drawString("Welcome in Java Applet.",40,20);
}
}

A. Banner using Applet


B. Basic Applet
C. Display clock
D. None of the above
ANSWER: B. Basic Applet

Q32. From the following statements which is a drawback for Applet?


A. It works at client side so less response time
B. Secured
C. It can be executed by browsers running under many platforms, including Linux, Windows, and
Mac Os etc.
D. Plugin is required at client browser to execute applet
ANSWER: D. Plugin is required at client browser to execute applet

Q33. Applets cannot make network connection exception to the server host from which it
originated.
a. True
b. False
ANSWER: True

Q34. What will be output for the following code?


import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
public void paint(Graphics g)
{
g.drawString(""A Simple Applet"", 20, 20);
}
}
A. A Simple Applet
B. A Simple Applet 20 20
C. Compilation Error
D. Runtime Error
Ans : A
Q35. What is internet?
a) a single network
b) a vast collection of different networks
c) interconnection of local area networks
d) interconnection of wide area networks
Answer: b

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

Q37. ISP exchanges internet traffic between their networks by __________


a) internet exchange point
b) subscriber end point
c) isp end point
d) internet end point
Answer: a

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

Q42. Internet addresses must always have at least


(i) a country name or organization type
(ii) internet service provider’s name
(iii) name of organization
(iv) name of individual
(v) type of organization
a. i, ii, iii
b. ii, iii, iv
c. i, iii
d. ii, iii, iv, v
Ans: c

Q43. Internet packet data structure consists of


(i)source address
(ii) destination address
(iii)serial number of packets
(iv)message bytes
(v)Control bits for error checking
(vi) Path identification bits
a. i, ii, iii
b. i, ii, iii, iv
c. i, ii, iii, iv, v
d. i, ii, iii, iv, v, vi
Ans: c

Q44. Among services available on the World Wide Web are


(i)Encryption
(ii)HTTP
(iii)HTML
(iv)Firewalls
a. i and ii
b. ii and iii
c. iii and iv
d. i and iv
Ans: b
Q45. A URL specifies the following:
(i) protocol used
(ii) domain name of server hosting web page
(iii) name of folder with required information
(iv) name of document formatted using HTML
(v) the name of ISP
a. i, ii, iii, iv
b. ii, iii, iv, v
c. i, iii, iv
d. i, ii, iii, v
Ans: a

Q46. Desirable properties of a website are


(i)a meaningful address
(ii)Help and search facilities
(iii) Links to related sites
(iv)Features to allow users to give feedback
(v)Hosting on a mainframe
a. i, ii, iii
b. i, ii, iii, iv
c. i, ii, iii, iv, v
d. i, ii, iii, v
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

Q48. What will be the output of the following Java code?


class multithreaded_programing
{
public static void main(String args[])
{
Thread t = Thread.currentThread();
System.out.println(t);
}
}
a) Thread[5,main]
b) Thread[main,5]
c) Thread[main,0]
d) Thread[main,5,main]
Answer: d
Q49. What is the priority 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) 4
b) 5
c) 0
d) 1
Answer: b

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

Q3. URL is an acronym for


A. Universal Resource Locator
B. Universal Research locator
C. Uniform Resource Locator
D. None of the above
Ans: C. Uniform Resource Locator

Q4. The purpose of Markup is to …


A. Add hypertext capabilities
B. Enhance the document
C. Both A and B
D. None of the above
Ans: C. Both A and B

Q5. GIF and PNG files use an……….. format.


A. Interlacing
B. Progressive
C. Regressive
D. Clear View
Ans: A. Interlacing

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>

Q8. …… are used to visually displays to navigate to different pages.


A. Image maps
B. Hyper pages
C. Different slides
D. Animated pages
Ans: A. Image maps

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

Q10. For obtaining ordered list use the tag


A. <H1>
B. <UL>
C. <OL>
D. <ML>
Ans: C. <OL>

Q11. The …… tag defines a multi-line text input control.


A. <paragraph>
B. <multiline>
C. <textbox>
D. <textarea>
Ans: D. <textarea>

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

Q18. All information in XML is …………………


A) Unicode text
B) multi code
C) multi text
D) simple text
Ans: A) Unicode text

Q19. An entity in XML is a …………………………..


A) class
B) logical information
C) simple information
D) flexible information storage unit
Ans: D) flexible information storage unit

Q20. A tool for reading XML documents is popularly called a …………………


A) XML delimiters
B) XML processor
C) XML parser
D) Both b and c
Ans: D) Both b and c
Q21. XSL stands for
A) Extensible Style sheet Language
B) Extensible Style Language
C) Exclusive Stylesheet Language
D) Exclusive Style Language
Ans: A) Extensible Style sheet Language

Q22. XML tabs are ………………………..


A) case sensitive
B) case insnesitive
C) easy
D) deficult
Ans: A) case sensitive

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>

Q26. Which of the following tags are belongs to <Table> tag.


A. <table> <head><title>
B. <td><br>
C. <ol><ul>
D. <table><tr><td>
Ans: D. <table><tr><td>

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

Q42. ……………………. property defines the minimum number of lines in a paragraph to be


left at the top of a page.
A) widows
B) line-number
C) line-spacing
D) margins
Ans: A) widows

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

Q48. Choose The Correct HTML Tag To Make A Text Italic

A. &lt;italic>
B. &lt;it>
C. &lt;i>
D. &lt;il>
Ans: C

Q49. HTML Tags Are Surrounded By Which Type Of Brackets.

A. Curly
B. Round
C. Squart
D. Angle
Ans: D

Q50. Which of the following is the correct CSS syntax?


i) {p:color=green, font-size=15px
ii) {p:color=green, font-size=15px}
iii) p {color:green, font-size:15px;}
iv) p {color:green; font-size:15px;}
Ans: iii

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)

1. Which of the following is not JavaScript Data Types?

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

4. Which of the following is correct about features of JavaScript?

A. It can not Handling dates and time.


B. JavaScript is a object-based scripting language.
C. JavaScript is not interpreter based scripting language.
D. All of the above
Ans : B
5. Choose the correct JavaScript syntax to change the content of the
following HTML code.

A. document.getElement (“letsfindcourse").innerHTML = "I am a


letsfindcourse";
B. document.getElementById (“letsfindcourse").innerHTML = "I am a
letsfindcourse";
C. document.getId (“letsfindcourse") = "I am a letsfindcourse";
D. document.getElementById (“letsfindcourse").innerHTML = I am a
letsfindcourse;
Ans : B
6. Which of the following is the correct syntax to display "Letsfindcourse" in
an alert box using JavaScript?

A. alert-box("Letsfindcourse");
B. confirm("Letsfindcourse");
C. msgbox("Letsfindcourse");
D. alert("Letsfindcourse");
Ans : D

7. JavaScript is designed for following purpose -

A. to style HTML pages


B. to execute Queries related to databases on a server
C. to add interactivity to html pages
D. All of the above
Ans : D

8. What will be the output of the following Javascript code?


var string1 = "Letsfindcourse";
var intvalue = 30;
alert( string1 + intvalue );

A. Letsfindcourse 30
B. 30
C. Letsfindcourse30
D. Exception
Ans : C

9. What does javascript use instead of == and !=?

A. It uses bitwise checking


B. It uses === and !== instead
C. It uses equals() and notequals() instead
D. It uses equalto()
Ans : B

10. What are the types of Pop up boxes available in JavaScript?

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

12. What makes Ajax unique?


A. It works as a stand-alone Web-development tool.
B. It works the same with all Web browsers.
C. It uses C++ as its programming language.
D. It makes data requests asynchronously.
Ans: D

13. What does the XMLHttpRequest object accomplish inAjax?


A. It’s the programming language used to develop Ajax applications.
B. It provides a means of exchanging structured data between theWeb server and
client.
C. It provides the ability to asynchronously exchange data betweenWeb browsers
and a Web server.
D. It provides the ability to mark up and style the display of Web-pagetext.
Ans: C

14. Ajax is a programming language.


A. True
B. False
Ans: B

15. What combination of technologies gives AJAX its name?


A. ASP and XAML
B. Asynchronous JavaScript and XML
C. Autonomic Computing and DHTML
D. Atlas and XML
Ans: B

16. Which one of these technologies is NOT used in AJAX?


A. CSS
B. DOM
C. DHTML
D. Flash
Ans: D
17. What does the <noscript> tag do?
A. Enclose text to be displayed by non-JavaScript browsers.
B. Prevents scripts on the page from executing.
C. Describes certain low-budget movies.
D. None of the above
Ans: A

18. Why so JavaScript and Java have similar name?


A. JavaScript is a stripped-down version of Java
B. JavaScript’s syntax is loosely based on Java’s
C. They both originated on the island of Java
D. None of the above
Ans: B

19. JavaScript is also called client-side JavaScript.


A. Microsoft
B. Navigator
C. LiveWire
D. Native
Ans: B

20. Is it possible to use multiple


ScriptManager controls on aWeb page?
a. Yes
b. No
Ans: B

21. TCP,FTP,Telnet,SMTP,POP etc. are examples of ?


A) Socket
B) IP Address
C) Protocol
D) MAC Address
Ans: C

22. Which classes are used for connection-


oriented socket programming?
A) Socket
B) ServerSocket
C) Both A & B
D) None of the above
Ans: C
23. Which class can be used to create a server socket. This object is used
to establish communication with the clients?
A) ServerSocket
B) Socket
C) Both A & B
D) None of the above
Ans: A

24. Which methods are commonly used in ServerSocket class?


A) public OutputStream getOutputStream()
B) public Socket accept()
C) public synchronized void close()
D) None of the above
Ans: B

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

26. The java.net.InetAddress class represents an?


A) Socket
B) IP Address
C) Protocol
D) MAC Address
Ans: B

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

28. Which classes are used for connection-less socket programming?


A) DatagramSocket
B) DatagramPacket
C) Both A & B
D) None of the above
Ans: C
29. which method is used to establish the connection with the specified
url in a Driver Manager class?
A. public static void registerDriver(Driver driver)
B. public static void deregisterDriver(Driver driver)
C. public static Connection getConnection(String url)
D. public static Connection getConnection(String url,String userName,String
password)
Ans: C

30. Which of these methods is used to know host of an URL?


a) host()
b) getHost()
c) GetHost()
d) gethost
Ans: B

31. Which of these exceptions is thrown by URL class’s constructors?


a) URLNotFound
b) URLSourceNotFound
c) MalformedURLException
d) URLNotFoundException
Ans: C

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

33. What will be the output of the following Java code?

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

37. Datagram is basically an information but there is no guarantee of its


content, arrival or arrival time.
A) True
B) False
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

40. 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. getArray()

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

42. Which of the following is true about factory method?


a) A factory method is a non-constructor operation that creates and returns class
instances
b) Factory methods are widely used in mid-level design patterns and in object-
oriented programming in general
c) Factory methods create new instances using constructors or cloning, so they
do not rely on any special technique for class instantiation
d) All of the mentioned
Ans: D

43. When a generator assumes responsibility for product object creation in


a factory method,which of the following capabilities become available?
a) Access to product constructors can be restricted
b) Private data can be provided to new product objects
c) Product objects can be configured after creation
d) All of the mentioned
Ans: D
44. . Which class that can have only one instance?
a) Adaptor Class
b) Proxy Class
c) Singleton Class
d) Factory class
Ans: C

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

46. Which of the following truly describes the structure of Generator


pattern?
a) A generator pattern has a Client that needs an instance of a Product class
b) A Generator that creates or obtains access to such an instance on behalf of the
Client
c) All of the mentioned
d) None of the mentioned
Ans: C

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

48. Which type of JavaScript language is ___

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

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
ANSWER: True

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

5. Abbreviate the term JMS?


a. Java Message Service
b. Java Monitor Service
c. Java Message Session
d. Java Monitor Session
ANSWER: Java Message Service

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. Stateful Session Bean


b. Stateless Session Bean
c. Singleton Session Bean
d. None of the above
ANSWER: Singleton Session Bean

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?

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

16. Which middleware services are provided by EJB?


a. Security
b. Transaction Management
c. Both A & B
d. None of the above
ANSWER: Both A & B

17. Which server-side component is required to be deployed on the server?


a. EJB
b. RMI
c. Both A & B
d. None of the above
ANSWER: EJB

18. How many types of session beans are available in EJB?


a. 2
b. 3
c. 4
d. 5
ANSWER: 3

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. Stateful Session Bean


b. Stateless Session Bean
c. Singleton Session Bean
d. None of the above
ANSWER: Stateless Session Bean

21. How many types of session bean?

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)

22. Which of the following is not a property of EJB transaction?

(a) Atomicity
(b) Consistency
(c) Isolation
(d) Distributed
(e) Durability.
Ans : D

23. EJB is like COM, Abbreviate the term COM?

A. Component Object Model


B. Component Oriented Model
C. Common Object Model
D. Common Oriented Model
Ans : A

24. Which of the following is not true about Java beans?


a) Implements java.io.Serializable interface
b) Extends java.io.Serializable class
c) Provides no argument constructor
d) Provides setter and getter methods for its properties
Answer: b

25. Which of the following is not a feature of Beans?


a) Introspection
b) Events
c) Persistence
d) Serialization
Answer: d
26. Which attribute is used to specify initialization method?
a) init
b) init-method
c) initialization
d) initialization-method
Answer: b

27. What are the major components of the JDBC?


a) DriverManager, Driver, Connection, Statement, and ResultSet
b) DriverManager, Driver, Connection, and Statement
c) DriverManager, Statement, and ResultSet
d) DriverManager, Connection, Statement, and ResultSet
Answer: a

28. Select the packages in which JDBC classes are defined?


a) jdbc and javax.jdbc
b) rdb and javax.rdb
c) jdbc and java.jdbc.sql
d) sql and javax.sql
Answer: d

29. What is the correct sequence to create a database connection?


i. Import JDBC packages.
ii. Open a connection to the database.
iii. Load and register the JDBC driver.
iv. Execute the statement object and return a query resultset.
v. Create a statement object to perform a query.
vi. Close the resultset and statement objects.
vii. Process the resultset.
viii. Close the connection.
a) i, ii, iii, v, iv, vii, viii, vi
b) i, iii, ii, v, iv, vii, vi, viii
c) ii, i, iii, iv, viii, vii, v, vi
d) i, iii, ii, iv, v, vi, vii, viii
Answer: b

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

32. Which of the following is advantage of using JDBC connection pool?


a) Slow performance
b) Using more memory
c) Using less memory
d) Better performance
Answer: d

33. What does setAutoCommit(false) do?


a) commits transaction after each query
b) explicitly commits transaction
c) does not commit transaction automatically after each query
d) never commits transaction
Answer: c

34. Which of the following is used to rollback a JDBC transaction?


a) rollback()
b) rollforward()
c) deleteTransaction()
d) RemoveTransaction()
Answer: a

35. Which of the following is not a valid type of statement in JDBC?


A - Statement
B - PreparedStatement
C - CallableStatement
D - QueryStatement
Answer : D

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

39. Abbreviate the term UDA?

a. Unified Data Access


b. Universal Data Access
c. Universal Digital Access
d. Uniform Data Access

ANSWER: Universal Data Access

40. Which packages contain the JDBC classes?

a. java.jdbc and javax.jdbc


b. java.jdbc and java.jdbc.sql
c. java.sql and javax.sql
d. java.rdb and javax.
Ans: C

41. Which of these obtains a Connection?

A. Connection.getConnection(url)
B. Driver.getConnection(url)
C. DriverManager.getConnection(url)
D. new Connection(url)
Ans: C

42. Which is responsible for getting a connection to the database?

A. Driver
B. Connection
C. Statement
D. ResultSet
Ans: A
43. Which resources have their close() method called when this code runs?

public static void runQuery(Connection conn) throws SQLException {


try (Statement stmt = conn.createStatement()) {
ResultSet rs = stmt.executeQuery("select * from clowns");
rs.next();
}
}

A. No close() methods are called.


B. Only Statement
C. Only Statement and Connection
D. Only Statement and ResultSet
Ans: D

44. What is the correct order to close database resources?

A. Connection then Statement then ResultSet


B. ResultSet then Statement then Connection
C. Statement then Connection then ResultSet
D. Statement then ResultSet then Connection
Ans: B

45. How many JDBC driver types does Sun define?

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

47. Which JDBC driver Type(s) is(are) the JDBC-ODBC bridge?

A. Type 1
B. Type 2
C. Type 3
D. Type 4
Ans: A
48. JDBC stands for:

A. Java Database Connectivity


B. Java Database Components
C. Java Database Control
D. None of the above is correct.
Ans: A

49. Which of the following is method of JDBC batch process?

a. setBatch()
b. deleteBatch()
c. removeBatch()
d. addBatch()
Ans: D

50. Which of the following is not a JDBC connection isolation levels?

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?

A - The init() method is called when the servlet is first created.


B - The init() method is called whenever the servlet is invoked.
C - Both of the above.
D - None of the above.

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

4. The sendRedirect() method of HttpServletResponse interface can be used to redirect


response to another resource, it may be servlet, jsp or html file.
a. True
b. False
ANSWER: True

5. Which of these ways used to communicate from an applet to servlet?


a. RMI Communication
b. HTTP Communication
c. Socket Communication
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

8. What type of servlets use these methods doGet(), doPost(),doHead, doDelete(),


doTrace()?
a. Genereic Servlets
b. HttpServlets
c. All of the above
d. None of the above
ANSWER: HttpServlets

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

12. Servlets handle multiple simultaneous requests by using threads.


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

16. Which HTTP Request method is non-idempotent?


a. GET
b. POST
c. BOTH A & B
d. None of the above
ANSWER: POST

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

18. What is the lifecycle of a servlet?


a. Servlet class is loaded
b. Servlet instance is created
c. init,Service,destroy method is invoked
d. All mentioned above
ANSWER: All mentioned above

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

21. 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
22. 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

23. Which are the examples of Application Server?


a. Apache
b. Tomcat
c. JBoss
d. Weblogic
e. Both C & D
ANSWER: Both C & D

24. Which of the following code delete a cookie in servlet?


A - response.deleteCookie(cookie);
B - cookie.setMaxAge(0);
C - request.deleteCookie(cookie);
D - None of the above
Answer : B

25. Which of the following code is used to get locale in servlets?


A - request.getLocale()
B - Locale.getLocale()
C - response.getLocale()
D - None of the above.
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

27. Which of the following is not a jsp directive?


A. Include
B. Page
C. Scriptlet
D. useBean
Answer : D

28. Which of the following are the valid scopes in JSP?

A - request, page, session, application


B - request, page, session, global
C - response, page, session, application
D - request, page, context, application

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

33. Which tag is used to execute java source code in JSP?


a. Declaration Tag
b. Scriptlet tag
c. Expression tag
d. None of the above
ANSWER: Scriptlet tag

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

37. Which packages does a JSP API consist of?


a. javax.servlet.jsp
b. java.servlet
c. javax.servlet.jsp.tagext
d. Both A & C
ANSWER: Both A & C

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

39. Request processing of JSP is done by calling which method?


A. jspInit()
B. jspService()
C. jspDestroy()
D. jspRequest()
ANSWER: B

40. Which of the following method helps in jsp page initialization?


A. jspInit()
B. jspService()
C. jspDestroy()
D. init()
ANSWER: A
Web Technologies - MCQs
1. The ___ receives a stream of tokens from the parser and sorts them according to function.
Ans: Event switcher

2. DOM stands for ___.


Ans: Document Object Model

3. SAX stands for ___.


Ans: Simple API in XML

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

6. ___ is a full-fledged object-oriented programming language.


Ans: Java

7. The ___ is used to manipulate a stored piece of text.


Ans: String Object

8. The ___ contains an array of previously visited URLs by the visitor.


Ans: History Object

8. The ___ represents an open window in a browser.


Ans: Window Object

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

12. The 'A' in AJAX stands for ___.


Ans: "asynchronous,"

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.

17. Abort () method cancels any network activity. (True/False)


Ans: True
18. ___ attribute is used to return the document response entity-body.
Ans: The responseXML

19. The ___ attribute is used to return the text response entity-body.
Ans: responseText

20. AJAX stands for “___.


Ans: Asynchronous JavaScript and XML

21. ___ uses a programming model with display and events.


Ans: AJAX

22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True

23. AJAX includes HTML and ___ for presenting.


Ans: CSS

24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True

25. ___ is a powerhouse of options for the Ajax programmer.


Ans: DHTML

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

29. SSP stands for ___.


Ans: Stream-based style sheet proposal

30. A markup language is just a set of rules. (True / false)


Ans: True

31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest

32. Using an external file, It is simpler to include a ___ file.


Ans: JavaScript

33. The X in Ajax stands for ___.


Ans: XML
34. In XML, we make up our own ___ names.
Ans: Element

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

40. DSO allows data binding to HTML table elements. (true/false)


Ans: True

41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()

42. PHP stands for___


Ans: Hypertext Pre-processor

43. PHP is a ___ scripting language.


Ans: Server-side

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

50. To add more functionality to a function, we can add ___.


Ans: Parameters
51. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest

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()

54. ___ can be used for interactive communication with a database.


Ans: AJAX

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()

61. ___ is used to request the deletion of the selected records.


Ans: AjazFunctionDelete()

62. A ___ is a separate application that stores a collection of data.


Ans: database

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

70. Variables cannot contain a ___.


Ans: period

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

---- THE END ----


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 2 Develop Java programs for window/web-based applications

CO 3 Design web pages using HTML, XML, CSS and JavaScript.

CO 4 Creation of client-server environment using socket programming

CO 5 Building enterprise level applications and manipulate web databases using JDBC

CO 6 Design interactive web applications using Servlets and JSP


DETAILED SYLLABUS

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

Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans


Properties, Types of beans, Stateful Session bean, Stateless Session bean, Entity bean Java
IV Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating,
Databases with JDBC, Prepared Statements, Transaction Processing, Stored Procedures

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

1. Unit-I : Introduction ………………………...………………………………….….3

2. Unit-II : Web Page Designing ………………………………….…………...…….23

3. Unit-III : Scripting & Introduction to Networking …………………..….....…... 31

4. Unit-IV: Enterprise Java Bean & Database Connectivity (JDBC): ………..….45

5. Unit-V: Servlets & Java Server Pages (JSP)………………….....................…….52

2 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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 2 Develop Java programs for window/web-based applications

CO 3 Design web pages using HTML, XML, CSS and JavaScript.

CO 4 Creation of client-server environment using socket programming

CO 5 Building enterprise level applications and manipulate web databases using JDBC

CO 6 Design interactive web applications using Servlets and JSP


DETAILED SYLLABUS

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

Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans


Properties, Types of beans, Stateful Session bean, Stateless Session bean, Entity bean Java
IV Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating,
Databases with JDBC, Prepared Statements, Transaction Processing, Stored Procedures

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

1. Unit-I : Introduction ………………………...………………………………….….3

2. Unit-II : Web Page Designing ………………………………….…………...…….23

3. Unit-III : Scripting & Introduction to Networking …………………..….....…... 31

4. Unit-IV: Enterprise Java Bean & Database Connectivity (JDBC): ………..….45

5. Unit-V: Servlets & Java Server Pages (JSP)………………….....................…….52

2 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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

2. DOM stands for ___.


Ans: Document Object Model

3. SAX stands for ___.


Ans: Simple API in XML

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

6. ___ is a full-fledged object-oriented programming language.


Ans: Java

7. The ___ is used to manipulate a stored piece of text.


Ans: String Object

8. The ___ contains an array of previously visited URLs by the visitor.


Ans: History Object

8. The ___ represents an open window in a browser.


Ans: Window Object

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

12. The 'A' in AJAX stands for ___.


Ans: "asynchronous,"

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.

17. Abort () method cancels any network activity. (True/False)


Ans: True
18. ___ attribute is used to return the document response entity-body.
Ans: The responseXML

19. The ___ attribute is used to return the text response entity-body.
Ans: responseText

20. AJAX stands for “___.


Ans: Asynchronous JavaScript and XML

21. ___ uses a programming model with display and events.


Ans: AJAX

22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True

23. AJAX includes HTML and ___ for presenting.


Ans: CSS

24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True

25. ___ is a powerhouse of options for the Ajax programmer.


Ans: DHTML

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

29. SSP stands for ___.


Ans: Stream-based style sheet proposal

30. A markup language is just a set of rules. (True / false)


Ans: True

31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest

32. Using an external file, It is simpler to include a ___ file.


Ans: JavaScript

33. The X in Ajax stands for ___.


Ans: XML
34. In XML, we make up our own ___ names.
Ans: Element

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

40. DSO allows data binding to HTML table elements. (true/false)


Ans: True

41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()

42. PHP stands for___


Ans: Hypertext Pre-processor

43. PHP is a ___ scripting language.


Ans: Server-side

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

50. To add more functionality to a function, we can add ___.


Ans: Parameters
51. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest

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()

54. ___ can be used for interactive communication with a database.


Ans: AJAX

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()

61. ___ is used to request the deletion of the selected records.


Ans: AjazFunctionDelete()

62. A ___ is a separate application that stores a collection of data.


Ans: database

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

70. Variables cannot contain a ___.


Ans: period

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

---- THE END ----


1. Which of the following options is correct with regard to
HTML?

(a) It is a modelling language


(b) It is a DTP language
(c) It is a partial programming language
(d) It is used to structure documents
(e) It is a scripting language.

2. Consider the following statement:


GET /cgi-bin/dispenser.pl&want=whatsnew.html HTTP/1.0

Which of the following options is a correct one?

(a) The above statement is a part of a request from a web client


(b) The above statement is a part of the input to a CGI program
(c) want is a variable and whatsnew.html is a value
(d) want is a variable and whatsnew.html HTTP/1.0 is the value
(e) dispenser.pl may be a CGI program.

3. When trying to access a URL, the following message is


displayed on the browser:
Server; Error 403

What could be the reason for the message?

(a) The requested HTML file is not available


(b) The URL refers to a CGI script and the header of the script
does not indicate where the interpreter is located
(c) The path to the interpreter of the script file is invalid
(d) The first line of the output from the script is not a valid
HTTP header
(e) The requested HTML file or CGI script has insufficient
permission.

4. Which of the following statements is incorrect regarding


multimedia on the web?

(a) The MPEG, AIFF and WAV are cross-platform formats


(b) The MPEG, AU and MIDI are cross-platform formats
(c) The SND format has a relatively low fidelity
(d) VRML can be used to model and display 3D interactive
graphics
(e) The dynsrc attribute in the element can be used to include
videos in web pages.

Search for courses for free

Coursary Open
5. What would be the colours of the RGB where the
hexadecimal values are #FF0000, #00FF00 and #0000FF
respectively?

(a) Blue, Green, Red


(b) Green, Blue, Red
(c) Green, Red, Blue
(d) Red, Blue, Green
(e) Red, Green, Blue.

6. The elements and have the following characteristics

(a) Element inherits properties defined for in a stylesheet


(b)and have no real meanings as html tags unless stylesheet is
applied

(c) Elements and define content to be inline or block-level

(d)and are used as alternatives for the element


(e)is used inside element.

7. Which of the following statement is not true regarding


JavaScript?
(a) JavaScript is a loosely typed language
(b) JavaScript is an object-based language
(c) JavaScript is event driven
(d) A JavaScript embedded in an HTML document is
compiled and executed by the client browser
(e) JavaScript can not run in stand-alone mode (without a
browser).

8. The following is a web-page:

<html>
<head> <title>JavaScript</title> </head>
<body bgcolor=”#0000ff”>
<script language=”JavaScript”>
<!– document.write(“<h1> hello world </h1>”); //–>
</script>
</body>
</html>

When the above web page is loaded into a browser, what


will happen?

(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.

9. The following statements are about three important


browser objects in JavaScript.

I. window object : The highest of all objects in the client-


side JavaScript object hierarchy.
II. navigator object : A collection of information about
the browser. Useful in browser sniffing.
III. document object : Provides access to the document
being viewed.
Which of the above statements is/are true?
(a) Only (I) above
(b) Only (II) above
(c) Only (III) above
(d) Both (I) and (II) above
(e) All (I), (II) and (III) above.

10. Consider the following script:

<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>

What will be the output of the above script?

(a) pass
(b) fail
(c) null
(d) 80
(e) Error at line 6.

WEB TECHNOLOGIES Mcqs

11. The following web page is loaded into a web server:

<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.

12. Which of the following statements is false regarding


“Cookies”?

(a) Cookies are programs which run in the background of


the web-client
(b) Cookies have the potential of being used to violate the
privacy of users
(c) Cookies are very helpful in keeping track of users in
developing online shopping cart applications, personalized
portals and in advertising on web sites
(d) Cookies cannot contain more than 4Kb of data
(e) Cookies usually contain data in the form of name = value
pairs.

13. Consider the following script:

<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.

14. Which of the following statements is true regarding


HTTP?

(a) Web browsers use only HTTP as a communication


protocol with servers
(b) It does not maintain any connection information on
previous transactions
(c) It is designed to route information based on content
(d) It refers to resources using their Universal Resource
Identifier (URI)
(e) It does not carry browser information to the server.

15. Which of the following is true about XHTML?

(a) It is a new hybrid technology that is different from both


XML and HTML
(b) It has totally replaced HTML as the tool for building Web
pages
(c) It is a reformulation of HTML in XML
(d) One cannot use it to create Web pages
(e) It has to be converted to HTML using a style sheet.

16. While working on a JavaScript project, in your


JavaScript application, which function would you use to
send messages to users requesting for text input?

(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().

18. Which of the following is true about client-side script


use in HTML documents?

(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.

19. Consider the following entries in a Cascading Style


Sheet (CSS) file.

P {colour: blue; background-colour: white; border-colour:


red; border-left: solid}
BODY {colour: black; border-colour: green}

What is the colour of text in a paragraph of an HTML


document that uses the above style sheet?

(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.

21. Which of the following statements is false about event


handlers in JavaScript?

(a) They can be included with input tags


(b) They can be associated with end of file processing for
a database application
(c) They can be included with the form tag
(d) They are generally used to call functions when triggered
(e) They can be used to trigger server-side scripts.

22. What method is used to specify a container’s layout in


JSP?

(a) setLayout()
(b) Layout()
(c) setContainerLayout()
(d) ContainerLayout()
(e) setConLayout().

23. Which method of the Component class is used to set


the position and size of a component in JSP?

(a) setSize()
(b) setBounds()
(c) setPosition()
(d) setPositionSize()
(e) setSizePosition().

24. What value does readLine() return when it has


reached the end of a file in JSP?
(a) Last character in the file
(b) False
(c) Null
(d) EOF
(e) True.

25. Which class in JSP provides the capability to


implement a growable array of objects?

(a) Array class


(b) GrowAbleArray class
(c) Container class
(d) Vector class
(e) DynamicArray class.

26. In JSP, the classes that allow primitive types to be


accessed as objects are known as

(a) Primitive classes


(b) Object classes
(c) Boxing classes
(d) UnBoxing classes
(e) Wrapped classes.

27. In JSP, a Canvas object provides access to a Graphics


object via one of its method called:

(a) getCanvas()
(b) getGraphics()
(c) paint()
(d) getPaint()
(e) accessGraphics().

28. In ASP the function which returns the current system


date is:

(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()

30. DOM stand for ___________


A. document object model

B. document object memory

C. document oriented memory

D. none of these

Answer:
A.document object model

31. ________ java script is also called server side java script
A. java script

B. object based scripting language

C. nevigator

D. live wire

Answer:
D.live wire

32. Increment operator, increases the value of variable


by what number?
A. 1

B. 2

C. 3
D. 4

Answer:
A.1

33. FUCTION is a block of statements that performs


certain task.
A. true

B. false

C. both a and b

D. none of these ..

Answer:
A.true

34. __________means the amount of data that can be sent


from one point to another in a certain period of time
A. bandwidth

B. html

C. href

D. none of these

Answer:
A.bandwidth

35. HTML color are specified using predefined color


names or ________ values.
A. rgb,

B. rgba

C. hsla

D. all of these
Answer:
D.all of these

36. HTML supports__________ standard color names.


A. 140

B. 3

C. 120

D. 7

Answer:
A.140

37. ____this tag is used to give paragraph


A. <p>

B. br

C. <pre>

D. <marquee>

Answer:
A. <p>

38. ________ tag is used to brake the line it is single tag


A. <p>

B. <br>

C. <pre>

D. <marquee>

Answer:
B.<br>

39. ________ is pre formatted tags it is used ,it show the


without formatted text .
A. <p>

B. br

C. <pre>

D. <marquee>

Answer:
C.<pre>

40. __________tag is used to create a scrolling effect to th


selected text
A. <p>

B. <br>

C. <pre>

D. <marquee>

Answer:
D.<marquee>

41. __________ element is used to indicated text quoted


from another scource..
A. <blockquote>

B. br

C. <pre>

D. <marquee>

Answer:
D.<marquee>

42. _______- it is used to show list by order wise .


A. <ol>

B. br
C. <pre>

D. <marquee>

Answer:
A.<ol>

43. _____________ it is used to show list by no particular


order wise .it show bulleted wise .
A. <ul>

B. br

C. <pre>

D. <marquee>

Answer:
A.<ul>

44. ________it is a comment , it is used to show additional


information in html.
A. <!—->

B. br

C. <pre>

D. <marquee>

Answer:
A.<!—->

45. _________ it is italic tag , it is used to show the italic


font.
A. <i>

B. br

C. <pre>
D. <marquee>

Answer:
A.<i>

46. _________ it is used to display a font in a bigger font size


.
A. <big>

B. br

C. <pre>

D. <marquee>

Answer:
A.<big>

47. _________ this definition tag is used to define the


concept .
A. <def>

B. br

C. <pre>

D. <marquee>

Answer:
A.<def>

48. ________citation tag is used to display a citation in html


document .
A. <cite>

B. br

C. <pre>

D. <marquee>
Answer:
A.<cite>

49. Tag is divided into 2 tags


A. physical

B. logical

C. center tag

D. a and b b both

Answer:
D.a and b b both

50. __________ this tag is used to make taxt to be aligned


cantered.
A. <p>

B. <center>

C. <pre>

D. <marquee>

Answer:
B.<center>

51. To link to the another web site following link is used<a


href=”https://www.lokmat.com/html/”>Visit our lokamat
paper </a
A. true

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

53. __________ of the table is used to specify the thickness of


the table .DNYANSAGAR ARTS AND COMMERCE COLLEGE,
BALEWADI,PUNE-45PROF. YOGESH P.DESHMUKH
www.dacc.edu.in
A. border

B. <center>

C. cell spacing

D. <marquee>

Answer:
A.border

54. _____tag is used to create the rows in a table


A. <tr>

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

58. __________ is used to manage the layout the page.


A. <tr>
B. colspan

C. <frame>

D. rowspan

Answer:
C.<frame>

59. In html __________ is used to divide the browser the screen


into 2 or more then onepart.
A. <tr>

B. columun

C. frame

D. rowspan

Answer:
C.frame

60. ______ tag is devide the tag horizontally or vertically .


A. <tr>

B. colspan

C. <frameset>

D. rowspan

Answer:
C.<frameset>

61. ___________stands for Transmission Control


Protocol/Internet Protocol
A. tcp/ip

B. ftp

C. physical
D. hyperlink

Answer:
A.tcp/ip

62. ________is a set of standardized rules that allow computers


to communicate on anetwork such as the internet.
A. tcp/ip

B. ftp

C. physical

D. hyperlink

Answer:
A.tcp/ip

63. The __________ is a standard network protocol used for the


transfer of computerfiles between a client and server on a
computer network
A. tcp/ip

B. ftp

C. physical

D. hyperlink

Answer:
B.ftp

64. The ____________element contains meta information about


the HTML page
A. <head>

B. ftp

C. physical

D. hyperlink
Answer:
A.<head>

65. The ________element defines the document’s body, and is a


container for allthe visible contents, such as headings,
paragraphs, images, hyperlinks, tables,lists, etc.
A. <head>

B. <body>

C. physical

D. hyperlink

Answer:
B.<body>

66. _______tag are used to indicate exactly how specific


characters are to be formatted
A. tcp/ip

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

68. _______it is used to To create a link to another documents


by using href attribute
A. <a>

B. checkbox

C. <textarea>

D. <text>

Answer:
A.<a>

69. __________accept only true or false we can select more then


one option out of givenoption
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>

72. _____________it is used to submit the button ( accept the


data) to upload
A. <submit>

B. checkbox

C. <textarea>

D. <text>

Answer:
A.<submit>

73. ____________ it is used with text , when we use to hide the


text matter
A. <password>

B. checkbox

C. <textarea>

D. <text>

Answer:
A.<password>

74. Which data type value is returned by all transcendental


math functions?
A. int
B. float

C. double

D. long

Answer:
C.double

75. Which of these coding types is used for data type


characters in Java?
A. ascii

B. iso-latin-1

C. unicode

D. none of the mentioned

Answer:
C.unicode

76. Which of these values can a boolean variable contain?


A. true & false

B. 0 & 1

C. any integer value

D. true

Answer:
A.true & false

77. Decrement operator, −−, decreases the value of variable


by what number?
A. 1

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.>>

79. What is the output of relational operators?


A. integer

B. boolean

C. characters

D. double

Answer:
B.boolean

80. . Which of these is returned by “greater than”, “less than”


and “equal to”operators?
A. integers

B. floating – point numbers

C. boolean

D. none of the mentioned

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

82. Which of the following is not a decision making


statement?
A. if

B. if-else

C. switch

D. do-while

Answer:
D.do-while

83. Which of the following is not a valid flow control


statement?
A. exit()

B. break

C. continue

D. return

Answer:
A.exit()

84. Which of these operators is used to allocate memory to


array variable in Javascript?
A. malloc

B. alloc

C. new

D. new malloc

Answer:
C.new

85. Which of these is an incorrect array declaration?


A. int x[] = new int[5]

B. int [] arr = new int[5]

C. intarr[] = new int[5]

D. int x[] = int [5] new

Answer:
D.int x[] = int [5] new

86. Which of these selection statements test only for equality?


A. if

B. switch

C. if & switch

D. none of the mentioned

Answer:
A.if

87. The CSS background properties are used to define the


___________effects.
A. background

B. customize
C. class

D. id rule

Answer:
A.background

88. CSS border properties allow us to__________ the borders.


A. background

B. customize

C. class

D. id rule

Answer:
B.customize

89. By applying an_______ a style can be applied to just a single


tag.
A. background

B. customize

C. class

D. id rule

Answer:
D.id rule

90. _________selectors are used to specify a group of elements.


A. background

B. customize

C. class

D. id rule
Answer:
C.class

91. In CSS, “font-size” can be called as ________


A. property name

B. selector

C. declaration

D. text color

Answer:
A.property name

92. In CSS, h1 can be called as _______


A. property name

B. selector

C. declaration

D. text color

Answer:
B.selector

93. In , CSS “color:red” can be called as _____________


A. property name

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>

95. _______ describes how HTML elements are to be displayed


on screen, paper, or inother media
A. css

B. html

C. <textarea>

D. <text>

Answer:
A.css

96. Websites are uploaded _______


A. address

B. serve

C. cache

D. client

Answer:
B.serve

97. HTML web pages can be read and rendered by __________


A. web browser

B. server
C. empty

D. head tag

Answer:
A.web browser

98. <INPUT> is ________tag.


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

100. The body tag usually used after _________


A. web browser

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

103. The <strike> tag is used to _________the text or sentence.


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

105. _________ is used to give additional information.


A. title tag

B. paired tag

C. strikeout

D. deleted

Answer:
A.title tag
Function and String in PHP

106. What is the range of short data type in Java script ?


A. -128 to 127

B. -32768 to 32767

C. -2147483648 to 2147483647

D. none of the mentioned

Answer:
B.-32768 to 32767

107. What is the range of byte data type in Java script?


A. -128 to 127
B. -32768 to 32767

C. -2147483648 to 2147483647

D. none of the mentioned

Answer:
A.-128 to 127

108. An expression involving byte, int, and literal numbers is


promoted towhich of these?
A. int

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

D. none of the mentioned

Answer:
C.unicode

111. Which one is a valid declaration of a Boolean?


A. boolean b1 = 1;

B. boolean b2 = ‘false’;

C. boolean b3 = false;

D. boolean b4 = ‘true’

Answer:
C.boolean b3 = false;

112. Which of these operators is used to allocate memory to


array variable inJava script?
A. malloc

B. alloc

C. new

D. new malloc

Answer:
C.new

113. Which of these is an incorrect array declaration?


A. intarr[] = new int[5]

B. int [] arr = new int[5]

C. intarr[] = new int[5]

D. intarr[] = int [5] new


Answer:
D.intarr[] = int [5] new

114. Which of these is necessary to specify at time of array


initialization?
A. row

B. column

C. both row and column

D. none of the mentioned

Answer:
A.row

115. Which of the following can be operands of arithmetic


operators?
A. numeric

B. boolean

C. characters

D. both numeric & characters

Answer:
D.both numeric & characters

116. Modulus operator, %, can be applied to which of these?


A. integers

B. floating – point numbers

C. both integers and floating – point numbers

D. none of the mentioned

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.~

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

119. Which of these operators can skip evaluating right hand


operand?
A. !

B. none of the mentioned

C. &

D. &&

Answer:
D.&&

120. Which of these have highest precedence?


A. ()
B. ++

C. *

D. >>

Answer:
A.()

121. Which of these statements are incorrect?


A. equal to operator has least precedence

B. brackets () have highest precedence

C. division operator, /, has higher precedence than


multiplication operator

D. addition operator, +, and subtraction operator have equal


precedence

Answer:
D.addition operator, +, and subtraction operator have equal
precedence

122. Which of these selection statements test only for


equality?
A. if

B. switch

C. if & switch

D. none of the mentioned

Answer:
B.switch

123. Which of these are selection statements in Java script?


A. if()

B. for()
C. continue

D. break

Answer:
A.if()

124. Which of the following is not a valid jump statement?


A. break

B. goto

C. continue

D. return

Answer:
D.return

125. _______is the measured as the amount of data that can be


transferred from onepoint to another point within a specific
amount of time.
A. http

B. bandwidth

C. webpage

D. dream viewer

Answer:
B.bandwidth

126. A ___________ is a document, typically written in plain


text distributed withformatting instruction of Hypertext
markup languages like HTML,XHTML
A. http

B. bandwidth

C. webpage
D. dream viewer

Answer:
C.webpage

127. ___________ Stands for Hypertext markup languages for


displaying webpages and other information that can be
displayed in a web browser
A. http

B. bandwidth

C. webpage

D. dream viewer

Answer:
A.http

128. Cost of buying and running a server for client serve


model are high .
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:

B. internal or embedded css

C. external css:

D. none of these.
Answer:
D.none of these.

130. The _______ tag provides no visual change by itself, but


when it is marked, you canstyle it with CSS, or manipulate it
with JavaScript.
A. <map>

B. <span>

C. <img>

D. <tt>

Answer:
B.<span>

131. The _________ tag defines an image in an HTML page.


A. <map>

B. <span>

C. <img>

D. <tt>

Answer:
A.<map>

132. The ____________tag has two required attributes: src and


alt.
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>

134. _________tag Indicates that the text should be used with a


font such as Courier thatallots the same width to each
character.
A. <map>

B. <span>

C. <img>

D. <tt>

Answer:
D.<tt>

135. _____________ tag Indicates that the text should be


displayed in a small font.Available in HTML 3.0 or higher.
A. <small>

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>

137. ___________Indicates that characters should be


emphasized in some way. Usuallydisplayed in italics.
A. <small>

B. <em>

C. <u>

D. <strong >

Answer:
B.<em>

138. _________Emphasizes characters more strongly than


<EM>. Usually displayed in a boldfont
A. <small>

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 >

140. ________Indicates a variable. Often displayed in italics or


underlined.
A. <var>

B. <em>

C. <kbd >

D. <strong >

Answer:
A.<var>

141. _________Indicates short quotes or citations. Often italized


by browsers.
A. <small>

B. <cite>

C. <kbd >

D. <strong >

Answer:
B.<cite>

142. The ________ele1ment defines a table row, the <th>


element defines a table header,and the <td> element defines a
table cell.
A. <small>

B. <tr>

C. <kbd >

D. <strong >

Answer:
B.<tr>

143. The _______ tag is used to create in an HTML table.


A. <table>

B. <tr>

C. <td >

D. <th >

Answer:
A.<table>

144. CSS stands for ___________


A. cascading style sheets

B. cascading super sheets

C. cascading style excel sheet

D. none of these

Answer:
A.cascading style sheets

145. _________means the way to move from one page to


another page in website.To move from one page to another
pages hyperlinks are used.
A. http
B. bandwidth

C. navigation

D. dream viewer

Answer:
C.navigation

146. __________ is Web development software . Create, code


and manage dynamicwebsites easily with a smart, simplified
coding engine
A. http

B. bandwidth

C. webpage

D. dream viewer

Answer:
D.dream viewer

147. ________ is a server scripting language, and a powerful


tool for making dynamicand interactive Web pages.
A. php

B. java script

C. angular js

D. none of these

Answer:
A.php

148. _______ is a object oriented programming language , it is


used to create theobject…
A. php

B. java script
C. angular js

D. none of these

Answer:
A.php

149. A ________ script can be placed anywhere in the


document.
A. php

B. java script c

C. angular js

D. none of these

Answer:
A.php

150. The default file extension for PHP files is _________


A. .php

B. .js

C. .ajs

D. none of these

Answer:
A..php

151. __________ is used to show the out put …or give


message..same as printf in clanguage…
A. echo

B. java script

C. angular js

D. none of these
Answer:
A.echo

152. PHP supports a ___________ range of databases


A. wide

B. small

C. short

D. none of these

Answer:
A.wide

153. PHP supports the following data types:


A. string

B. integer

C. float (floating point numbers – also called double)

D. all of the above .

Answer:
D.all of the above .

154. In PHP, an object must be_________declared.


A. explicitly

B. implicitly

C. both a and b

D. none of these

Answer:
A.explicitly

155. PHP divides the operators in the following groups:


A. increment/decrement operators
B. logical operators

C. string operators

D. all of the above

Answer:
D.all of the above

156. The basic assignment operator in PHP is __________ It


means that the left operandgets set to the value of the
assignment expression on the right.
A. =

B. ++

C. ==

D. ?

Answer:
A.=

157. the _________ statement is used to perform different


actions based on differentconditions
A. switch

B. if condition

C. foreach

D. while

Answer:
A.switch

158. In PHP, we have the following loop types:


A. while loop

B. for loop
C. foreach

D. all the these.

Answer:
D.all the these.

159. In php, A ___________ is a block of statements that can be


used repeatedly in aprogram.
A. function

B. procedure

C. block

D. loop

Answer:
A.function

Web Technologies Objective Questions with Answers Quiz


Test Pdf Download

---- >> Related Posts Of Above Questions :::

------>>[MOST IMPORTANT]<<------

1. 250+ TOP MCQs on Embedding JavaScript in HTML


and Answers
2. 15 Days Learn Execute ExtJS Online
3. 15 Days Learn What is the JavaScript Object()
Constructor?
4. 250+ TOP MCQs on Script Loading and Answers
5. 250+ TOP MCQs on FTP & HTTP and Answers
6. 250+ TOP MCQs on HTML DOM and Answers
7. 250+ TOP MCQs on Client-Side JavaScript and
Answers
8. 300+ TOP Ui Developer Interview Questions and
Answers
9. 250+ TOP MCQs on Web Browsers and Answers
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 2 Develop Java programs for window/web-based applications

CO 3 Design web pages using HTML, XML, CSS and JavaScript.

CO 4 Creation of client-server environment using socket programming

CO 5 Building enterprise level applications and manipulate web databases using JDBC

CO 6 Design interactive web applications using Servlets and JSP


DETAILED SYLLABUS

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

Enterprise Java Bean: Preparing a Class to be a JavaBeans, Creating a JavaBeans, JavaBeans


Properties, Types of beans, Stateful Session bean, Stateless Session bean, Entity bean Java
IV Database Connectivity (JDBC): Merging Data from Multiple Tables: Joining, Manipulating,
Databases with JDBC, Prepared Statements, Transaction Processing, Stored Procedures

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

1. Unit-I : Introduction ………………………...………………………………….….3

2. Unit-II : Web Page Designing ………………………………….…………...…….23

3. Unit-III : Scripting & Introduction to Networking …………………..….....…... 31

4. Unit-IV: Enterprise Java Bean & Database Connectivity (JDBC): ………..….45

5. Unit-V: Servlets & Java Server Pages (JSP)………………….....................…….52

2 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


1. Unit-I

1. What is a web browser? a. HTTP runs over TCP


a. A program that can display a web b. HTTP allows information to be stored
page in a URL
b. A program used to view html c. Both
documents d. None
c. Both 6. --------- is making the Web standards?
d. None a. Mozilla
2. Which of the following statements are true: b. Microsoft
a. A webapp is a software that lets you c. The World Wide Web Consortium
access websites d. ALL
b. A webapp is defined as a software that 7. _________ is a directory for storing
can be downloaded from the web information about web services.
c. A webapp is a tool which helps us a. HTTP
build websites b. SOAP
d. A webapp is a software we can use c. UDDI
in a web browser d. CGI
3. Which of the following statements is NOT 8. Applets are written in _______
a definition of a web server: programming language.
a. A network component that helps route a. Java
requests from clients to servers b. C++
b. A software for users to browse the c. C
internet d. C#
c. A computer with access to the web
d. All of above 9. The "home page" of a web site is …………….
4. Telnet is a ______ based computer a. the largest page
protocol. b. the last page
a. Text c. the first page
b. Image d. the most colorful page
c. Animation
d. Sound 10. HTTP defines two ways in which values
5. Which of the following statements are true? entered by a user at the browser can be sent
3 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

d. Any website from a computer or a program to another


30. Who invented WWW? computer or a program
a. Tim Berners-Lee a. Internet Protocol
b. Thomas Alva Edison b. HTTP
c. Albert Einstein c. TCP
d. Isaac Newton d. UDP
36. The following identifies one of the
31. The following technology lets us to make networks that is part of Internet
voice calls using Internet a. Device ID
a. VoIP b. Net ID
b. FTP c. Both Device ID and Net ID
c. TELNET d. Socke
d. TCP
32. The Client Computer is also called 37. The following identifies the location of
a. Front End source and the destination on Internet
b. Back End a. Internet Protocol
c. Operating System b. HTTP
c. TCP
33. In Client Server model, the following d. UDP
initiates the request 38. The following is a valid IP address
a. Server a. 192.168.1.97
b. Client b. 300.4000.0.1
c. Network on which both are present c. 192.168.1.970
d. Both Client and Server d. 1.2.3.4123
e. 39. The following translates a website address
34. The following is a Web Server software such as http://www.phdtalks.org into a
a. Microsoft Internet Information computer
Server a. understandable IP address
b. Windows 7 operating system b. iTranslate Google Translator
c. Java Beans c. Microsoft SQL Server
d. C# d. Domain Name System
40. An IPv4 address is a
35. The following protocol primarily provides a. 16 bit address
the reliable delivery of stream of bytes b. 32 bit address
c. 128 bit address

6 University Academy
WEB TECHNOLOGY 2020-21

d. 256 bit address c. Web conferencing


d. Mobile conferencing

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

b. Memory used by the object with no


61. Which of these is returned by operator '&' ? reference is automatically
a. Integer reclaimed.
b. Character c. The JVM cleans output of Java
c. Boolean program with error.
d. Float d. Any unused package in a program
automatically gets deleted.
62. Data type long literals are appended by
_____ 66. Which one is a template for creating
a. Uppercase L different objects ?
b. Lowercase L a. An Array
c. Long b. A class
d. Both A and B c. Interface
d. Method
63. Which variables are created when an object
is created with the use of the keyword 'new' 67. Which symbol is used to contain the values
and destroyed when the object is of automatically initialized arrays?
destroyed? a. Brackets
a. Local variables b. Braces
b. Instance variables c. Parentheses
c. Class Variables d. Comma
d. Static variables
64. Java language was initially called as 68. Which one is true about a constructor ?
________ a. A constructor must have the same
a. Sumatra name as the class it is declared within.
b. J++ b. A constructor is used to create objects.
c. Oak c. A constructor may be declared private
d. Pine d. All of the above

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

83. Find the correct option of following


statement about "final" keyword(in JAVA)
a. "final" keyword with variable: to
make variable constant
a. Compiler Error
b. "final" keyword with method: to
b. 30
avoid overriding of that method
c. 10
c. "final" keyword with class: to
d. -10
avoid inheritance of that class
80. Output of the following TWO statements d. All of Above
(placed inside main method):
System.out.println(10 + 20 +
84. Find the correct option of following
"CSE-A");
statement about "abstract" keyword(in
System.out.println("& CSE-B" +
JAVA)
10 + 20);
a. "abstract" keyword can be used
with method and class
a. 1020CSE-A & CSE-B30
b. Object cannot be created of an
b. 30CSE-A & CSE-B30
"abstract" class
c. 30CSE-A & CSE-B1020
c. Both
d. 1020CSE-A & CSE-B1020
d. None
81. What allows the programmer to destroy an
object x (in JAVA)?
85. Which Java-Exception is invalid (not
a. x.finalize()
defined)?
b. x.delete()
a. ArithmeticDivideException
c. Only the garbage collection
b. IndexOutOfBoundsException
system can destroy an object
c. IOException
d. Runtime.getRuntime().gc()
d. AWTException
86. Which keyword does not belongs to Java-
82. Where an "object" of a class(in JAVA) get Exception?
stored? a. catch
a. Heap b. finally

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

a. Statement-I & Statement-II are true


91. Thread priority in Java is?
& Statement-III is false
a. Integer
b. All are true
b. Float
c. All are false
c. double
d. None(choice not provided)
d. long

88. Which function of pre-defined class


92. In java multi-threading, a thread can be
"Thread" is used to check weather current
created by
thread is still running?
a. Extending Thread class
a. isAlive()
b. Implementing Runnable interface
b. join()
c. Using both
c. isRunning()
d. None
d. alive()

93. Which method must be implemented by a


89. What is multithreaded programming?
Java thread?
a. It’s a process in which two or more
a. run()
parts of same process run
b. execute()
simultaneously.
c. start()
b. It’s a process in which two different
d. None
processes run simultaneously.
c. Its a process in which many different
process are able to access same 94. What is maximum thread priority in Java?
information. a. 10
d. Its a process in which a single b. 5
process can access information from c. 12
many sources. d. 8

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;

99. True statements about extending a


class/interface in java are 103. Output of following JAVA program

13 University Academy
WEB TECHNOLOGY 2020-21

107. In Graphics class which method is


used to draws a rectangle with the specified
width and height?
a. public void drawRect(int x, int y, int
width, int height)
a. 2 b. public abstract void fillRect(int x, int
b. compilation error at y, int width, int height)
"System.out.println(b)" c. public abstract void drawLine(int x1,
c. compilation error at "byte a=1" int y1, int x2, int y2)
d. compilation error at "byte b=a+1" d. public abstract void drawOval(int x,
int y, int width, int height)
104. Which is the container that doesn't
contain title bar and MenuBars but it can
108. Name the class used to represent a
have other components like button,
GUI application window, which is
textfield etc?
optionally resizable and can have a title bar,
a. Window
an icon, and menus.
b. Frame
a. Window
c. Panel
b. Panel
d. Container
c. Dialog
d. Frame
105. The Swing Component classes that are
109. To use the ActionListener interface it
used in Encapsulates a mutually exclusive
must be implemented by a class there are
set of buttons?
several ways to do that find in the
a. AbstractButton
following?
b. ButtonGroup
a. Creating a new class
c. JButton
b. Using the class the graphical
d. ImageIcon
component
106. Which package provides many event
c. An anonymous inner class
classes and Listener interfaces for event
d. All mentioned above
handling?
a. java.awt
110. hich is a component in AWT that can
b. java.awt.Graphics
contain another component like buttons,
c. java.awt.event
text fields, labels etc.?
d. None of the above
a. Window
b. Container

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

128. What will be the output of the a. final


following Java code? b. last
class area c. constant
{ d. static
int width;
int length;
131. What will be the output of the
int area;
following Java program?
void area(int width, int length)
class Output
{
{
this.width = width;
public static void main(String args[])
this.length = length;
{
}
int a1[] = new int[10];
}
int a2[] = {1, 2, 3, 4, 5};
class Output
System.out.println(a1.length + " " +
{
a2.length);
public static void main(String args[])
}
{
}
area obj = new area();
a. 10 5
obj.area(5 , 6);
b. 5 10
System.out.println(obj.length + " " +
c. 0 10
obj.width);
d. 0 5
} }
132. Which of these is correct way of
a) 0 0
inheriting class A by class B?
b) 5 6
a. class B + class A {}
c) 6 5
b. class B inherits class A {}
d) 5 5
c. class B extends A {}
d. class B extends class A {}
129. Arrays in Java are implemented as?
a. class
133. Which two classes use the Shape class
b. object
correctly?
c. variable
A. public class Circle implements Shape
d. none of the mentioned
{
130. Which of these keywords is used to
private int radius;
prevent content of a variable from being
}
modified?

18 University Academy
WEB TECHNOLOGY 2020-21

B. public abstract class Circle extends c. C,E


Shape d. T,H
{ 134. What will be the output of the
private int radius; following Java program?
} class A
C. public class Circle extends Shape {
{ int i;
private int radius; }
public void draw(); class B extends A
} {
D. public abstract class Circle int j;
implements Shape void display()
{ {
private int radius; super.i = j + 1;
public void draw(); System.out.println(j + " " + i);
} }
E. public class Circle extends Shape }
{ class inheritance
private int radius; {
public void draw() public static void main(String args[])
{ {
/* code here */ B obj = new B();
} obj.i=1;
} obj.j=2;
F. public abstract class Circle obj.display();
implements Shape }
{ }
private int radius; a) 2 2
public void draw() b) 3 3
{ c) 2 3
/* code here */ d) 3 2
}
} 135. What is not type of inheritance?
a. B,E a. Single inheritance
b. A,C b. Double inheritance

19 University Academy
WEB TECHNOLOGY 2020-21

c. Hierarchical inheritance a. String objects are immutable, they


d. Multiple inheritance cannot be changed
b. String object can point to some other
136. Using which of the following, multiple reference of String variable
inheritance in Java can be implemented? c. StringBuffer class is used to store
a. Interfaces string in a buffer for later use
b. Multithreading d. None of the mentioned
c. Protected methods
d. Private methods 141. What will be the output of the
following Java program?
137. All classes in Java are inherited from
which class? class String_demo
a. java.lang.class {
b. java.class.inherited public static void main(String args[])
c. java.class.object {
d. java.lang.Object int ascii[] = { 65, 66, 67, 68};
String s = new String(ascii, 1, 3);
138. In order to restrict a variable of a class System.out.println(s);
from inheriting to subclass, how variable }
should be declared? }
a. Protected a. ABC
b. Private b. BCD
c. Public c. CDA
d. Static d. ABCD
142. What will be the output of the
139. If super class and subclass have same following Java program?
variable name, which keyword should be class String_demo
used to use super class? {
a. super public static void main(String args[])
b. this {
c. upper char chars[] = {'a', 'b', 'c'};
d. classname String s = new String(chars);
140. Which of these is an incorrect String s1 = "abcd";
statement? int len1 = s1.length();
int len2 = s.length();

20 University Academy
WEB TECHNOLOGY 2020-21

System.out.println(len1 + " " + len2); b. Generics make code more


} optimised and readable
} c. Generics add stability to your
a. 3 0 code by making more of your
b. 0 3 bugs detectable at compile time
c. 3 4 d. Generics add stability to your code
d. 4 3 by making more of your bugs
detectable at runtime
148. Which of the following is not a Java
143. Which of these functions is called to
features?
display the output of an applet?
a. Dynamic
a. display()
b. Architecture Neutral
b. paint()
c. Use of pointers
c. displayApplet()
d. Object-oriented
d. PrintApplet()
149. What should be the execution order, if
144. Which of these methods can be used
a class has a method, static block, instance
to output a string in an applet?
block, and constructor, as shown below?
a. display()
public class First_C {
b. print()
public void myMethod()
c. drawString()
{
d. transient()
System.out.println("Method");
145. Which of these packages contains all
}
the classes and methods required for even
handling in Java?
{
a. java.applet
System.out.println(" Instance Block");
b. java.awt
}
c. java.event
d. java.awt.event
public void First_C()
146. Which of these methods are used to
{
register a mouse motion listener?
System.out.println("Constructor ");
a. addMouse()
}
b. addMouseListener()
static {
c. addMouseMotionListner()
System.out.println("static block");
d. eventMouseMotionListener()
}
147. Why are generics used?
public static void main(String[] args) {
a. Generics make code more fast

21 University Academy
WEB TECHNOLOGY 2020-21

First_C c = new First_C();


c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block,
and constructor
b. Method, constructor, instance block,
and static block
c. Static block, method, instance block,
and constructor
d. Static block, instance block,
constructor, and method
150. Evaluate the following Java
expression, if x=3, y=5, and z=10:
++z + y - y + z + x++
a. 24
b. 23
c. 20
d. 25

22 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-II
a. HyperText Markup Language
1. HTML is what type of language ? b. Hyper Teach Markup Language
a. Scripting Language c. Hyper Tech Markup Language
b. Markup Language d. None of these
c. Programming Language 7. Who is Known as the father of World Wide
d. Network Protocol Web (WWW)?
2. HTML uses a. Robert Cailliau
a. User defined tags b. Tim Thompson
b. Pre-specified tags c. Charles Darwin
c. Fixed tags defined by the language d. Tim Berners-Lee
d. Tags only for linking
8. What should be the first tag in any HTML
3. The year in which HTML was first document?
proposed _______. a. <head>
a. 1990 b. <title>
b. 1980 c. <html>
c. 2000 d. <document>
d. 1995 9. How can you make a bulleted list with
4. Fundamental HTML Block is known as numbers?
___________. a. <dl>
a. HTML Body b. <ol>
b. HTML Tag c. <list>
c. HTML Attribute d. <ul>
d. HTML Element
5. Apart from <b> tag, what other tag makes 10. What tag is used to display a picture in a
text bold ? HTML page?
a. <fat> a. Picture
b. <strong> b. image
c. <black> c. img
d. <emp> d. src
11. HTML web pages can be read and rendered
6. What is the full form of HTML? by _________.

23 University Academy
WEB TECHNOLOGY 2020-21

a. Compiler indicate where the interpreter is


b. Server located
c. Web Browser c. The path to the interpreter of the
d. Interpreter
script file is invalid
12. Which HTML tag produces the biggest
d. The requested HTML file or CGI
heading?
script has insufficient permission
a. <h7>
b. <h9> 16. Which attribute is used to name an element
c. <h4> uniquely?
d. <h1>
a. Class
13. Tags and texts that are not directly b. dot

displayed on the page are written in _____ c. id


section. d. all of above
<head>
17. The correct sequence of HTML tags for
<title>
starting a webpage is -
<body>
a. Head, Title, HTML, body
<html>
b. HTML, Body, Title, Head

14. Markup tags tell the web browser c. HTML, Head, Title, Body

a. How to organize the page d. HTML, Head, Title, Body

b. How to display the page


c. How to display message box on page 18. How to create an unordered list (a list with
the list items in bullets) in HTML?
d. None of these
a. <ul>
15. When trying to access a URL, the
b. <ol>
following message is displayed on the
c. <li>
browser: Server Error 403, What could be
d. <i>
the reason for the message?

a. The requested HTML file is not 19. How to insert an image in HTML?

available a. <img href = "jtp.png" />

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

20. Which of the following tag is used to define d. <link rel="stylesheet"


options in a drop-down selection list? type="text/css"
a. <select> href="example.css">
b. <list>
25. The property in CSS used to change the
c. <option>
background color of an element is -
d. <dropdown>
a. bgcolor
21. Which of the following tag is used to add
b. color
rows in the table?
c. background-color

a. <td> and </td> d. All of the above

b. <th> and </th>


c. <tr> and </tr> 26. The CSS property used to control the
d. None of the above element's font-size is -

22. What are the types of unordered or bulleted a. text-style

list in HTML? b. text-size


c. font-size
a. disc, square, triangle d. None of the above
b. polygon, triangle, circle
27. Which of the following is the correct
c. disc, circle, square
syntax to make the background-color of all
d. All of the above
paragraph elements to yellow?
23. The CSS property used to specify the
transparency of an element is - a. p {background-color : yellow;}
b. p {background-color : #yellow;}
a. Hover c. all {background-color : yellow;}
b. opacity d. all p {background-color :
c. clearfix #yellow;}
d. overlay
28. Which of the following is the correct
24. Which of the following is the correct syntax to display the hyperlinks without
syntax for referring the external style sheet? any underline?
a. <style src = example.css>
a. a {text-decoration : underline;}
b. <style src = "example.css" >
b. a {decoration : no-underline;}
c. <stylesheet> example.css
c. a {text-decoration : none;}
</stylesheet>

25 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above a. <html>


b. <head>
c. <title>
29. Which of the following property is used as
d. <body>
the shorthand property for the padding
34. Which tag inserts a line horizontally on
properties?
your web page?
a. padding-left
a. <hr>
b. padding-right
b. <line>
c. padding
c. <line direction="horizontal">
d. All of the above
d. <tr>
35. Which tag allows you to add a row in a
30. The CSS property used to specify the table?
transparency of an element is - a. <td> and </td>
a. opacity b. <cr> and </cr>
b. filter c. <th> and </th>
c. visibility d. <tr> and </tr>
d. overlay 36. How can you make a bulleted list?
a. <list>
b. <nl>
31. Which of the following is used to specify
c. <ul>
the subscript of text using CSS?
d. <ol>
a. vertical-align: sub
37. How can you make a numbered list?
b. vertical-align: super
a. <dl>
c. vertical-align: subscript
b. <ol>
d. None of the above
c. <list>
d. <ul>
32. Which of the following is the correct 38. How can you make an e-mail link?
syntax to select all paragraph elements in a a. <a href=”xxx@yyy ”>
div element? b. <mail href=”xxx@yyy ”>
a. div p c. <mail>xxx@yyy </mail>
b. p d. <a href=”mailto:xxx@yyy ”>
c. div#p 39. Choose the correct HTML tag to make a
d. div ~ p text italic
a. <ii>
33. Tags and text that are not directly displayed b. <italics>
on the page are written in _____ section.
26 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

52. In HTML document the tags c. vlink="green"


a. Should be written in upper case d. None of above
b. should be written in lower case 58. How can you make an e-mail link?
c. should be written in propercase a. <a href="xxx@yyy ">
d. can be written in both uppercase or b. <mail href="xxx@yyy ">
lowercase c. <mail>xxx@yyy </mail>
53. The way the browser displays the object d. <a href="mailto:xxx@yyy ">
can be modified by _____ 59. Which tag creates a check box for a form in
a. attributes HTML?
b. parameters a. <checkbox>
c. modifiers b. <input type="checkbox">
d. None of above c. <input=checkbox>
54. Which of the following HTML code is d. <input checkbox>
valid? 60. Which of the following is an attribute of
a. <font colour="red"> <Table> tag?
b. <font color="red"> a. SRC
c. <red><font> b. LINK
d. All of above are style tags c. CELLPADDING
55. Which of the following is not a valid d. BOLD
alignment attribute? 61. What is the correct way of describing XML
a. Left data?
b. Right a. XML uses a DTD to describe data
c. Top b. XML uses a description node to describe
d. All of above data
56. Which attribute is used withimg tag to c. XML uses XSL to describe the data
display the text if image could not load in d. XML uses a validator to describe the
browser? data
a. description 62. Comments in XML document is given by:
b. name a. <?-- _ _-->
c. alt b. <!_ _ _ _!>
d. id c. <!_ _ _ _>
57. Which attribute can be used with BODY d. </_ _ _ _>
tag to set background color green? 63. Which statement is true?
a. background="green" a. An XML document can have one root
b. bgcolor="green" element

28 University Academy
WEB TECHNOLOGY 2020-21

b. An XML document can have one child b. it contain an element


element c. it contains one or more elements
c. XML elements have to be in lowercase d. must contain one or more elements
d. All of the above and root element must contain all
64. What does XML stand for? other elements

a. eXtra Modern Link 69. There is a way of describing XML data,


b. eXtensible Markup Language how?
c. Example Markup Language
d. X-Markup Language a. XML uses a DTD to describe the data
b. XML uses XSL to describe data
65. What is the correct syntax of the c. XML uses a description node to
declaration which defines the XML describe data
version?: d. Both A and C

a. <xml version="A.0" /> 70. What does DTD stand for?


b. <?xml version="A.0"?>
c. <?xml version="A.0" /> a. Direct Type Definition

d. None of the above b. Document Type Definition


c. Do The Dance
66. Which statement is true? d. Dynamic Type Definition

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

73. DHTML is the combination of a. Document object Manipulation


b. Document object mail
a. XML and XHTML c. Document object mean
b. HTML and JavaScript d. Document object Method
c. XHTML and HTML
d. HTML and CSS 79. JavaScript allows you to write code to
control all
74. DHTML enable a web page to be
a. XML elements
a. more interactive b. HTML Elements
b. Server interactive c. XHTML Elements
c. Client interactive d. CSS elements
d. Dynamic
80. DHTML is not a
75. "Dynamic" is defined as the ability of the
browser to a. Microsoft standard
b. Sun standard
a. alter a web page's look and style c. W3C standard
after the document has loaded d. Oracle standard
b. interact with the client
c. interact with user 81. How to access an element in HTML DOM
d. interact with the web pages ?

76. Which of these are not layer attributes ? a. document.getElementById


b. document.write
a. id c. Response.write
b. left d. Request.write
c. align
d. width

77. DHTML stands for:

a. Distributed HTML
b. Dynamic HTML
c. Distinct HTML
d. None of these

78. DOM stands for:

30 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-III
1. Which type of JavaScript language is _ c. both conditional block and a single
statement
a. Object-Oriented
d. block that contains a single
b. Object-Based
statement
c. Assembly-language
5. The "function" and " var" are known as:
d. High-level
2. Which one of the following also known
a. Keywords
as Conditional Expression?
b. Data types
c. Declaration statements
a. Alternative to if-else
d. Prototypes
b. Switch statement
c. If-then-else statement 6. In the following given syntax of the
d. immediate if switch statement, the Expression is
compared with the labels using which
3. Among the following given JavaScript
one of the following operators?
snipped codes, which is more efficient:

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-

as hexadecimal literal beginning? side JavaScript.

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

b. Missing of semicolons c. LiveWire


d. Native
c. Division by zero
d. Missing of Bracket
15. What are variables used for in
11. Why so JavaScript and Java have JavaScript Programs?
similar name?
a. Storing numbers, dates, or other
a. JavaScript is a stripped-down version values
of Java b. Varying randomly
b. JavaScript's syntax is loosely c. Causing high-school algebra
based on Java's flashbacks
c. They both originated on the island of d. None of the above
Java
d. None of the above

32 University Academy
WEB TECHNOLOGY 2020-21

16. _____ JavaScript statements embedded


in an HTML page can respond to user 20. Which of the following is not a valid
events such as mouse-clicks, form JavaScript variable name?
input, and page navigation.
a. 2names
a. Client-side b. _first_and_last_names
b. Server-side c. FirstAndLast
c. Local d. None of the above
d. Native
21. ______ tag is an extension to HTML
17. What should appear at the very end of that can enclose any number of
your JavaScript? JavaScript statements.

The <script LANGUAGE="JavaScript">tag a. <SCRIPT>


a. The </script> b. <BODY>
b. The <script> c. <HEAD>
c. The END statement
d. <TITLE>
d. None of the above
22. How does JavaScript store dates in a
18. Which of the following can't be done date object?
with client-side JavaScript?
a. The number of milliseconds
a. Validating a form since January 1st, 1970
b. Sending a form's contents by email
b. The number of days since January
c. Storing the form's contents to a
1st, 1900
database file on the server
c. The number of seconds since
d. None of the above
Netscape's public stock offering.
d. None of the above
19. Which of the following are capabilities
of functions in JavaScript?
23. Which of the following attribute can

a. Return a value
hold the JavaScript version?

b. Accept parameters and Return a


a. LANGUAGE
value
b. SCRIPT
c. Accept parameters
d. None of the above c. VERSION
33 University Academy
WEB TECHNOLOGY 2020-21

d. None of the above c. <script src=" abc.js">


d. None of the above
24. What is the correct JavaScript syntax to
write "Hello World"? 28. Which types of image maps can be
used with JavaScript?
a. System.out.println("Hello World")
b. println ("Hello World") a. Server-side image maps
c. document.write("Hello World") b. Client-side image maps
d. response.write("Hello World") c. Server-side image maps and Client-
side image maps
25. Which of the following way can be d. None of the above
used to indicate the LANGUAGE 29. Which of the following navigator object
attribute? properties is the same in both
Netscape and IE?
a. <LANGUAGE="JavaScriptVersion">
b. <SCRIPT a. navigator.appCodeName
LANGUAGE="JavaScriptVersion"> b. navigator.appName
c. <SCRIPT c. navigator.appVersion
LANGUAGE="JavaScriptVersion"> d. None of the above
JavaScript statements…</SCRIPT>
d. <SCRIPT 30. Which is the correct way to write a
LANGUAGE="JavaScriptVersion"!> JavaScript array?
JavaScript statements…</SCRIPT>
26. Inside which HTML element do we put a. var txt = new
the JavaScript? Array(1:"tim",2:"kim",3:"jim")
b. var txt = new
a. <js> Array:1=("tim")2=("kim")3=("jim")
b. <scripting> c. var txt = new
c. <script> Array("tim","kim","jim")
d. <javascript> d. var txt = new Array="tim","kim","jim"

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

b. Prevents scripts on the page from d. Date


executing. 36. Choose the client-side JavaScript
c. Describes certain low-budget movies. object?
d. None of the above
32. If para1 is the DOM object for a a. Database

paragraph, what is the correct syntax to b. Cursor


c. Client
change the text within the paragraph?
d. FileUpLoad
a. "New Text"? 37. Which of the following is not
b. para1.value="New Text"; considered a JavaScript operator?
c. para1.firstChild.nodeValue= "New
Text"; a. new

d. para1.nodeValue="New Text"; b. this

33. JavaScript entities start with _______ c. delete


d. typeof
and end with _________.
38. ______method evaluates a string of
a. Semicolon, colon JavaScript code in the context of the
b. Semicolon, Ampersand specified object.
c. Ampersand, colon
d. Ampersand, semicolon a. Eval
34. Which of the following best describes b. ParseInt

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

a. ScriptObject erts ", false);

b. JSObject c. user_pref("javascript.console.open_o

c. JavaObject n_error ", true);

d. Jobject d. user_pref("javascript.console.open_o

52. _______ class provides an interface for n_error ", false);

invoking JavaScript methods and 56. The syntax of a blur method in a button

examining JavaScript properties. object is ______________

a. ScriptObject a. Blur()

b. JSObject b. Blur(contrast)
c. Blur(value)
37 University Academy
WEB TECHNOLOGY 2020-21

d. Blur(depth) a. Returns the VALUE of a selected


OPTION.
57. The syntax of close method for b. Returns document.URL of the window
document object is ______________ in focus.
c. Returns the value of cursor-selected
a. Close(doC. text
b. Close(object) d. Returns the VALUE of a checked
c. Close(val) radio input.
d. Close() 62. Choose the client-side JavaScript
object:
58. <script type="text/javascript">
a. Database
x=4+"4"; b. Cursor
document.write(x); c. Client
</script> d. FileUpLoad
Output------?
a. 44 63. What is mean by "this" keyword in
b. 8
javascript?
c. 4
d. Error output a. It refers current object
59. Is it possible to nest functions in b. It referes previous object
JavaScript? c. It is variable which contains value
d. None of the above
a. True
b. False 64. In JavaScript, Window.prompt()
<script>
method return true or false value ?

60. Scripting language are a. False


b. True
a. High Level Programming language
65. <script language="javascript">
b. Assembly Level programming
language function x()
c. Machine level programming language {
61. Which best explains getSelection()? document.write(2+5+"8");
}
</script>

38 University Academy
WEB TECHNOLOGY 2020-21

a. 258 d. All of these


b. Error
c. 7 70. ______________ is the sever support
d. 78 AJAX ?

66. <script type="text/javascript"> a. WWW


b. SMTP
var s = "9123456 or 80000?"; c. HTTP
var pattern = /\d{4}/; d. None of the above
var output = s.match(pattern);
document.write(output); 71. what is the full form of AJAX ?
</script>
a. 9123 a. Asynchronous Javascript and XML
b. 91234 b. Another Java and XML Library
c. 80000 c. Abstract JSON and XML
d. None of the above d. None of the mentioned

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.

69. The advantages of Ajax is __ a. ASP and XAML


b. Atlas and XML
a. Bandwidth utilization c. Asynchronous JavaScript and XML
b. More interactive d. None of the mentioned
c. Speeder retrieval of data

39 University Academy
WEB TECHNOLOGY 2020-21

74. Which of the following made AJAX a. JSU

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

81. How many types of triggers are present


76. Which of the following technology is in update panel?
not used by Ajax?
a. 2
a. JavaScript b. 3
b. Document Object Model c. 4
c. XMLHttpRequest d. 5
d. Flash 82. which of the following are the controls
77. Which of the following are controls of of Ajax?
Ajax except ?
a. ScriptManager
a. ScriptManager b. ScriptManagerProxy
b. UpdateData c. UpdateProgress
c. ScriptManagerProxy d. All of the mentioned
d. UpdatePanel 83. _______ are the advantages of Ajax?
78. _______is the name of the DLL that
contains Ajax control tool kit? a. Bandwidth utilization
b. More interactive
a. Ajaxtoolkit.dll c. Speeder retrieval of data
b. Ajaxcontroltoolkit.dll d. All of above
c. Ajaxcontrol.dll
d. control.dll 84. What are the disadvantages of Ajax?

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

85. ________are the methods used for cross c. Both A & B

domain Ajax calls? d. None of the above

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.

represents an? 98. In Java, which of the following


statement is true?
a. Socket
b. IP Address a. To create IPv4 address we must use
c. Protocol Inet4Address class.
d. MAC Address b. To create IPv6 address we must use
94. In InetAddress class which method it Inet6Address class.
returns the host name of the IP c. We can use InetAddress class to

Address? create both IPv4 and IPv6


addresses.
a. public String getHostName() d. None of the choices are correct.
b. public String getHostAddress() 99. A port number in Java is defined as
c. public static InetAddress _____integer.
getLocalHost()
d. None of the above a. a 16-bit integer
95. Which classes are used for connection- b. a 24-bit integer

less socket programming? c. a 48-bit integer


d. None of the choices are correct.
a. DatagramSocket 100. The class used in Java network
b. DatagramPacket programming for socket address is the
c. Both A & B ____class.
d. None of the above
96. Network programming in any language a. InetAddress
definitely needs to deal with __and __ b. SocketAddress
c. InetSocketAddress
a. user names; port numbers d. None of the choices are correct.
b. IP addresses; link-layer address 101. A server in a client-server
c. IP addresses; port numbers paradigm can be designed either as an
d. None of the choices are correct.
_______ server or a _________ server.
97. In Java, an IP address is defined as an
object, the instance of _______ class. a. asynchronous; concurrent
b. iterative; concurrent
a. InetAddress c. simultaneous; intermittent
b. SocketAddress d. None of the choices are correct.
42 University Academy
WEB TECHNOLOGY 2020-21

102. A concurrent server can server 107. Java implementation of TCP uses
_____ ___types of socket objects.

a. one client at a time a. only one


b. only two clients simultaneously b. only two
c. several clients simultaneously c. Many types
d. None of the choices are correct. d. None of the choices are correct.
103. An iterative server handles _____ 108. In Java implementation of TCP, a
client uses ____; a server uses _____.
a. one client at a time
b. two clients simultaneously a. ClientSocket object; ServerSocket
c. several clients simultaneously object
d. None of the choices are correct. b. Socket object; ServerSocket objec
104. Java implementation of UDP uses c. Socket object; ServerSocket object
______ and Socket object
d. None of the choices are correct.
a. only one type of socket objects 109. ServerSocket is sometimes called
b. two types of socket objects
the _____ and or the ____ socket.
c. many types of socket objects
d. None of the choices are correct. a. passive socket; listen socket
105. The DagramSocket class is used to b. active socket; listen socket
create sockets ________________. c. waiting socket; listen socket
d. None of the choices are correct.
a. in the UDP client 110. ____________ is responsible for
b. in the UDP server
establishing a connection.
c. in both the UDP client and UDP
server a. Socket
d. None of the choices are correct. b. ServerSocket
106. The ________________ class is c. ClientSocket
used to create datagram packets. d. None of the choices are correct.
111. In Java two methods,
a. DatagramPacket
getOutputStream and getInputStream,
b. DagramSocket
are provided in the ________ class.
c. DagramSocket or DatagramPacket
d. None of the choices are correct. a. ServerSocket
b. Socket

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

Note: Option in Bold is the Correct Option


Unit-IV
1. Which services are provided to EJB
components by the EJB container? 6. JMS is mainly used to send and receive
a. Transaction support message from one application to another.
b. Persistence support a. True
c. Naming support b. False
d. All mentioned above 7. Which session bean maintain their state
2. Which case of a session bean obtains the between client invocations but are not
UserTransaction object via the EJBContext required to maintain their state across
using the getUserTransaction() method in server crashes or shutdowns?
EJB transaction management? a. Stateful Session Bean
a. Bean-managed transactions b. Stateless Session Bean
b. Container-managed transactions c. Singleton Session Bean
c. Both A & B d. None of the above
d. None of the above
Answer Explanation 8. Which EJB container must provide an
3. EJB QL is a Query Language provided for implementation of Java Naming and
navigation across a network of enterprise Directory Interface (JNDI) API to provide
beans and dependent objects defined by naming services for EJB clients and
means of container managed persistence. components?
a. True a. Transaction support
b. False b. Persistence support
4. A message driven bean is like statefull c. Naming support
session bean that encapsulates the business d. All mentioned above
logic and doesn't maintain state. 9. EJB is a specification for J2EE server, not
a. True a product; Java beans may be a graphical
b. False component in IDE.
5. Abbreviate the term JMS? a. True
a. Java Message Service b. False
b. Java Monitor Service 10. A session bean represents a multiple clients
c. Java Message Session inside the Application Server.
d. Java Monitor Session a. True

45 University Academy
WEB TECHNOLOGY 2020-21

b. False d. None of the above


11. Which component does the Entity bean 17. In EJB, middleware services are provided
represent the persistent data stored in the by EJB Container automatically.
database? a. True
b. False
a. Server-side component 18. Which middleware services are provided
b. Client-side component by EJB?
c. server and client side component a. Security
d. None of the above b. Transaction Management
c. Both A & B
12. EJB is a specification for J2EE server, not a d. None of the above
product; Java beans may be a graphical 19. Which server-side component is required to
component in IDE. be deployed on the server?
a. True a. EJB
b. False b. RMI
13. EJB is like COM, Abbreviate the term c. Both A & B
COM? d. None of the above
a. Component Object Model 20. How many types of session beans are
b. Component Oriented Model available in EJB?
c. Common Object Model a. 2
d. Common Oriented Model b. 3
c. 4
14. JMS is also known as a messaging service. d. 5
a. True 21. Which type of instances retain no data or
b. False conversational state for a specific client?
15. The life cycle of session bean is not a. Message-Driven Bean
maintained by the application server (EJB b. Session Bean
Container). c. Entity Bean
a. True d. None of the above
b. False
16. What represents a persistent global data 22. Which middleware services are provided
from the database? by EJB?
a. Entity Bean a. Security
b. Session Bean b. Transaction Management
c. Both A & B c. Both A & B

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.

a. Middleware 31. Which role in EJB architecture is


b. Scalable component architecture responsible for EJB Server?
c. Component architecture to integrate a. EJB Deployer
legacy systems b. Application Assembler
d. All of the above. c. Network Engineer
d. Server Provider

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

c. Both A & B a. java.sql.TimeStamp


d. None of the above b. java.sql.Time
41. Session beans don’t have c. java.io.Time
a. ejbCreate() method d. java.io.TimeStamp
b. ejbStore() method 47. What does setAutoCommit(false) do?
c. ejbRemove() method a. commits transaction after each query
d. None b. explicitly commits transaction
42. An entity bean's local interface MUST c. does not commit transaction
extend the ________ interface. automatically after each query
a. javax.ejb.EJBLocalObject d. never commits transaction
b. javax.ejb.EJBObject
c. javax.ejb.RemoteObject 48. Which of the following is used to call
d. None of the above stored procedure?
43. What is returned by the method ejbCreate() a. Statement
CMP bean? b. PreparedStatement
a. Null c. CallableStatment
b. Primary Key class d. CalledStatement
c. Home Object
d. Remote Object 49. Which of the following is used to limit the
number of rows returned?
44. Which of the following is advantage of a. setMaxRows(int i)
using JDBC connection pool? b. setMinRows(int i)
a. Slow performance c. getMaxrows(int i)
b. Using more memory d. getMinRows(int i)
c. Using less memory 50. Which of the following is method of JDBC
d. Better performance batch process?
a. setBatch()
45. Which of the following is advantage of b. deleteBatch()
using PreparedStatement in Java? c. removeBatch()
a. Slow performance d. addBatch()
b. Encourages SQL injection 51. Which of the following is used to rollback a
c. Prevents SQL injection JDBC transaction?
d. More memory usage a. rollback()
46. Which one of the following contains date b. rollforward()
information? c. deleteTransaction()

49 University Academy
WEB TECHNOLOGY 2020-21

d. RemoveTransaction() d. None of the above


52. Which of the following is not a JDBC 57. Which JDBC driver Type(s) can you use in
connection isolation levels? a three-tier architecture and if the Web
a. TRANSACTION_NONE server and the DBMS are running on the
b. TRANSACTION_READ_COMMITT same machine?
ED a. Type 1 only
c. TRANSACTION_REPEATABLE_R b. Type 2 only
EA c. Both Type 3 and Type 4
d. TRANSACTION_NONREPEATAB d. All of Type 1, Type 2, Type 3 and
LE_READ Type 4
53. How many JDBC driver types does Sun 58. Which JDBC driver Type(s) is(are) the
define? JDBC-ODBC bridge?
a. One a. Type 1
b. Two b. Type 2
c. Three c. Type 3
d. Four d. Type 4

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

b. Statement encapsulates an SQL d. getConnection()


statement which is passed to the
database to be planned and executed. 66. Which are the new features adding in to the
c. Both of the above. JDBC 4.0?
d. none of the above. a. Auto-loading of JDBC driver class
b. Connection management
62. Which of the following type of JDBC enhancements
driver, uses database native protocol? c. Support for RowId SQL type
a. JDBC-ODBC Bridge plus ODBC d. All of the above
driver 67. When the message "No Suitable Driver"
b. Native-API, partly Java driver occurs?
c. JDBC-Net, pure Java driver a. When the driver is not registered
d. Native-protocol, pure Java driver by Class.forname() method
63. What is, in terms of JDBC, a DataSource? b. When the user name, password
a. A DataSource is the basic service for and the database does not match
managing a set of JDBC drivers c. When the JDBC database URL
b. A DataSource is the Java passed is not constructed
representation of a physical data properly
source d. When the type 4 driver is used
c. A DataSource is a registry point for
JNDI-services 68. The interface ResultSet has a method,
d. A Data Source is a factory of getMetaData(), that returns a/an
connections to a physical data a. Tuple
source b. Value
64. Which method is used to perform DML c. Object
statements in JDBC? d. Result
a. execute()
b. executeQuery()
c. executeUpdate()
d. executeResult()
65. Which of the following methods are needed
for loading a database driver in JDBC?
a. registerDriver() method
b. Class.forName()
c. Both A and B

51 University Academy
WEB TECHNOLOGY 2020-21

Note: Option in Bold is the Correct Option


Unit-V
d. session.setAttribute(String name)
1. How constructor can be used for a servlet? 5. Which method is used to get three-letter
a. Initialization abbreviation for locale’s country in servlets?
b. Constructor function a. Request.getISO3Country()
c. Initialization and Constructor b. Locale.getISO3Country()
function c. Response.getISO3Country()
d. Setup() method d. Local.retrieveISO3Country()
2. Can servlet class declare constructor with 6. Which of the following code retrieves the
ServletConfig object as an argument? body of the request as binary data?
a. True a. DataInputStream data = new
b. False InputStream()
b. DataInputStream data =
3. What is the difference between servlets and response.getInputStream()
applets? c. DataInputStream data =
i. Servlets execute on Server; Applets execute request.getInputStream()
on browser d. DataInputStream data =
ii. Servlets have no GUI; Applet has GUI request.fetchInputStream()
iii. Servlets creates static web pages; Applets
creates dynamic web pages 7. When destroy() method of a filter is called?
iv. Servlets can handle only a single request; a. The destroy() method is called only
Applet can handle multiple requests once at the end of the life cycle of a
a. i, ii, iii are correct filter
b. i, ii are correct b. The destroy() method is called after
c. i, iii are correct the filter has executed doFilter
d. i, ii, iii, iv are correct method
4. Which of the following code is used to get c. The destroy() method is called only
an attribute in a HTTP Session object in once at the begining of the life cycle
servlets? of a filter
a. session.getAttribute(String name) d. The destroyer() method is called
b. session.alterAttribute(String name) after the filter has executed
c. session.updateAttribute(String name)

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?

10. Which are the session tracking techniques? a. ServltInputStream


i. URL rewriting b. ServletOutputStream
ii. Using session object c. Both A & B
iii.Using response object d. None of the above
iv. Using hidden fields 15. The sendRedirect() method of
v. Using cookies HttpServletResponse interface can be used to
vi. Using servlet object redirect response to another resource, it may
a. i, ii, iii, vi be servlet, jsp or html file.
b. i, ii, iv, v a. True
c. i, vi, iii, v b. False
d. i, ii, iii, v 16. Which of these ways used to communicate
from an applet to servlet?
a. RMI Communication
b. HTTP Communication

53 University Academy
WEB TECHNOLOGY 2020-21

c. Socket Communication b. False


d. All mentioned above
17. Which methods are used to bind the 22. Web server is used for loading the init()
objects on HttpSession instance and get the method of servlet.
objects? a. True
a. setAttribute b. False
b. getAttribute 23. Servlets handle multiple simultaneous
c. Both A & B requests by using threads.
d. None of the above a. True
b. False
18. Which type of ServletEngine is a server 24. Which method is used to send the same
that includes built-in support for servlets? request and response objects to another servlet
a. Add-on ServletEngine in RequestDispacher ?
b. Embedded ServletEngine a. forward()
c. Standalone ServletEngine b. sendRedirect()
d. None of the above c. Both A & B
d. None of the above
19. What type of servlets use these methods 25. Which packages represent interfaces and
doGet(), doPost(),doHead, doDelete(), classes for servlet API?
doTrace()? a. javax.servlet
a. Genereic Servlets b. javax.servlet.http
b. HttpServlets c. Both A & B
c. All of the above d. None of the above
d. None of the above 26. Which class can handle any type of request
20. Which cookie it is valid for single session so that it is protocol-independent?
only and it is removed each time when the user a. GenericServlet
closes the browser? b. HttpServlet
a. Persistent cookie c. Both A & B
b. Non-persistent cookie d. None of the above
c. All the above 27. Which HTTP Request method is non-
d. None of the above idempotent?
21. Sessions is a part of the SessionTracking a. GET
and it is for maintaining the client state at b. POST
server side. c. BOTH A & B
a. True d. None of the above

54 University Academy
WEB TECHNOLOGY 2020-21

28. Which object is created by the web d. All mentioned above


container at time of deploying the project? 33. Which are the examples of Application
a. ServletConfig Server?
b. ServletContext a. Apache
c. Both A & B b. JBoss
d. None of the above c. Weblogic
29. What is the lifecycle of a servlet? d. Both b & c
- Published on 15 Jul 15 34. How many techniques are used in Session
Tracking?
a. Servlet class is loaded a. 4
b. Servlet instance is created b. 3
c. init,Service,destroy method is c. 2
invoked d. 5
d. All mentioned above 35. In HTTP Request method Get request is
30. Which method in session tracking is used secured because data is exposed in URL bar
in a bit of information that is sent by a web a. True
server to a browser and which can later be read b. False
back from that browser? 36. In the following statements identify the
a. HttpSession disadvantages of CGI?
b. URL rewriting a. If number of clients increases, it
c. Cookies takes more time for sending response
d. Hidden form fields b. For each request, it starts a process
31. In HTTP Request what asks for the and Web server is limited to start
loopback of the request message, for testing or processes
for troubleshooting? c. It uses platform dependent language
a. PUT e.g. C, C++, perl
b. OPTIONS d. All mentioned above
c. DELETE 37 Servlet technology is used to create web
d. TRACE application
32. Which one of the following scopes does a. True
the attribute in servlet is an object that can be b. False
set, get or removed?
a. session scope 38. Which of the following are the principal
b. request scope stages in the life cycle of Java Servlet.
c. application scope i) Server Initialization

55 University Academy
WEB TECHNOLOGY 2020-21

ii) Servlet Execution 41. Which of the following methods are


iii) Servlet Destruction provided to enable the servlet to process the
iv) Servlet Stop client’s request.
a. i, ii, and iii only i) getCookies()
b. i, iii, and iv only ii) getRequest()
c. ii, iii, and iv only iii) getSession()
d. All i, ii, iii, and iv only iv) getHeader()
39. State whether the following statements a. i, ii, and iii only
about the Java servlet life cycle are True or b. i, iii, and iv only
False. c. ii, iii, and iv only
i) init() and destroy() method will be called d. All i, ii, iii, and iv only
only once during the lifetime of the servlet. 42. State whether the following statements on
ii) Once the servlet is initialized any request the methods of HTTP servlet request are
that the servlet container receives will be True or False.
forwarded to the servlet’s execute() method. i) For the getHeader method, the match
a. i-True, ii-True between the given name and the request
b. i-True, ii-False header is case insensitive.
c. i-False, ii-True ii) If there is no query string, getQueryString
d. i-False, ii-False method returns null.
a. i-True, ii-True
40. Which of the following are the advantages b. i-True, ii-False
of Java Servlet over the other common c. i-False, ii-True
server extensions. d. i-False, ii-False
i) Java servlets are faster than other server
extensions like CGI scripts. 43. . … are the methods provided by HTTP
ii) Java servlets use a standard API that is servlet response to formulate the response
supported by many browsers. to the client.
iii) Java servlets are portable between server i) sendRedirect
and operating system. ii) getWriter
a. i and ii only iii) sendError
b. ii and iii only a. i and ii only
c. i and iii only b. ii and iii only
d. All i, ii and iii c. i and iii only
d. All i, ii and iii

56 University Academy
WEB TECHNOLOGY 2020-21

44. . … method obtains a byte-based output c. i and iii only


stream that enables binary data to be sent to d. All i, ii and iii
the client.
a. sendRedirect 48. State whether the following statements
b. getOutput() about the methods of cookies that are used
c. getOutputStream() for section tracking are True or False.
d. getWirter i) A zero value on the Cookie.SetMaxAge(int
expiry) tells the browser to delete the cookie
45. . … method obtains a character-based immediately.
output stream that enables text data to be ii) If no maximum age was specified the
sent to the client. getMaxAge() method returns zero.
a. sendRedirect a. i-True, ii-True
b. getOutput() b. i-True, ii-False
c. getOutputStream() c. i-False, ii-True
d. getWirter d. i-False, ii-False

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

d. Any of A & B This represents:


a. scriptlet tag
59. Arrange in correct sequence of JSP life b. expression tag
cycle. c. declaration tag
1. Instantiation d. taglib directive
2. Request processing
3. Initialization 64. Which of the following scripting elements
4. Classloading can be used to declare methods and fields?
5. Compilation of JSP Page a. scriptlet tag
6. Destroy b. expression tag
7. Translation of JSP Page c. declaration tag
d. All of the above
a. 7-5-4-1-3-2-6
b. 6-5-4-1-3-2-7 65. How many implicit objects are there in jsp?
c. 1-5-4-7-3-2-6 a. 7
d. 7-5-4-3-1-2-6 b. 8
60. In JSP, java code can be written inside the c. 9
jsp page using _____________ d. 10
a. scriptlet tag 66. Which of the following are implicit objects
b. expression tag in jsp?
c. declaration tag a. request
d. JSP include directive b. config
61. Which of the following can be used as c. application
scripting elements in jsp? d. all of the above
a. scriptlet tag 67. Which of the following is not implicit
b. expression tag object in jsp?
c. declaration tag a. session
d. All of the above b. page
62. The code placed within _______ is written c. pageContext
to the output stream of the response. d. cookies
a. declaration tag 68. _________ can be used to get request
b. scriptlet tag information such as parameter, header
c. expression tag information, remote address, server name,
d. All of the above server port, content type, character encoding
63. <%= statement %> etc.

59 University Academy
WEB TECHNOLOGY 2020-21

a. JSP request a. jsp:forward


b. JSP response b. jsp:useBean
c. JSP config c. jsp:setProperty
d. JSP session d. jsp:setException

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

It contains a root element


It contain an element
It contains one or more elements
Must contain one or more elements and root element must contain all
other elements

_________________________________________________________
Which tags are commonly used by search engines?

Headings
Title
Paragraph
All of these

_________________________________________________________
XPATH used to

Address your documents by specifying a location path


Address the server
Store the IP of the server
None of these

_________________________________________________________
DMSP stands for

Distributed Mail System Protocol


Distributed Message System Protocol

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

_________________________________________________________

P-1, Q-2, R-3, S-4


P-3, Q-4, R-2, S-1
P-3, Q-1, R-4, S-2
P-4, Q-3, R-2, S-1

_________________________________________________________
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

Format of the document


New locat ion of the document
A and B both
Start of the document

_________________________________________________________
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.

Hyper Text Markup Language


File Transfer Protocol
Hyper Text Transfer Protocol
Common Gateway Interface

_________________________________________________________
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

The data types of the contents of XML document


The presentation of XML document
The links with other documents
The structure of XML document

_________________________________________________________
What is XML?

Subset of SGML,Extensible Markup Language


Superset of SGML,Extensible Markup Language
Like SGML ,Extended Markup Language
None of these

_________________________________________________________
Internet data is broken up as

fixed length packets


variable length packets
not packetized
64 bytes packets

_________________________________________________________
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

take a predetermined path


take a path based on packet priority
go along different paths based on path availability
take the shortest path from source to destination

_________________________________________________________
Characteristic encoding is

Method used to represent numbers in a character


Method used to represent character in a number
Not a method
None of these

_________________________________________________________
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
_________________________________________________________

The facilities available in the internet are

(i) electronic mail


(ii) remote login
(iii)file transfer
(iv)word processing

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

_________________________________________________________

Internet addresses must always have at least

(i) a country name or organization type


(ii) internet service provider’s name
(iii) name of organization
(iv) name of individual
(v) type of organization

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

The data types of the contents of XML document


The presentation of XML document
The links with other documents
The structure of XML document

_________________________________________________________
Which of them take care of e mail at client side?

POP
MAP
IMAP
Both a and c

_________________________________________________________
Node in XML is

Any part of the document whether it is elements ,attributes or


otherwise
Referred only to the attributes
Referred to the top element in the document
None of these

_________________________________________________________
The tracing model in Prolog describes program execution in terms of
certain events. These events are

call and exit


call and fail
call, exit and redo
call, exit, redo and fail

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?

All the statements are true.


All XML elements must have closing tag.
All XML elements must be lower case.
All XML documents must have a DTD.

_________________________________________________________
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

_________________________________________________________

Among services available on the World Wide Web are

(i)Encryption
(ii)HTTP
(iii)HTML
(iv)Firewalls

i and ii
ii and iii
iii and iv
i and iv

_________________________________________________________

Internet packet data structure consists of

(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

Classified Internet Domain Routing


Classless Inter Domain Routing
Classless Internet Domain Routing
Classified Inter Domain Routing

_________________________________________________________
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

an extra fast computer network


the intranets of two co-operating organizations interconnected via a
secure leased line
an extra network used by an organization for higher reliability
an extra connection to internet provided to co-operating organizatin

_________________________________________________________
In HTML URI is used to

Create a frame document


Create a image map in the webpage
Customize the image in the webpage
Identify a name or a resource on the internet

_________________________________________________________

Desirable properties of a website are

(i)a meaningful address


(ii)Help and search facilities
(iii) Links to related sites
(iv)Features to allow users to give feedback
(v)Hosting on a mainframe

i, ii, iii
i, ii, iii, iv
i, ii, iii, iv, v
i, ii, iii, v

_________________________________________________________
The term byte stuf fing refers to

Data stuffing used wi th character oriented hardware


Data stuffing used wi th bi t oriented hardware

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

❖ Join our Telegram Channel

❖ Join Discussion Board

1. Microsoft XML schema data types for hexadecimal digits representing octates
A) UID
B) UXID
C) UUID
D) XXID
Ans-C

2. What does the URL need to access documents ?


I. Path name
II. Host name

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

3. Output of XML document can be viewed as


A) Word processor
B) Web browser
C) Notepad
D) None of the above
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

6. Let most segment of a name inn DNS represents


A) Individual Network
B) Individual computer
C) Domain name
D) Network type
Ans-B

7. The term byte stuffing refers to


A) Data stuffing used with character oriented hardware
B) Data stuffing used with bit oriented hardware
C) Data stuffing used with both A and B
D) Data stuffing used with byte oriented hardware
Ans - A

8. Which of the following attributes below are used for a font name?
A) Fontname

3
B) fn
C) Font
D) Face
Ans-D

9. The most popular way to materialize XML document is to use


A) DTD
B) XSLT
C) HTML
D) SOAP
Ans-B

10. Which of the following statement is true?


A) An XML document can have one root element.
B) An XML document can have one child element.
C) XML elements have to be in lower case.
D) All of the above.
Ans-A

11. Which of the following statement is true?


A) All the statements are true.
B) All XML elements must have closing tag.
C) All XML elements must be lower case.
D) All XML documents must have a DTD.

4
Ans-B

12. What is XML?


A) Subset of SGML, Extensible Markup Language
B) Superset of SGML, Extensible Markup Language
C) Like SGML, Extended Markup Language
D) None of these
VIEW ANSWER

13. Which of the following protocol is not used in the internet?


A) Telnet
B) WIRL
C) HTTP
D) Gopher
VIEW ANSWER

14. XML uses the features of


A) HTML
B) XHTML
C) VML
D) SGML
VIEW ANSWER

15. What are empty elements and is it valid?

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

16. Which tags are commonly used by search engines?


A) Headings
B) Title
C) Paragraph
D) All of these
VIEW ANSWER

17. Node in XML is


A) Any part of the document whether it is elements ,attributes or otherwise
B) Referred only to the attributes
C) Referred to the top element in the document
D) None of these
VIEW ANSWER

18. The HTML tags are enclosed within


A) Curly braces
B) Parentheses
C) Angle brackets

6
D) Square brackets
VIEW ANSWER

19. Well formed XML document means


A) It contains a root element
B) It contain an element
C) It contains one or more elements
D) Must contain one or more elements and root element must contain all other
elements
VIEW ANSWER

20. A header in CGI script can specify


A) Format of the document
B) New locat ion of the document
C) A and B both
D) Start of the document
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

24. How many root element can an XML document have ?


A) One
B) Two
C) Three
D) As many as the memory provides
VIEW ANSWER

25. All exceptions in Java are subclasses of built in class called

8
A) Exception
B) Error
C) Throwable
D) Raise
VIEW ANSWER

26. Which type of web document is run at the client site


A) Static
B) Dynamic
C) Active
D) All of the above
VIEW ANSWER

27. What is so great about XML?


A) Easy data exchange
B) High speed on network
C) Both A and B
D) None of the above
VIEW ANSWER

28. CIDR stands for


A) Classified Internet Domain Routing
B) Classless Inter Domain Routing
C) Classless Internet Domain Routing

9
D) Classified Inter Domain Routing
VIEW ANSWER

29. FDDI (Fiber Distributed Data Interconnect) is an example of


A) Token ring
B) Token bus
C) Star topology
D) Multipoint network
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

31. BCC in the internet refers to


A) Black carbon copy
B) Blind carbon copy
C) Blank carbon copy
D) Beautiful carbon copy
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

34. Characteristic encoding is


A) Method used to represent numbers in a character
B) Method used to represent character in a number
C) Not a method
D) None of these
VIEW ANSWER

35. www is based on which model?


A) Local server
B) Client server

11
C) 3 tier
D) None of these
VIEW ANSWER

36. In HTML URI is used to


A) Create a frame document
B) Create a image map in the webpage
C) Customize the image in the webpage
D) Identify a name or a resource on the internet
VIEW ANSWER

37. Hardware that calculates CRC uses


A) Shift register
B) Xor unit
C) Both A and B
D) Instruction register
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

40. What is the use of web font in HTML?


A) That is the core font that is used to develop web pages
B) That enables to use fonts over the web without installation
C) That is the special font that is developed by Microsoft corporation
D) All of the above
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

42. XML document can be viewed in


A) IE 3.0

13
B) IE 2.0
C) IE 6.0
D) IE X.0
VIEW ANSWER

43. DMSP stands for


A) Distributed Mail System Protocol
B) Distributed Message System Protocol
C) Distributed Message System Pool
D) Distributed Mail System Pool
VIEW ANSWER

44. Attributes in XML are


A) Elements inXML
B) Child nodes
C) A way of attaching characteristics or properties to elements of a document
D) None of these
VIEW ANSWER

45. The main function of a browser is to


A) Compile HTML
B) Interpret HTML
C) De-compile HTML
D) Interpret CGI programs

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

47. The MIME text file is saved with


A) HMT extension
B) HTML extension
C) THM extension
D) None of these
VIEW ANSWER

48. XPATH used to


A) Address your documents by specifying a location path
B) Address the server
C) Store the IP of the server
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

50. The XML DOM object is


A) Entity
B) Entity reference
C) Comment reference
D) Comment data
VIEW ANSWER

51. ____ are ignored by browser.


(A) Title tag
(B) Comments
(C) Body section
(D) Head section
VIEW ANSWER

52. HTML document should begin with the ____


(A) <HEAD> tag
(B) <TITLE> tag

16
(C) <BODY> tag
(D) <HTML> tag
VIEW ANSWER

53. GIF is the abbreviation for ___


(A) Graphics Interchange Format
(B) Graphics Instruction Format
(C) Graphics Item Format
(D) Graphics Information Format
VIEW ANSWER

54. The HTML and HTTP standard are defined by ____


(A) Web client
(B) Internet association
(C) WWW consortium
(D) WWW
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

57. Web page editors works on a ____ principle.


(A) WWW
(B) HTML
(C) WYSIWYG
(D) WYGWYSI
VIEW ANSWER

58. The <Font> tag is similar to ____


(A) <BIG>tag
(B) <SMALL>tag
(C) <MARQUEE>tag
(D) <BIG>and<Small> tag
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

61. The two commonly used browsers are ____


(A) Internet Explorer and Windows Explorer
(B) Outlook Express and Internet Explorer
(C) Microsoft Internet Explorer and Netscape Navigator
(D) Internet Explorer and HTML
VIEW ANSWER

62. The entire web document is contained within ____


(A) Comments
(B) Tags
(C) Web page
(D) HTML element

19
VIEW ANSWER

63. What is the abbreviation of HTTP?


(A) Hypertext tag path
(B) Hyper Text Transfer Protocol
(C) Hypertext transfer path
(D) None
VIEW ANSWER

64. How many color names are used by the browsers?


(A) 8
(B) 10
(C) 12
(D) 16
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

67. CGI stands for ___


(A) Common Gateway Internet
(B) Common Gateway Interface
(C) Central Gateway Interface
(D) Central Gateway Internet
VIEW ANSWER

68. Which language is used for creating Web Pages?


(A) PASCAL
(B) C
(C) HTML
(D) BASIC
VIEW ANSWER

69. Check boxes are used _____


(A) To enable option
(B) To disable option
(C) To create lists

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

71. The ____ attribute is used to identify the values of variables.


(A) text
(B) http-equiv
(C) content
(D) name
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

76. ____ is a collection of controls in HTML.


(A) Form
23
(B) Field
(C) Table
(D) Frame
VIEW ANSWER

77. HTML allows us to create three different kinds of ___


(A) Functions
(B) Events
(C) Files
(D) Lists
VIEW ANSWER

78. What are the two segments of a style tag?


(A) Selector and property
(B) Name and content
(C) Head section and body section
(D) None
VIEW ANSWER

79. ____ attribute is used to display an alternate message.


(A) Size
(B) ALT
(C) ALIGN
(D) SRC

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

81. HTML allows us to use ___ levels of headings.


(A) Two
(B) Three
(C) Five
(D) Six
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

88. What is the abbreviation of HTML?


(A) Hyper Tag Markup Language
(B) Hyper Text Markup Language
(C) Hyper Text Main Language
(D) Hyper Tag Main Language
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

91. Which are used with a tag to modify its function?


(A) Files
(B) Functions
(C) Attributes
(D) Documents
VIEW ANSWER

92. Which is an attribute of Meta tag?


(A) Name
(B) Content
(C) Both (a) and (b)
(D) None
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

94. ____ Icon displays list of fonts that can be used.


(A) Text Size Icon
(B) Italics
(C) Change Font Icon
(D) Bold
VIEW ANSWER

95. What is the birth date of Hypertext Documents?


(A) June 12, 1990
(B) June 15, 1990
(C) June 10, 1991
(D) June 12, 1991
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

97. The CELLSPACING attribute is used to ___


(A) Specify the colour of the border
(B) Specify the thickness of the border
(C) Specify the space between cells
(D) Specify the space between text and border
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

2. DOM stands for ___.


Ans: Document Object Model

3. SAX stands for ___.


Ans: Simple API in XML

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

6. ___ is a full-fledged object-oriented programming language.


Ans: Java

7. The ___ is used to manipulate a stored piece of text.


Ans: String Object

8. The ___ contains an array of previously visited URLs by the visitor.


Ans: History Object

8. The ___ represents an open window in a browser.


Ans: Window Object

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

12. The 'A' in AJAX stands for ___.


Ans: "asynchronous,"

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.

17. Abort () method cancels any network activity. (True/False)


Ans: True
18. ___ attribute is used to return the document response entity-body.
Ans: The responseXML

19. The ___ attribute is used to return the text response entity-body.
Ans: responseText

20. AJAX stands for “___.


Ans: Asynchronous JavaScript and XML

21. ___ uses a programming model with display and events.


Ans: AJAX

22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True

23. AJAX includes HTML and ___ for presenting.


Ans: CSS

24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True

25. ___ is a powerhouse of options for the Ajax programmer.


Ans: DHTML

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

29. SSP stands for ___.


Ans: Stream-based style sheet proposal

30. A markup language is just a set of rules. (True / false)


Ans: True

31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest

32. Using an external file, It is simpler to include a ___ file.


Ans: JavaScript

33. The X in Ajax stands for ___.


Ans: XML
34. In XML, we make up our own ___ names.
Ans: Element

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

40. DSO allows data binding to HTML table elements. (true/false)


Ans: True

41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()

42. PHP stands for___


Ans: Hypertext Pre-processor

43. PHP is a ___ scripting language.


Ans: Server-side

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

50. To add more functionality to a function, we can add ___.


Ans: Parameters
51. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest

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()

54. ___ can be used for interactive communication with a database.


Ans: AJAX

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()

61. ___ is used to request the deletion of the selected records.


Ans: AjazFunctionDelete()

62. A ___ is a separate application that stores a collection of data.


Ans: database

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

70. Variables cannot contain a ___.


Ans: period

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

---- THE END ----


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
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...

HOME Interview Questions MCQs *LAB VIVA CLASS NOTES SEMINAR TOPICS
ONLINE TEST GATE CAT Internship ABOUT US Privacy Policy

Home » WEB TECHNOLOGIES Questions » 300+ TOP WEB


TECHNOLOGIES MCQs and Answers

300+ TOP WEB TECHNOLOGIES


MCQs and Answers

1 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...

WEB TECHNOLOGIES Multiple Choice


Questions :-
1. Which of the following options is correct with regard to
HTML?

(a) It is a modelling language


(b) It is a DTP language
(c) It is a partial programming language
(d) It is used to structure documents
(e) It is a scripting language.

2. Consider the following statement:


GET /cgi-bin/dispenser.pl&want=whatsnew.html
HTTP/1.0

Which of the following options is a correct one?

(a) The above statement is a part of a request from a web client


(b) The above statement is a part of the input to a CGI program
(c) want is a variable and whatsnew.html is a value
(d) want is a variable and whatsnew.html HTTP/1.0 is the value
(e) dispenser.pl may be a CGI program.

3. When trying to access a URL, the following message is


displayed on the browser:

2 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...

Server; Error 403

What could be the reason for the message?

(a) The requested HTML file is not available


(b) The URL refers to a CGI script and the header of the script does
not indicate where the interpreter is located
(c) The path to the interpreter of the script file is invalid
(d) The first line of the output from the script is not a valid HTTP
header
(e) The requested HTML file or CGI script has insufficient
permission.

4. Which of the following statements is incorrect


regarding multimedia on the web?

(a) The MPEG, AIFF and WAV are cross-platform formats


(b) The MPEG, AU and MIDI are cross-platform formats
(c) The SND format has a relatively low fidelity
(d) VRML can be used to model and display 3D interactive graphics
(e) The dynsrc attribute in the element can be used to include
videos in web pages.

5. What would be the colours of the RGB where the

3 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...

hexadecimal values are #FF0000, #00FF00 and #0000FF


respectively?

(a) Blue, Green, Red


(b) Green, Blue, Red
(c) Green, Red, Blue
(d) Red, Blue, Green
(e) Red, Green, Blue.

6. The elements and have the following characteristics

(a) Element inherits properties defined for in a stylesheet


(b)and have no real meanings as html tags unless stylesheet is
applied

(c) Elements and define content to be inline or block-level

(d)and are used as alternatives for the element


(e)is used inside element.

7. Which of the following statement is not true regarding


JavaScript?

(a) JavaScript is a loosely typed language


(b) JavaScript is an object-based language
(c) JavaScript is event driven
(d) A JavaScript embedded in an HTML document is
compiled and executed by the client browser
(e) JavaScript can not run in stand-alone mode (without a
browser).

8. The following is a web-page:

<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...

<!– document.write(“<h1> hello world </h1>”); //–>


</script>
</body>
</html>

When the above web page is loaded into a browser, what


will happen?

(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.

9. The following statements are about three important


browser objects in JavaScript.

I. window object : The highest of all objects in the client-


side JavaScript object hierarchy.
II. navigator object : A collection of information about
the browser. Useful in browser sniffing.
III. document object : Provides access to the document
being viewed.
Which of the above statements is/are true?

(a) Only (I) above


(b) Only (II) above
(c) Only (III) above
(d) Both (I) and (II) above
(e) All (I), (II) and (III) above.

10. Consider the following script:

<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>

What will be the output of the above script?

(a) pass
(b) fail
(c) null
(d) 80
(e) Error at line 6.

WEB TECHNOLOGIES Mcqs

11. The following web page is loaded into a web server:

<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.

12. Which of the following statements is false regarding


“Cookies”?

(a) Cookies are programs which run in the background


of the web-client
(b) Cookies have the potential of being used to violate the privacy
of users
(c) Cookies are very helpful in keeping track of users in developing
online shopping cart applications, personalized portals and in
advertising on web sites
(d) Cookies cannot contain more than 4Kb of data
(e) Cookies usually contain data in the form of name = value pairs.

13. Consider the following script:

<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?

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.

14. Which of the following statements is true regarding


HTTP?

(a) Web browsers use only HTTP as a communication protocol


with servers
(b) It does not maintain any connection information on
previous transactions
(c) It is designed to route information based on content
(d) It refers to resources using their Universal Resource Identifier
(URI)
(e) It does not carry browser information to the server.

15. Which of the following is true about XHTML?

(a) It is a new hybrid technology that is different from both XML


and HTML
(b) It has totally replaced HTML as the tool for building Web pages
(c) It is a reformulation of HTML in XML
(d) One cannot use it to create Web pages
(e) It has to be converted to HTML using a style sheet.

16. While working on a JavaScript project, in your


JavaScript application, which function would you use to
send messages to users requesting for text input?

(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...

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().

18. Which of the following is true about client-side script


use in HTML documents?

(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.

19. Consider the following entries in a Cascading Style


Sheet (CSS) file.

P {colour: blue; background-colour: white; border-


colour: red; border-left: solid}
BODY {colour: black; border-colour: green}

What is the colour of text in a paragraph of an HTML


document that uses the above style sheet?

(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.

21. Which of the following statements is false about


event handlers in JavaScript?

(a) They can be included with input tags


(b) They can be associated with end of file processing for
a database application
(c) They can be included with the form tag
(d) They are generally used to call functions when triggered
(e) They can be used to trigger server-side scripts.

22. What method is used to specify a container’s layout


in JSP?

(a) setLayout()
(b) Layout()
(c) setContainerLayout()
(d) ContainerLayout()
(e) setConLayout().

23. Which method of the Component class is used to set


the position and size of a component in JSP?

(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().

24. What value does readLine() return when it has


reached the end of a file in JSP?

(a) Last character in the file


(b) False
(c) Null
(d) EOF
(e) True.

25. Which class in JSP provides the capability to


implement a growable array of objects?

(a) Array class


(b) GrowAbleArray class
(c) Container class
(d) Vector class
(e) DynamicArray class.

26. In JSP, the classes that allow primitive types to be


accessed as objects are known as

(a) Primitive classes


(b) Object classes
(c) Boxing classes
(d) UnBoxing classes
(e) Wrapped classes.

27. In JSP, a Canvas object provides access to a Graphics


object via one of its method called:

(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().

28. In ASP the function which returns the current


system date is:

(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()

30. DOM stand for ___________


A. document object model

B. document object memory

C. document oriented memory

D. none of these

Answer:
A.document object model

31. ________ java script is also called server side java


script
A. java script

B. object based scripting language

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

32. Increment operator, increases the value of variable


by what number?
A. 1

B. 2

C. 3

D. 4

Answer:
A.1

33. FUCTION is a block of statements that performs


certain task.
A. true

B. false

C. both a and b

D. none of these ..

Answer:
A.true

34. __________means the amount of data that can be


sent from one point to another in a certain period of
time
A. bandwidth

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

35. HTML color are specified using predefined color


names or ________ values.
A. rgb,

B. rgba

C. hsla

D. all of these

Answer:
D.all of these

36. HTML supports__________ standard color names.


A. 140

B. 3

C. 120

D. 7

Answer:
A.140

37. ____this tag is used to give paragraph


A. <p>

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>

38. ________ tag is used to brake the line it is single tag


A. <p>

B. <br>

C. <pre>

D. <marquee>

Answer:
B.<br>

39. ________ is pre formatted tags it is used ,it show


the without formatted text .
A. <p>

B. br

C. <pre>

D. <marquee>

Answer:
C.<pre>

40. __________tag is used to create a scrolling effect to


th selected text
A. <p>

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>

41. __________ element is used to indicated text


quoted from another scource..
A. <blockquote>

B. br

C. <pre>

D. <marquee>

Answer:
D.<marquee>

42. _______- it is used to show list by order wise .


A. <ol>

B. br

C. <pre>

D. <marquee>

Answer:
A.<ol>

43. _____________ it is used to show list by no


particular order wise .it show bulleted wise .
A. <ul>

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>

44. ________it is a comment , it is used to show


additional information in html.
A. <!—->

B. br

C. <pre>

D. <marquee>

Answer:
A.<!—->

45. _________ it is italic tag , it is used to show the italic


font.
A. <i>

B. br

C. <pre>

D. <marquee>

Answer:
A.<i>

46. _________ it is used to display a font in a bigger


font size .

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>

47. _________ this definition tag is used to define the


concept .
A. <def>

B. br

C. <pre>

D. <marquee>

Answer:
A.<def>

48. ________citation tag is used to display a citation in


html document .
A. <cite>

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...

49. Tag is divided into 2 tags


A. physical

B. logical

C. center tag

D. a and b b both

Answer:
D.a and b b both

50. __________ this tag is used to make taxt to be


aligned cantered.
A. <p>

B. <center>

C. <pre>

D. <marquee>

Answer:
B.<center>

51. To link to the another web site following link is used<a


href=”https://www.lokmat.com/html/”>Visit our lokamat paper
</a
A. true

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

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

53. __________ of the table is used to specify the thickness of


the table .DNYANSAGAR ARTS AND COMMERCE COLLEGE,
BALEWADI,PUNE-45PROF. YOGESH P.DESHMUKH
www.dacc.edu.in
A. border

B. <center>

C. cell spacing

D. <marquee>

Answer:
A.border

54. _____tag is used to create the rows in a table


A. <tr>

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>

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

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

58. __________ is used to manage the layout the page.


A. <tr>

B. colspan

C. <frame>

D. rowspan

Answer:
C.<frame>

59. In html __________ is used to divide the browser the screen


into 2 or more then onepart.
A. <tr>

B. columun

C. frame

D. rowspan

Answer:
C.frame

60. ______ tag is devide the tag horizontally or vertically .


A. <tr>

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>

61. ___________stands for Transmission Control


Protocol/Internet Protocol
A. tcp/ip

B. ftp

C. physical

D. hyperlink

Answer:
A.tcp/ip

62. ________is a set of standardized rules that allow computers


to communicate on anetwork such as the internet.
A. tcp/ip

B. ftp

C. physical

D. hyperlink

Answer:
A.tcp/ip

63. The __________ is a standard network protocol used for the


transfer of computerfiles between a client and server on a
computer network
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

64. The ____________element contains meta information about


the HTML page
A. <head>

B. ftp

C. physical

D. hyperlink

Answer:
A.<head>

65. The ________element defines the document’s body, and is a


container for allthe visible contents, such as headings, paragraphs,
images, hyperlinks, tables,lists, etc.
A. <head>

B. <body>

C. physical

D. hyperlink

Answer:
B.<body>

66. _______tag are used to indicate exactly how specific

24 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...

characters are to be formatted


A. tcp/ip

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

68. _______it is used to To create a link to another documents by


using href attribute
A. <a>

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...

69. __________accept only true or false we can select more then


one option out of givenoption
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>

26 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...

72. _____________it is used to submit the button ( accept the


data) to upload
A. <submit>

B. checkbox

C. <textarea>

D. <text>

Answer:
A.<submit>

73. ____________ it is used with text , when we use to hide the


text matter
A. <password>

B. checkbox

C. <textarea>

D. <text>

Answer:
A.<password>

74. Which data type value is returned by all transcendental math


functions?
A. int

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

D. none of the mentioned

Answer:
C.unicode

76. Which of these values can a boolean variable contain?


A. true & false

B. 0 & 1

C. any integer value

D. true

Answer:
A.true & false

77. Decrement operator, −−, decreases the value of variable by


what number?
A. 1

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.>>

79. What is the output of relational operators?


A. integer

B. boolean

C. characters

D. double

Answer:
B.boolean

80. . Which of these is returned by “greater than”, “less than” and


“equal to”operators?
A. integers

B. floating – point numbers

C. boolean

D. none of the mentioned

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

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

82. Which of the following is not a decision making statement?


A. if

B. if-else

C. switch

D. do-while

Answer:
D.do-while

83. Which of the following is not a valid flow control statement?


A. exit()

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()

84. Which of these operators is used to allocate memory to array


variable in Javascript?
A. malloc

B. alloc

C. new

D. new malloc

Answer:
C.new

85. Which of these is an incorrect array declaration?


A. int x[] = new int[5]

B. int [] arr = new int[5]

C. intarr[] = new int[5]

D. int x[] = int [5] new

Answer:
D.int x[] = int [5] new

86. Which of these selection statements test only for equality?


A. if

B. switch

C. if & switch

D. none of the mentioned

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

87. The CSS background properties are used to define the


___________effects.
A. background

B. customize

C. class

D. id rule

Answer:
A.background

88. CSS border properties allow us to__________ the borders.


A. background

B. customize

C. class

D. id rule

Answer:
B.customize

89. By applying an_______ a style can be applied to just a single


tag.
A. background

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

90. _________selectors are used to specify a group of elements.


A. background

B. customize

C. class

D. id rule

Answer:
C.class

91. In CSS, “font-size” can be called as ________


A. property name

B. selector

C. declaration

D. text color

Answer:
A.property name

92. In CSS, h1 can be called as _______


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

93. In , CSS “color:red” can be called as _____________


A. property name

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>

95. _______ describes how HTML elements are to be displayed


on screen, paper, or inother media
A. css

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

96. Websites are uploaded _______


A. address

B. serve

C. cache

D. client

Answer:
B.serve

97. HTML web pages can be read and rendered by __________


A. web browser

B. server

C. empty

D. head tag

Answer:
A.web browser

98. <INPUT> is ________tag.


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

100. The body tag usually used after _________


A. web browser

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

103. The <strike> tag is used to _________the text or sentence.


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

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

105. _________ is used to give additional information.


A. title tag

B. paired tag

C. strikeout

D. deleted

Answer:
A.title tag
Function and String in PHP

106. What is the range of short data type in Java script ?


A. -128 to 127

B. -32768 to 32767

C. -2147483648 to 2147483647

D. none of the mentioned

Answer:
B.-32768 to 32767

107. What is the range of byte data type in Java script?


A. -128 to 127

B. -32768 to 32767

C. -2147483648 to 2147483647

D. none of the mentioned

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

108. An expression involving byte, int, and literal numbers is


promoted towhich of these?
A. int

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

D. none of the mentioned

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

111. Which one is a valid declaration of a Boolean?


A. boolean b1 = 1;

B. boolean b2 = ‘false’;

C. boolean b3 = false;

D. boolean b4 = ‘true’

Answer:
C.boolean b3 = false;

112. Which of these operators is used to allocate memory to array


variable inJava script?
A. malloc

B. alloc

C. new

D. new malloc

Answer:
C.new

113. Which of these is an incorrect array declaration?


A. intarr[] = new int[5]

B. int [] arr = new int[5]

C. intarr[] = new int[5]

D. intarr[] = int [5] 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

114. Which of these is necessary to specify at time of array


initialization?
A. row

B. column

C. both row and column

D. none of the mentioned

Answer:
A.row

115. Which of the following can be operands of arithmetic


operators?
A. numeric

B. boolean

C. characters

D. both numeric & characters

Answer:
D.both numeric & characters

116. Modulus operator, %, can be applied to which of these?


A. integers

B. floating – point numbers

C. both integers and floating – point numbers

D. none of the mentioned

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

117. Which operator is used to invert all the digits in a binary


representation ofa number?
A. ~

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

119. Which of these operators can skip evaluating right hand


operand?
A. !

B. none of the mentioned

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.&&

120. Which of these have highest precedence?


A. ()

B. ++

C. *

D. >>

Answer:
A.()

121. Which of these statements are incorrect?


A. equal to operator has least precedence

B. brackets () have highest precedence

C. division operator, /, has higher precedence than multiplication


operator

D. addition operator, +, and subtraction operator have equal


precedence

Answer:
D.addition operator, +, and subtraction operator have equal
precedence

122. Which of these selection statements test only for equality?


A. if

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

D. none of the mentioned

Answer:
B.switch

123. Which of these are selection statements in Java script?


A. if()

B. for()

C. continue

D. break

Answer:
A.if()

124. Which of the following is not a valid jump statement?


A. break

B. goto

C. continue

D. return

Answer:
D.return

125. _______is the measured as the amount of data that can be


transferred from onepoint to another point within a specific
amount of time.
A. http

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

126. A ___________ is a document, typically written in plain


text distributed withformatting instruction of Hypertext markup
languages like HTML,XHTML
A. http

B. bandwidth

C. webpage

D. dream viewer

Answer:
C.webpage

127. ___________ Stands for Hypertext markup languages for


displaying webpages and other information that can be displayed
in a web browser
A. http

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:

B. internal or embedded css

C. external css:

D. none of these.

Answer:
D.none of these.

130. The _______ tag provides no visual change by itself, but


when it is marked, you canstyle it with CSS, or manipulate it with
JavaScript.
A. <map>

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...

131. The _________ tag defines an image in an HTML page.


A. <map>

B. <span>

C. <img>

D. <tt>

Answer:
A.<map>

132. The ____________tag has two required attributes: src and


alt.
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:

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>

134. _________tag Indicates that the text should be used with a


font such as Courier thatallots the same width to each character.
A. <map>

B. <span>

C. <img>

D. <tt>

Answer:
D.<tt>

135. _____________ tag Indicates that the text should be


displayed in a small font.Available in HTML 3.0 or higher.
A. <small>

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 >

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>

137. ___________Indicates that characters should be


emphasized in some way. Usuallydisplayed in italics.
A. <small>

B. <em>

C. <u>

D. <strong >

Answer:
B.<em>

138. _________Emphasizes characters more strongly than


<EM>. Usually displayed in a boldfont
A. <small>

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 >

140. ________Indicates a variable. Often displayed in italics or


underlined.
A. <var>

B. <em>

C. <kbd >

D. <strong >

Answer:
A.<var>

141. _________Indicates short quotes or citations. Often italized


by browsers.
A. <small>

B. <cite>

C. <kbd >

D. <strong >

Answer:
B.<cite>

142. The ________ele1ment defines a table row, the <th>


element defines a table header,and the <td> element defines a
table cell.
A. <small>

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>

143. The _______ tag is used to create in an HTML table.


A. <table>

B. <tr>

C. <td >

D. <th >

Answer:
A.<table>

144. CSS stands for ___________


A. cascading style sheets

B. cascading super sheets

C. cascading style excel sheet

D. none of these

Answer:
A.cascading style sheets

145. _________means the way to move from one page to another


page in website.To move from one page to another pages
hyperlinks are used.
A. http

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

146. __________ is Web development software . Create, code


and manage dynamicwebsites easily with a smart, simplified
coding engine
A. http

B. bandwidth

C. webpage

D. dream viewer

Answer:
D.dream viewer

147. ________ is a server scripting language, and a powerful tool


for making dynamicand interactive Web pages.
A. php

B. java script

C. angular js

D. none of these

Answer:
A.php

148. _______ is a object oriented programming language , it is


used to create theobject…
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

149. A ________ script can be placed anywhere in the document.


A. php

B. java script c

C. angular js

D. none of these

Answer:
A.php

150. The default file extension for PHP files is _________


A. .php

B. .js

C. .ajs

D. none of these

Answer:
A..php

151. __________ is used to show the out put …or give


message..same as printf in clanguage…
A. echo

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

152. PHP supports a ___________ range of databases


A. wide

B. small

C. short

D. none of these

Answer:
A.wide

153. PHP supports the following data types:


A. string

B. integer

C. float (floating point numbers – also called double)

D. all of the above .

Answer:
D.all of the above .

154. In PHP, an object must be_________declared.


A. explicitly

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

155. PHP divides the operators in the following groups:


A. increment/decrement operators

B. logical operators

C. string operators

D. all of the above

Answer:
D.all of the above

156. The basic assignment operator in PHP is __________ It


means that the left operandgets set to the value of the assignment
expression on the right.
A. =

B. ++

C. ==

D. ?

Answer:
A.=

157. the _________ statement is used to perform different


actions based on differentconditions
A. switch

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

158. In PHP, we have the following loop types:


A. while loop

B. for loop

C. foreach

D. all the these.

Answer:
D.all the these.

159. In php, A ___________ is a block of statements that can be


used repeatedly in aprogram.
A. function

B. procedure

C. block

D. loop

Answer:
A.function

Web Technologies Objective Questions with Answers Quiz Test


Pdf Download

56 of 60 03-08-2021, 19:25
300+ TOP WEB TECHNOLOGIES MCQs and Answers 2021 https://engineeringinterviewquestions.com/web-technologies-multiple-ch...

---- >> Related Posts Of Above Questions :::

------>>[MOST IMPORTANT]<<------

1. 250+ TOP MCQs on Embedding JavaScript in HTML


and Answers
2. 15 Days Learn Execute ExtJS Online
3. 15 Days Learn What is the JavaScript Object()
Constructor?
4. 250+ TOP MCQs on Script Loading and Answers
5. 250+ TOP MCQs on FTP & HTTP and Answers
6. 250+ TOP MCQs on HTML DOM and Answers
7. 250+ TOP MCQs on Client-Side JavaScript and
Answers
8. 300+ TOP Ui Developer Interview Questions and
Answers
9. 250+ TOP MCQs on Web Browsers and Answers
10. 250+ TOP MCQs on Lexical Structure and Answers
11. 15 Days Learn HTML 5 Tutorial for Freshers [Free
Pdf]
12. 15 Days Learn Material Design Lite Tutorial for
Freshers [Free Pdf]
13. 300+ [LATEST] Html Dom Interview Questions and
Answers
14. 250+ TOP MCQs on Browser Parsing and Rendering
and Answers
15. 15 Days Learn Bootstrap Tutorial for Freshers [Free
Pdf]
16. 250+ TOP MCQs on Lazy Loading and Answers
17. 250+ TOP MCQs on World Wide Web and Answers
18. 300+ TOP MOO TOOLS Interview Questions and
Answers
19. 250+ TOP MCQs on The Window Object and
Answers
20. 250+ TOP MCQs on Meta Data and Answers

57 of 60 03-08-2021, 19:25
5 THOUGHTS ON “300+ TOP WEB TECHNOLOGIES MCQS
AND ANSWERS”

SEPTEMBER 26, 2020 AT 2:08 PM

plz send me adavnced java mcq of bba(ca)

REPLY

APRIL 19, 2021 AT 4:42 PM

Pliz send me Web data management and


artificial intelligence mcq

REPLY

SEPTEMBER 25, 2020 AT 4:15 PM

plz send advance web technology mcq for


BBA(CA) sem 6

REPLY
Web Technology mcq questions and answers pdf - mcq Questions https://netflixsub.com/web-technology-mcq-questions-and-answers-pdf/

mcq Questions

Web Technology mcq questions and answers


pdf
Leave a Comment / Computer Engineering / By admin

Web Technology mcq with answers

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.

Q.no 1. What are cookies?


A : Cookies are text files stored on the client computer and they are kept for various
information tracking purpose.

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.

Q.no 2. What are variables used for in JavaScript Programs?


A : Storing numbers, dates, or other values
B : Varying randomly
C : Causing high-school algebra flashbacks
D : None of the above

Show Answer

Storing numbers, dates, or other values

Q.no 3. AngularJS bootstraps itself during config phase.


A : yes
B : no
C : always

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

Q.no 4. The correct signature of jspInit() method of HttpJspPage class is :


A : void jspInit(HTTPRequest request, HTTPResponse response)
B : void jspInit(HTTPRequest request, HTTPResponse response) throws
ServletException, IOException
C : void jspInit() throws ServletException, IOException
D : void jspInit()

Show Answer

void jspInit()

Q.no 5. Which of the following is not a valid JavaScript variable name?


A : 2names
B : _first_and_last_names
C : FirstAndLast
D : None of the above

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

Q.no 6. _____ JavaScript is also called client-side JavaScript.


A : Microsoft
B : Navigator
C : LiveWire
D : Native

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

Q.no 7. Which of the following is a web server?


A : Eclipse
B : Apache tomcat
C : Netbeans
D : All of the above

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

Q.no 9. Which module is used to serve static resources in Node.js?


A : node-static

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

Q.no 10. What sever support AJAX ?


A : WWW
B : SMTP
C : HTTP
D : SNMP

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

< ?php ? >

Q.no 12. What does validate() method of ActionForm returns?


A : ActionErrors
B : ActionForward
C : ActionMapping
D : ActionError

Show Answer

ActionForward

Q.no 13. How can we create instance of http module?


A : var http = require(“http”)
B : var http = new require(“http”)
C : var http = new http()
D : new mod()

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

var http = require(“http”)

Q.no 14. Statement in Javascript ends with


A : comma
B : semicolon
C : Question mark
D : Dollar sign

Show Answer

semicolon

Q.no 15. In PHP Language variables are case sensitive


A : true
B : Flase
C : Depends on website
D : Depends on server

Show Answer

true

Q.no 16. What HTTP stands for?


A : Hyperlink Text Transfer Protocol

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/

B : Hyper Text Transfer Protocol


C : Hyper Transfer Text Protocol
D : Hyper Time Transfer Protocol

Advertisement

Show Answer

Hyper Text Transfer Protocol

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

Q.no 19. What scripting language is jQuery written in?


A : VBScript
B : C++
C : JavaScript
D : C#

Show Answer

JavaScript

Q.no 20. What WSDL stands for?


A : Web Services Description Language

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/

B : Web Services Direction Language


C : Wired Services Description Language
D : Web Services Dialect Language

Advertisement

Show Answer

Web Services Description Language

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

Q.no 22. AJAX made popular by


A : Microsoft
B : IBM
C : Google
D : SunMicrosystem

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

Google

Q.no 23. Which of the following best describes JavaScript?


A : a low-level programming language.
B : a scripting language precompiled in the browser.
C : a compiled scripting language.
D : an object-oriented scripting language.

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

Q.no 25. Why so JavaScript and Java have similar name?


A : JavaScript is a stripped-down version of Java
B : JavaScript’s syntax is loosely based on Java’s
C : They both originated on the island of Java

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/

D : None of the above

Show Answer

JavaScript’s syntax is loosely based on Java’s

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

Q.no 27. which of the following is not a JSP Action Tag


A : jsp:forward
B : jsp:include
C : jsp:useBean
D : Jsp:import

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

Q.no 28. All variables in PHP start with which symbol?


A:$
B:&
C:!
D:*

Show Answer

Q.no 29. PHP is an example of ___________ scripting language.


A : Server-side
B : Client-side
C : Browser-side
D : In-side

Show Answer

Server-side

Q.no 30. Inside which HTML element do we put the JavaScript?


A:
B:
C:

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()

Q.no 33. What is the property textContent?


A : Sets the textual content of a node
B : Returns the textual content of a node
C : Both a and b
D : None of the mentioned

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

User Interface elements

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

Q.no 36. AngularJS applications are a mix of . . . . . .


A : HTML and PHP
B : HTML and CrossScript
C : HTML and AngularScript
D : HTML and JavaScript

Show Answer

HTML and JavaScript

Q.no 37. What type of selector is used in this case?


p {line-height: 150%;}
A : class Selectors
B : element Selectors
C : id Selectors
D : none of the mentioned

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

Q.no 40. Correct way to declare object in JS


A : var x = {firstName:”John”, lastName:”Doe”};
B : x = obj(firstName:”John”, lastName:”Doe”)
C : Both of above
D : None of above

Show Answer

var x = {firstName:”John”, lastName:”Doe”};

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

Q.no 42. Which is a language for finding information in an XML document?


A : Xpath
B : XSLT
C : Xlink
D : Xpointer

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

Q.no 44. What is the correct way to create a function in PHP?


A : function myFunction()

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()

Q.no 45. What makes Ajax unique?


A : It works as a stand-alone Web-development tool.
B : It works the same with all Web browsers.
C : It uses C++ as its programming language.
D : It makes data requests asynchronously.

Show Answer

It makes data requests asynchronously.

Q.no 46. The setTimeout() belongs to which object?


A : Element
B : Window
C : Location
D : None of the mentioned

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

Q.no 48. Which of the following is the structure of an if statement?


A : if (conditional expression is true) thenexecute this codeend if
B : if (conditional expression is true)execute this codeend if
C : if (conditional expression is true) {then execute this code>->}
D : if (conditional expression is true) then {execute this code}

Advertisement

Show Answer

if (conditional expression is true) {then execute this code>->}

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()

Q.no 50. Implict object config is instance of which class?


A : javax.servlet.ServletContext
B : javax.servlet.ServletConfig
C : javax.servlet.Context
D : javax.servlet.Application

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.

Q.no 53. WordPress is used to create……………


A : Website
B : Application
C : System Program
D : Operating System

Show Answer

Website

Q.no 54. Which relational database does WordPress use?


A : MySQL
B : Oracle
C : PostgresSQL
D : MS SQLServer

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

Q.no 57. Which statement is true?


A : All the statements are true
B : All XML elements must have a closing tag
C : All XML elements must be lower case
D : All XML documents must have a DTD

Show Answer

All XML elements must have a closing tag

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

Q.no 59. Which of the following is the Web application equivalent to


querySelectorAll()?
A : #()
B : &()
C : $()
D : None of the mentioned

Show Answer

$()

Q.no 60. XML Schemas consist of:


A : properties and methods.
B : elements and attributes.
C : structure and data.
D : tables and relationships.

Advertisement

Show Answer

structure and data.

← Previous Post Next Post →

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

Big data analytics mcq with answers pdf


April 18, 2021
Data Analytics sppu mcq 1. Read more

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/

Artificial intelligence and robotics mcqs sppu unit 4


April 13, 2021

Artificial intelligence and Read more

Illumination Engineering mcq with answers


July 21, 2021
Illumination Engineering mcq Read more

Artificial Intelligence and Robotics mcqs sppu unit 6


April 14, 2021
Artificial intelligence and Read more

Digital electronics and logic design sppu mcq pdf (DELD

MCQ)
May 1, 2021
Digital Electronics and Logic Read more

Frequently asked Design of Electrical Machines mcq questions


July 14, 2021

Q. 1. Thickness of core Read more

Data analytics mcq with answers for SPPU


March 27, 2021

data analytics mcq with 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

Data Mining and Warehousing

DBMS

Digital Electronics

Discrete Math

EEE

Electrical Engineeing

Engineering Metallurgy

ETL

First Year

Google Cloud Platform

High Performance Computing

ISEE

Machine Learning

Mechanical Engineering

Object Oriented Programming

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/

Copyright © 2021 Netflixsub.com


About Us Contact Us Disclaimer DMCA Privacy Policy Terms and Conditions

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

2. DOM stands for ___.


Ans: Document Object Model

3. SAX stands for ___.


Ans: Simple API in XML

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

6. ___ is a full-fledged object-oriented programming language.


Ans: Java

7. The ___ is used to manipulate a stored piece of text.


Ans: String Object

8. The ___ contains an array of previously visited URLs by the visitor.


Ans: History Object

8. The ___ represents an open window in a browser.


Ans: Window Object

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

12. The 'A' in AJAX stands for ___.


Ans: "asynchronous,"

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.

17. Abort () method cancels any network activity. (True/False)


Ans: True
18. ___ attribute is used to return the document response entity-body.
Ans: The responseXML

19. The ___ attribute is used to return the text response entity-body.
Ans: responseText

20. AJAX stands for “___.


Ans: Asynchronous JavaScript and XML

21. ___ uses a programming model with display and events.


Ans: AJAX

22. AJAX allows users to continue interacting with a web pages while waiting for data to be returned.
(True / False)
Ans: True

23. AJAX includes HTML and ___ for presenting.


Ans: CSS

24. Ajax component frameworks can enable more rapid development than direct Ajax frameworks, but with less
control. (True / False)
Ans: True

25. ___ is a powerhouse of options for the Ajax programmer.


Ans: DHTML

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

29. SSP stands for ___.


Ans: Stream-based style sheet proposal

30. A markup language is just a set of rules. (True / false)


Ans: True

31. ___ provides a mechanism for transferring the data either in text or XML format between the web client and the
webserver.
Ans: HTTPRequest

32. Using an external file, It is simpler to include a ___ file.


Ans: JavaScript

33. The X in Ajax stands for ___.


Ans: XML
34. In XML, we make up our own ___ names.
Ans: Element

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

40. DSO allows data binding to HTML table elements. (true/false)


Ans: True

41. ___ property holds an array that contains all the child nodes of the document element
Ans: ChildNodes()

42. PHP stands for___


Ans: Hypertext Pre-processor

43. PHP is a ___ scripting language.


Ans: Server-side

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

50. To add more functionality to a function, we can add ___.


Ans: Parameters
51. To make a communication between the client and the server the client code needs to create a so-called ___ object.
Ans: XMLHttpRequest

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()

54. ___ can be used for interactive communication with a database.


Ans: AJAX

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()

61. ___ is used to request the deletion of the selected records.


Ans: AjazFunctionDelete()

62. A ___ is a separate application that stores a collection of data.


Ans: database

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

70. Variables cannot contain a ___.


Ans: period

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

---- THE END ----


Web Technologies Solved
MCQ - Part 2

http://freepdf-books.com
Web Technologies Solved
MCQ - Part 2
Well formed XML document means

It contains a root element


It contain an element
It contains one or more elements
Must contain one or more elements and root element must contain all
other elements

_________________________________________________________
Which tags are commonly used by search engines?

Headings
Title
Paragraph
All of these

_________________________________________________________
XPATH used to

Address your documents by specifying a location path


Address the server
Store the IP of the server
None of these

_________________________________________________________
DMSP stands for

Distributed Mail System Protocol


Distributed Message System Protocol

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

_________________________________________________________

P-1, Q-2, R-3, S-4


P-3, Q-4, R-2, S-1
P-3, Q-1, R-4, S-2
P-4, Q-3, R-2, S-1

_________________________________________________________
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

Format of the document


New locat ion of the document
A and B both
Start of the document

_________________________________________________________
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.

Hyper Text Markup Language


File Transfer Protocol
Hyper Text Transfer Protocol
Common Gateway Interface

_________________________________________________________
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

The data types of the contents of XML document


The presentation of XML document
The links with other documents
The structure of XML document

_________________________________________________________
What is XML?

Subset of SGML,Extensible Markup Language


Superset of SGML,Extensible Markup Language
Like SGML ,Extended Markup Language
None of these

_________________________________________________________
Internet data is broken up as

fixed length packets


variable length packets
not packetized
64 bytes packets

_________________________________________________________
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

take a predetermined path


take a path based on packet priority
go along different paths based on path availability
take the shortest path from source to destination

_________________________________________________________
Characteristic encoding is

Method used to represent numbers in a character


Method used to represent character in a number
Not a method
None of these

_________________________________________________________
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
_________________________________________________________

The facilities available in the internet are

(i) electronic mail


(ii) remote login
(iii)file transfer
(iv)word processing

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

_________________________________________________________

Internet addresses must always have at least

(i) a country name or organization type


(ii) internet service provider’s name
(iii) name of organization
(iv) name of individual
(v) type of organization

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

The data types of the contents of XML document


The presentation of XML document
The links with other documents
The structure of XML document

_________________________________________________________
Which of them take care of e mail at client side?

POP
MAP
IMAP
Both a and c

_________________________________________________________
Node in XML is

Any part of the document whether it is elements ,attributes or


otherwise
Referred only to the attributes
Referred to the top element in the document
None of these

_________________________________________________________
The tracing model in Prolog describes program execution in terms of
certain events. These events are

call and exit


call and fail
call, exit and redo
call, exit, redo and fail

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?

All the statements are true.


All XML elements must have closing tag.
All XML elements must be lower case.
All XML documents must have a DTD.

_________________________________________________________
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

_________________________________________________________

Among services available on the World Wide Web are

(i)Encryption
(ii)HTTP
(iii)HTML
(iv)Firewalls

i and ii
ii and iii
iii and iv
i and iv

_________________________________________________________

Internet packet data structure consists of

(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

Classified Internet Domain Routing


Classless Inter Domain Routing
Classless Internet Domain Routing
Classified Inter Domain Routing

_________________________________________________________
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

an extra fast computer network


the intranets of two co-operating organizations interconnected via a
secure leased line
an extra network used by an organization for higher reliability
an extra connection to internet provided to co-operating organizatin

_________________________________________________________
In HTML URI is used to

Create a frame document


Create a image map in the webpage
Customize the image in the webpage
Identify a name or a resource on the internet

_________________________________________________________

Desirable properties of a website are

(i)a meaningful address


(ii)Help and search facilities
(iii) Links to related sites
(iv)Features to allow users to give feedback
(v)Hosting on a mainframe

i, ii, iii
i, ii, iii, iv
i, ii, iii, iv, v
i, ii, iii, v

_________________________________________________________
The term byte stuf fing refers to

Data stuffing used wi th character oriented hardware


Data stuffing used wi th bi t oriented hardware

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

You might also like