You are on page 1of 571

Q.

HTML is what type of language ?


A.Scripting LanguageB.Markup Language
C.Programming LanguageD.Network Protocol
Answer : Markup Language [Option : B]

Show Answer
Q.
HTML uses
A.User defined tagsB.Pre-specified tags
C.Fixed tags defined by the languageD.Tags only for linking
Answer : Fixed tags defined by the language [Option : C]

Show Answer
Q.
The year in which HTML was first proposed _______.
A.1990B.1980
C.2000D.1995
Answer : 1990 [Option : A]

Show Answer
Q.
Fundamental HTML Block is known as ___________.
A.HTML BodyB.HTML Tag
C.HTML AttributeD.HTML Element
Answer : HTML Tag [Option : B]

Show Answer
Q.
Apart from <b> tag, what other tag makes text bold ?
A.<fat>B.<strong>
C.<black>D.<emp>
Answer : <strong> [Option : B]
Q.
What is the full form of HTML?
A.HyperText Markup LanguageB.Hyper Teach Markup Language
C.Hyper Tech Markup LanguageD.None of these
Answer : HyperText Markup Language [Option : A]

Show Answer
Q.
Who is Known as the father of World Wide Web (WWW)?
A.Robert CailliauB.Tim Thompson
C.Charles DarwinD.Tim Berners-Lee
Answer : Tim Berners-Lee [Option : D]

Show Answer
Q.
What should be the first tag in any HTML document?
A.<head>B.<title>
C.<html>D.<document>
Answer : <html> [Option : C]

Show Answer
Q.
How can you make a bulleted list with numbers?
A.<dl>B.<ol>
C.<list>D.<ul>
Answer : <ol> [Option : B]

Show Answer
Q.
What tag is used to display a picture in a HTML page?
A.pictureB.image
C.imgD.src
Answer : img [Option : C]

HTML web pages can be read and rendered by _________.


A.CompilerB.Server
C.Web BrowserD.Interpreter
Answer : Web Browser [Option : C]

Show Answer
Q.
Which of the following is not a browser ?
A.Microsofts BingB.Netscape Navigator
C.Mozilla FirefoxD.Opera
Answer : Microsofts Bing [Option : A]

Show Answer
Q.
Which HTML tag produces the biggest heading?
A.<h7>B.<h9>
C.<h4>D.<h1>
Answer : <h1> [Option : D]
Show Answer
Q.
HTML tags are surrounded by which type of brackets.
A.CurlyB.Round
C.SquartD.Angle
Answer : Angle [Option : D]

Show Answer
Q.
Tags and texts that are not directly displayed on the page are written in _____ section.
A.<head>B.<title>
C.<body>D.<html>
Answer : <head> [Option : A]
1.) What is the preferred way for adding a background color in HTML?
a.) <body background="yellow">
b.) <background>yellow</background>
c.) < body style="background-color:yellow">
d.) <background color="yellow">text<background>
View Answer / Hide Answer

ANSWER: c.) < body style="background-color:yellow">

2.) What is the correct HTML for creating a hyperlink?


a.) <a name="">A</a>
b.) <a>B</a>
c.) <a href="http://www.example.com">example</a>
d.) <a url="http://www.example.com">example</a>
View Answer / Hide Answer

3.) How can you create an e-mail link?


a.) <mail href="a@b">
b.) <mail>a@b</mail>
c.) <a href="a@b">
d.) <a href="mailto:a@b.com">
View Answer / Hide Answer

ANSWER: d.) <a href="mailto:a@b.com">

4.) How can you open a link in a new browser window?


a.) <a href="url" new>
b.) <a href="url" target="new">
c.) <a href="url" target="_blank">
d.) <a href="url" target="">
View Answer / Hide Answer

ANSWER: c.) <a href="url" target="_blank">

5.) Which of these tags are all <table> tags?


a.) <table><head><tfoot>
b.) <table><tr><td>
c.) <table><tr><tt>
d.) <thead><body><tr>
View Answer / Hide Answer

ANSWER: b.) <table><tr><td>

6.) Which of the following JavaScript cannot do?


a.) JavaScript can react to events
b.) JavaScript can manipulate HTML elements
c.) JavaScript can be use to validate data
d.) All of the Above
View Answer / Hide Answer

ANSWER: d.) All of the Above

7.) Whats so great about XML?


a.) Easy data exchange
b.) High speed on network
c.) Only B.is correct
d.) Both A & B
View Answer / Hide Answer

ANSWER: d.) Both A & B

8.) Which is not a property of attribute Behaviour of <Marquee> tag?


a.) alternate
b.) blur
c.) scroll
d.) slide
View Answer / Hide Answer

ANSWER: b.) blur

9.) _________ keyword is used to declare variables in javascript.


a.) Var
b.) Dim
c.) String
d.) None of the above
View Answer / Hide Answer

ANSWER: a.) Var

10.) The attribute used to define a new namespace is.


a.) XMLNS
b.) XmlNameSpace
c.) Xmlns
d.) XmlNs
View Answer / Hide Answer

ANSWER: c.) Xmlns


1.) Using _______ statement is how you test for a specific condition.
a.) Select
b.) If
c.) Switch
d.) For
View Answer / Hide Answer

ANSWER: b.) If

3.) How to create a Date object in JavaScript?


a.) dateObjectName = new Date([parameters])
b.) dateObjectName.new Date([parameters])
c.) dateObjectName := new Date([parameters])
d.) dateObjectName Date([parameters])
View Answer / Hide Answer

ANSWER: a.) dateObjectName = new Date([parameters])

4.) The _______ method of an Array object adds and/or removes elements from an array.
a.) Reverse
b.) Shift
c.) Slice
d.) Splice
View Answer / Hide Answer

ANSWER: d.) Splice

5.) To set up the window to capture all Click events, we use which of the following
statement?
a.) window.captureEvents(Event.CLICK);
b.) window.handleEvents (Event.CLICK);
c.) window.routeEvents(Event.CLICK );
d.) window.raiseEvents(Event.CLICK );
View Answer / Hide Answer

ANSWER: a.) window.captureEvents(Event.CLICK);

6.) Who is making the Web standards?


a.) Mozilla
b.) Microsoft
c.) The World Wide Web Consortium
d.) NVDIA
View Answer / Hide Answer

ANSWER: c.) The World Wide Web Consortium

7.) Choose the correct HTML tag for the largest heading
a.) <h6>
b.) <heading>
c.) <head>
d.) <h1>
View Answer / Hide Answer

ANSWER: d.) <h1>

8.) What is the correct HTML tag for inserting a line break?
a.) <br />
b.) <break />
c.) <lb />
d.) <nbsp>
View Answer / Hide Answer

ANSWER: a.) <br />

9.) Can a data cell contain images?


a.) yes
b.)no
View Answer / Hide Answer

ANSWER: a.) yes

10.) How do I add scrolling text to my page?


a.) <scroll>
b.) <marquee>
c.) <ciruler>
d.) <tab>
View Answer / Hide Answer

ANSWER: b.) <marquee>


1.) When you create a "recipient" hidden field for a form, which of the following is the ONLY
correct way to type the word "recipient?":
a.) Recipient
b.) <recipient></recipient>
c.) recipient
d.) RECIPIENT
View Answer / Hide Answer

ANSWER: b.) <recipient></recipient>


2.)Which file controls how your frames will appear?
a.) Frameset
b.) Master Document
c.) Template
d.) Timeline
View Answer / Hide Answer

ANSWER: a.) Frameset

3.) What can't layers do if you want to convert them to tables?


a.) Be close
b.) Contain a Color
c.) Be larger than the target table
d.) Overlap
View Answer / Hide Answer

ANSWER: c.) Be larger than the target table

4.) Which HTML tag is used to define an internal style sheet?


a.) <script>
b.) <css>
c.) none of them
d.) <style>
View Answer / Hide Answer

ANSWER: d.) <style>

5.) Which HTML attribute is used to define inline styles?


a.) font
b.) class
c.) styles
d.) style
View Answer / Hide Answer

ANSWER: c.) styles


6.) Which is the correct CSS syntax?
a.) body:color=black
b.) {body;color:black}
c.) {body:color=black(body}
d.) body {color: black}
View Answer / Hide Answer

ANSWER: d.) body {color: black}

7.) How do you change the text color of an element?


a.) text-color=
b.) text-color:
c.) color:
d.) fgcolor:
View Answer / Hide Answer

ANSWER: c.) color:

8.) How do you display hyperlinks without an underline?


a.) a {text-decoration:none}
b.) a {underline:none}
c.) a {text-decoration:no underline}
d.) a {decoration:no underline}
View Answer / Hide Answer

ANSWER: a.) a {text-decoration:none}

9.) How do you change the font of an element?


a.) font=
b.) f:
c.) font-family:
d.) None of the above
View Answer / Hide Answer

ANSWER: c.) font-family:


10.) How do you change the left margin of an element?
a.) text-indent:
b.) margin:
c.) margin-left:
d.) indent:
View Answer / Hide Answer

ANSWER: c.) margin-left: 1.) To match the root node in XMLT transform the syntax will be.
a.) <xsl:template match="Document">
b.) <xsl:template match="Root">
c.) <xsl:template match="RootNode">
d.) <xsl:template match="/">
View Answer / Hide Answer

ANSWER: d.) <xsl:template match="/">

2.) To match the specific XML elements child like of parent element is the syntax will be.
a.) <xsl:template match="PLANET_NAME">
b.) <xsl:template match="PLANET/NAME">
c.) <xsl:template match="/NAME">
d.) <xsl:template match="//">
View Answer / Hide Answer

ANSWER: b.) <xsl:template match="PLANET/NAME">

3.) Which of the following options is correct with regard to HTML?


a.) It is a modelling language
b.) It is a scripting language
c.) It is a partial programming language
d.) It is used to structure documents
View Answer / Hide Answer

ANSWER: d.) It is used to structure documents

4.) Which CSS property can provide to add an effect when changing from one style to
another,without using Flash animations or javascript?
a.) Associations
b.) Transitions
c.) Transistor
d.) None of the above
View Answer / Hide Answer

5.) Which browser can supports the transition property?


a.) Internet Explorer 10
b.) Firefox
c.) Chrome
d.) All of the above
View Answer / Hide Answer

ANSWER: d.) All of the above

6.) Which tag(s) can handle mouse events in Netscape?


a.) <IMG>
b.) <A>
c.) <BR>
d.) None of the above
View Answer / Hide Answer

ANSWER: b.) <A>

7.) ____________ is the tainted property of a window object.


a.) Pathname
b.) Protocol
c.) Defaultstatus
d.) Host
View Answer / Hide Answer

ANSWER: c.) Defaultstatus

8.) To enable data tainting, the end user sets the _________ environment variable.
a.) ENABLE_TAINT
b.) MS_ENABLE_TAINT
c.) NS_ENABLE_TAINT
d.) ENABLE_TAINT_NS
View Answer / Hide Answer

ANSWER: c.) NS_ENABLE_TAINT

9.) In JavaScript, _________ is an object of the target language data type that encloses an
object of the source language.
a.) a wrapper
b.) a link
c.) a cursor
d.) a form
View Answer / Hide Answer

ANSWER: a.) a wrapper

10) When a JavaScript object is sent to Java, the runtime engine creates a Java wrapper of
type
a.) ScriptObject
b.) JSObject
c.) JavaObject
d.) Jobject
View Answer / Hide Answer

ANSWER: b.) JSObject 1.) iframe in HTML is used to display a web page within a web
page.
a.) TRUE
b.) FALSE
View Answer / Hide Answer

ANSWER: a.) TRUE

2.) Using which tag we insert an JavaScript in HTML page?


a.) <JavaScript type="text/javascript">
b.) <script type="text/javascript">
c.) <JScript type="text/javascript">
d.) <HTMLScript type="text/javascript">
View Answer / Hide Answer

ANSWER: b.) <script type="text/javascript">


3.) Which of the following is true about links by default?
a.) An unvisited link is underlined and blue
b.) A visited link is underlined and red
c.) An active link is underlined and purple
d.) All the above
View Answer / Hide Answer

ANSWER: a.) An unvisited link is underlined and blue

4.) The href attribute in the link tag specifies the:


a.) Destination of a link
b.) Link
c.) Hypertext
d.) None of the above
View Answer / Hide Answer

ANSWER: a.) Destination of a link

5.) HTML Event Attributes onload fires just before the page is finishing loading.
a.) TRUE
b.) FALSE
View Answer / Hide Answer

ANSWER: b.) FALSE

6.) HTML Event Attributes onunload fires


a.) When the browser window has been closed
b.) When the browser window is minimized
c.) When the browser window has changed focus to other window
d.) After the page is finished loading
View Answer / Hide Answer

ANSWER: a.) When the browser window has been closed


7.) HTML Form Events ___________, fires the moment that the element loses focus.
a.) onblur
b.) onfocus
c.) onchange
d.) onlostfocus
View Answer / Hide Answer

ANSWER: a.) onblur

8.) Twitter limits the number of characters per tweet is ?


a.) 130
b.) 160
c.) 124
d.) 140
View Answer / Hide Answer

ANSWER: d.) 140

9.) What is cell padding?


a.) Used to separate cell walls from their contents
b.) Used to set space between cells
c.) Both a and b above
d.) Used to provide width to a cell
View Answer / Hide Answer

ANSWER: a.) Used to separate cell walls from their contents

10.) What are meta tags used for?


a.) To store information usually relevant to browsers and search engines
b.) To only store information usually relevant to browsers
c.) To only store information about search engines
d.) To store information about external links
View Answer / Hide Answer

ANSWER: a.) To store information usually relevant to browsers and search engines
1.) The trick to getting a ball to bounce around a Web page is to:
a.) Add AnimationBounce layers
b.) Add keyframes to the timeline
c.) Add Bounce parameters to the Object properties
d.) Dreamweaver does not support animation... use Flash instead
View Answer / Hide Answer

ANSWER: b.) Add keyframes to the timeline

2.) By default, what's the Fps shown on the timeline?


a.) 15
b.) 1
c.) 20
d.) huh?
View Answer / Hide Answer

ANSWER: a.) 15

3.) Which of the following is false?


a.) The Site Map can be saved as an image
b.) You can FTP files using Dreamweaver
c.) You can create forms in Dreamweaver
d.) None of the above
View Answer / Hide Answer

ANSWER: d.) None of the above

4.) 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 path to the interpreter of the script file is invalid
c.) The first line of the output from the script is not a valid HTTP header
d.) The requested HTML file or CGI script has insufficient permission
View Answer / Hide Answer

ANSWER: d.) The requested HTML file or CGI script has insufficient permission
5.) Dreamweaver users work in the Document Window using one of how many views?
a.) 3
b.) 5
c.) 2
d.) 8
View Answer / Hide Answer

ANSWER: a.) 3

6.) The general definition of a(n) ____ is a set of linked documents with shared attributes,
such as related topics, a similar design, or a shared purpose.
a.) index
b.) website
c.) Internet
d.) Homepage
View Answer / Hide Answer

ANSWER: b.) website

7.) What type of technology allows you to verbally speak with someone over the Internet?
a.) Wiki
b.) Social network
c.) Ephone
d.) VoIP
View Answer / Hide Answer

ANSWER: d.) VoIP

8.) Dreamweaver's ____ feature allows users to select colors and make perfect color
matches.
a.) Color Cube
b.) Palattes
c.) HTML view
d.) Eye dropper
View Answer / Hide Answer

ANSWER: d.) Eye dropper


9.) A Web site's home page is normally named home.htm or home.html
a.) TRUE
b.) FALSE
View Answer / Hide Answer

ANSWER: b.) FALSE

10.) _________ view is a hand-coding environment for writing and editing code
a.) Design
b.) Split
c.) Code
View Answer / Hide Answer

ANSWER: c.) Code


1.) How can you make a list that lists the items with numbers?
a.) <ul>
b.) <list>
c.) <ol>
d.) <dl>
View Answer / Hide Answer

ANSWER: c.) <ol>

2.) What is the correct HTML for making a checkbox?


a.) <checkbox>
b.) <input type="checkbox" />
c.) <input type="check" />
d.) <check>
View Answer / Hide Answer

ANSWER: b.) <input type="checkbox" />

3.) 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" />
View Answer / Hide Answer

ANSWER: d.) <input type="text" />

4.) What is the correct HTML for making a drop-down list?


a.) <input type="list" />
b.) <select>
c.) <list>
d.) <input type="dropdown" />
View Answer / Hide Answer

ANSWER: b.) <select>

5.) What is the correct HTML for making a text area?


a.) <input type="textarea" />
b.) <input type="textbox" />
c.) <textarea>
d.) None of these
View Answer / Hide Answer

ANSWER: c.) <textarea>

6.) What is the correct HTML for inserting an image?


a.) <image src="image.gif" alt="MyImage" />
b.) <img href="image.gif" alt="MyImage" />
c.) <img src="image.gif" alt="MyImage" />
d.) <img alt="MyImage">image.gif
View Answer / Hide Answer

ANSWER: c.) <img src="image.gif" alt="MyImage" />

7.) colspan=n can be added to only what tag?


a.) <table>
b.) <td>
c.) <tr>
d.) <thead>
View Answer / Hide Answer

ANSWER: b.) <td>

8.) What tag adds a paragraph break after the text ?


a.) <PARAGRAPH>
b.) <P>
c.) <BR>
d.) <pr>
View Answer / Hide Answer

ANSWER: b.) <P>

9.) All HTML comment tags are enclosed in what ?


a.) <>
b.) <? and ?>
c.) # and #
d.) <!-- and -->
View Answer / Hide Answer

ANSWER: d.) <!-- and -->

10.) The TFOOT section of a table must appear before the TBODY section.
a.) FALSE
b.) TRUE
View Answer / Hide Answer

ANSWER: b.) TRUE What is a CMS in web design

a) Content Management System

b) Creative Management System

c) Content Mixing System


d) Creatives Managerial System

Answer : a (Content Management System)

Question 2 : To make your website mobile friendly, you can make your website

a) Responsive

b) Reactive

c) Fast Loading

d) Light

Answer : a (Responsive)

Question 3 : What does CSS stand for

a) Current Style Sheets

b) Current Sheets Style

c) Cascading Style Sheets

d) Cascading Sheets Style

Answer : c (Cascading Style Sheets)

Question 4 : Which of the following statements is false

a) You can make a website without using HTML

b) You can make a website without using PHP

c) You can make a website without using CSS

d) You can make a website without using Javascript

Answer : a (You can make a website without using HTML)

Question 5 : What is WordPress

a) It is a software used to press text

b) It is a text formatting software

c) It is a CMS (Content Management System)


d) It is mail service

Answer : c (It is a CMS)

Question 6 : SQL stands for

a) Structured Query Language

b) Statistical Query Language

c ) Superior Questions Lot

d ) Standard Query Lot

Answer : a (Structured Query Language)

Question 7 : Which of the following is true about Javascript

a) It is a server side scripting language

b) It is client side scripting language

c) It is a Software

d) It is a database

Answer : b (It is client side scripting language)

Question 7 : Which of the following is true about PHP

a) It is a server side scripting language

b) It is client side scripting language

c) It is a Software

d) It is a database

Answer : a (It is a server side scripting language)

Question 8 : Which of the following is true

a) You need a server to host your website files

b) You don’t need a server to host your website files


c) You can create a website without using HTML

d) You can’t create a website without a CMS

Answer : a (You need a server to host your website files)

Question 9 : Which of the following softwares could be used to build a website

a) Power Point

b) Excel

c) Dream Weaver

d) ERP

Answer : c (Dream Weaver)

Question 10 : Which of the following is not a CMS

a) WordPress

b) Drupal

c) Magneto

d) SAP

Answer : d (SAP)

Question 11 : Which of the following statements is false about hosting

a) Shared hosting is cheaper than dedicated hosting

b) Shared hosting is safer than dedicated hosting

c) Dedicated hosting is safer than shared hosting

d) Though more expensive than shared hosting, Dedicated hosting is more secure

Answer : b (Shared hosting is safer than dedicated hosting)

Question 12 : Which of the following is not a web hosting company

a) Hostgator

b) Blue Host
c) WPX Hosting

d) Facebook

Answer : d (Facebook)

Question 13 : 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

Answer : c ( a & b)

Question 14 : Which of the following is true

a) Extensive use of Flash is bad from usability point of view

b) Design should be free from clutter

c) Looks are more important than Usability

d) a & b

Answer : d (a & b)

Which language is used for creating Web Pages?

(A) PASCAL

(B) C

(C) HTML

(D) BASIC

Ans: C

HTML

Question: 2
What is the abbreviation of HTTP?

(A) Hypertext tag path

(B) Hyper Text Transfer Protocol

(C) Hypertext transfer path

(D) None

Ans: B

Hyper Text Transfer Protocol

Question: 3

The entire web document is contained within ____

(A) Comments

(B) Tags

(C) Web page

(D) HTML element

Ans: D

HTML element

Question: 4

HTML document should begin with the ____

(A) <HEAD> tag

(B) <TITLE> tag

(C) <BODY> tag

(D) <HTML> tag

Ans: D

<HTML> tag

Question: 5
GIF is the abbreviation for ___

(A) Graphics Interchange Format

(B) Graphics Instruction Format

(C) Graphics Item Format

(D) Graphics Information Format

Ans: A

Graphics Interchange Format The <Font> tag is similar to ____

(A) <BIG>tag

(B) <SMALL>tag

(C) <MARQUEE>tag

(D) <BIG>and<Small> tags

Ans: D

<BIG>and<Small> tags

Question: 7

The HTML and HTTP standard are defined by ____

(A) Web client

(B) Internet association

(C) WWW consortium

(D) WWW

Ans: C

WWW consortium

Question: 8

The tag used to add images to the HTML document is ____

(A) <FONT>
(B) <HR>

(C) <HI>

(D) <IMG>

Ans: D

<IMG>

Question: 9

The ____ passes the information given by the user to a specified program.

(A) User

(B) Programmer

(C) Web server

(D) Browser

Ans: C

Web server

Question: 10

____ is used to store the data within the documents on the server.

(A) XML

(B) HTML

(C) DHTML

(D) CGI

Ans: A

XML
CGI stands for ___

(A) Common Gateway Internet

(B) Common Gateway Interface


(C) Central Gateway Interface

(D) Central Gateway Internet

Ans: B

Common Gateway Interface

Question: 2

____ is a collection of controls in HTML.

(A) Form

(B) Field

(C) Table

(D) Frame

Ans: A

Form

Question: 3

HTML allows us to create three different kinds of ___

(A) Functions

(B) Events

(C) Files

(D) Lists

Ans: D

Lists

Question: 4

____ files are more compact than the GIF files.

(A) .JPG and JPEG

(B) .JPG
(C) .JPEG

(D) None of the above

Ans: A

.JPG and JPEG

Question: 5

HTML allows us to use ___ levels of headings.

(A) Two

(B) Three

(C) Five

(D) Six

Ans: D

Six
Which is an attribute of Meta tag?

(A) Name

(B) Content

(C) Both (a) and (b)

(D) None

Ans: B

Content

Question: 7

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

Ans: B

Meta tag

Question: 8

Which character is used after the opening angular bracket to represent the closing tag?

(A) /

(B)

(C) |

(D) %

Ans: A

Question: 9

____ are ignored by browser.

(A) Title tag

(B) Comments

(C) Body section

(D) Head section

Ans: B

Comments

Question: 10

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

Ans: C

Microsoft Internet Explorer and Netscape Navigator


Which section of the Web page will contain Meta tags?

(A) Body section

(B) Heading section

(C) (a) or (b)

(D) None

Ans: B

Heading section

Question: 2

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

Ans: A

Selector and property

Question: 3

____ attribute is used to display an alternate message.

(A) Size

(B) ALT

(C) ALIGN

(D) SRC

Ans: B
ALT

Question: 4

Check boxes are used _____

(A) To enable option

(B) To disable option

(C) To create lists

(D) To enable or disable option

Ans: D

To enable or disable option

Question: 5

____ Icon displays list of fonts that can be used.

(A) Text Size Icon

(B) Italics

(C) Change Font Icon

(D) Bold

Ans: C

Change Font Icon


What is the birth date of Hypertext Documents?

(A) June 12, 1990

(B) June 15, 1990

(C) June 10, 1991

(D) June 12, 1991

Ans: D

June 12, 1991


Question: 7

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

Ans: B

Style tag

Question: 8

The attributes that are used with <MARQUEE>tag are ___

(A) SIZE

(B) BG COLOR

(C) DIRECTION

(D) BG COLOR and DIRECTION

Ans: D

BG COLOR and DIRECTION

Question: 9

The ___ attribute is used to specify the width of the table.

(A) CELLPADDING

(B) WIDTH

(C) CELLSPACING

(D) BORDER

Ans: B

WIDTH
Question: 10

Which one of the following indicates how light or dark a color appears on the web page?

(A) Value

(B) shade

(C) Hue

(D) Tint

Ans: A

Value 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

Hyper Text Transfer Protocol

Question: 2

The instructions indicated to the browser to display a document are called ___

(A) Codes

(B) Tags

(C) Programs

(D) Statements

Ans: B

Tags

Question: 3
The primary colors are ____

(A) Red, green, yellow

(B) Red, white, yellow

(C) Red, green, blue

(D) Red, yellow, blue

Ans: C

Red, green, blue

Question: 4

How many different colours can GIF contain?

(A) 64

(B) 156

(C) 256

(D) 264

Ans: C

256

Question: 5

Transferring your HTML code from one machine to server is known as ___

(A) Indexing

(B) Hosting

(C) Serving

(D) Sorting

Ans: B

Hosting
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

VALUE

Question: 7

Which of the following programs are likely to become very popular?

(A) HTML, XML

(B) OBJECT, Applet

(C) DHTML, XML

(D) HTML, DHTML

Ans: C

DHTML, XML

Question: 8

_____ contains the document itself.

(A) Structure

(B) Tag

(C) Head section

(D) Body section

Ans: D

Body section

Question: 9

Which of the following enables the computers around the world to be connected together?
(A) Assembler

(B) Compiler

(C) HTML document

(D) Internet

Ans: D

Internet

Question: 10

The popular browser used to surf the Internet is

(A) Netscape Composer

(B) Notepad

(C) Microsoft Internet Explorer

(D) Microsoft word

Ans: C

Microsoft Internet Explorer


Which is the formal description of message formats and rules to be followed by computers?

(A) Standards

(B) Protocol

(C) Syntax

(D) Language

Ans: B

Protocol

Question: 2

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

Ans: B

Web clients

Question: 3

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

Ans: B

Hyper Text Markup Language

Question: 4

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

Ans: C

Specify the space between cells

Question: 5

Interactive documents that can be created using a feature of HTML are called ____

(A) Tables

(B) Forms
(C) Files

(D) Frames

Ans: B

Forms
_____ are used to allow the user to select one of the options displayed.

(A) Radio buttons

(B) Text boxes

(C) Check boxes

(D) Password controls

Ans: A

Radio buttons

Question: 7

_____ is used to separate the attributes in the selected segment of a style tag.

(A) :

(B) ;

(C) ,

(D) *

Ans: B

Question: 8

The image tag is always used with _____ attribute.

(A) Size

(B) SRC

(C) Color
(D) Font

Ans: B

SRC

Question: 9

The _____ attribute specifies the bullet style.

(A) FONT

(B) COLOR

(C) TYPE

(D) SIZE

Ans: C

TYPE

Question: 10

RGB value for Red is

(A) FFOOFF

(B) FFFFFF

(C) FFOOOO

(D) FFFFOO

Ans: C

FFOOOO
What is the abbreviation of WWW?

(A) Wide Web World

(B) Win World Web

(C) Web Wide World

(D) World Wide Web

Ans: D
World Wide Web

Question: 2

Which of the following attributes specifies the name of the image file?

(A) Font

(B) SRC

(C) Color

(D) Size

Ans: B

SRC

Question: 3

A collection of images that are part of MS office is called a ___

(A) Web

(B) FrontPage Express

(C) Clipart

(D) Toolbar

Ans: C

Clipart

Question: 4

Software applications used for creating web pages and web sites are called as ___

(A) Web programs

(B) Web page editors

(C) Web master

(D) Web links

Ans: B
Web page editors

Question: 5

Which attribute is used to specify the colour to be used for links?

(A) BGCOLOR

(B) Link

(C) VLINK

(D) TEXT

Ans: B

Link _____ attribute can be added to make one of the options as the default option.

(A) SIZE

(B) CHECKED

(C) TYPE

(D) VALUE

Ans: B

CHECKED

Question: 7

Which of the following is the content of a document that includes text, pictures and links to
other related documents?

(A) Front Page

(B) Hyper Text

(C) Computer

(D) Software

Ans: B

Hyper Text
Question: 8

<HTML> is followed by how many sections?

(A) 2

(B) 3

(C) 4

(D) 6

Ans: A

Question: 9

_____ provides facilities required to link several related documents already stored on
computers.

(A) HTML

(B) Computer

(C) Software

(D) Internet

Ans: A

HTML

Question: 10

Name any one Web page editor program.

(A) HTML

(B) Ms Paint

(C) Notepad

(D) FrontPage

Ans: D

FrontPage
Who send the requisition for web pages to the web servers?

(A) Node

(B) System

(C) Web clients

(D) Web customer

Ans: C

Web clients

Question: 2

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

Ans: B

Meta tag

Question: 3

Which attribute can be used to change the colour of the links?

(A) Link

(B) ALINK

(C) VLINK

(D) All the above

Ans: D

All the above

Question: 4
The ___ option allows the user to specify a location on the web.

(A) Format

(B) From location

(C) Location

(D) Insert

Ans: B

From location

Question: 5

A popular way of linking many documents was ___

(A) Notepad

(B) SGML

(C) Gopher

(D) Computer

Ans: C

Gopher
Which indicates the beginning of an effect?

(A) Start tag

(B) End tag

(C) Tag

(D) None of the given

Ans: A

Start tag

Question: 7

Which option on the menu can be used to insert rows and columns?

(A) Insert
(B) Tool

(C) Table

(D) Format

Ans: C

Table

Question: 8

Which of the following achieves the effect of using script language?

(A) DHTML

(B) XML

(C) HTML

(D) CGI

Ans: A

DHTML

Question: 9

Forms are created by the attributes

(A) Action and Method

(B) Value and Method

(C) Method and Target

(D) Action and Target

Ans: A

Action and Method

Question: 10

Name any one text editor program.

(A) HTML
(B) FrontPage

(C) Notepad

(D) MS Paint

Ans: C

Notepad

1. State whether the given statement is true or false. !DOCTYPE is case sensitive”.
a) True
b) False
View Answer
Answer: b

2. Choose the correct statement.


a) In traditional XHTML close tag for some elements is optional but not encouraged
b) In traditional HTML close tag for some elements is optional but not encouraged
c) In both traditional XHTML and HTML close tag for some elements is not optional
d) In both traditional XHTML and HTML close tag for some elements is optional
View Answer
Answer: b

3. Which of the following XHTML doctype declaration contains all HTML elements and
attributes, including presentational and deprecated elements (like font) but not framesets?
a) !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”
b) !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”
c) !DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”
d) <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
View Answer
Answer: b

4. Which of the following is not a difference between HTML and XHTML?


a) Charset in html is “text/html” where as in xhtml it is “application/xml+xhtml”
b) Charset in both html and xhtml is “text/html”
c) Tags and attributes are case-insensitive in HTML but not in XHTML
d) Special characters must be escaped using character entities in XHTML unlike HTML
View Answer
Answer: b
Explanation: HTML is case insensitive while XHTML is case sensitive. In XHTML, special
characters can be escaped using character entites but not in HTML. Charset in HTML is
“text/html” where as it is “application/xml+xhtml” for XHTML.

5. What indicates the content in file is HTML when delivered on the network.
a) The extension of the file “.html”
b) The “content-type” header
c) Both “.html” extension and “content-type” header
d) The “content_type” header
View Answer
Answer: b
Explanation: Content-type: header indicates the content in the file is HTML and we can see
file content through it when delivered on the network. “.html” is the file extension for HTML.

6. State whether the given statement is true or false. “We can intermix XHTML and HTML
4.01 documents”
a) True
b) False
View Answer
Answer: b
Explanation: HTML is not in XML format. You have to make the changes necessary to make
the document proper XML before you can get it accepted as XML.

7. HTML and XHTML stands for ______


a) Hyper Text Markup Language and Extensible HyperText Markup Language
b) Hyper Text Markup Language and Extensible HyperText Marking Language
c) Hyper Text Marking Language and EXtensible HyperText Marking Language
d) Hyper Text Marking Language and Extensible HyperText Markup Language
View Answer
Answer: a
Explanation: HTML stands for “Hyper Text Markup Language” and XHTML stand for
“Extensible HyperText Markup Language”.

8. Choose the correct tag for the largest heading in HTML.


a) h6
b) heading
c) h1
d) head
View Answer
Answer: c
Explanation: Headings in HTML starts from <h1> to <h6> in which <h1> heading is the
largest one and <h6> is smallest one among those. The heading tags are <h1> <h2> <h3>
<h4> <h5> and <h6> that are used for the creations of headings.

9. Which of the following are table tags?


a) table, thead, tr, td
b) colspan, table, tr
c) table, tt, tr, td
d) thead, colspan, td, tr
View Answer
Answer: a
Explanation: Table has different tags such as table, thead, tr, td, etc whereas colospan is an
attribute of table.

10. Choose the correct HTML for width attribute and its value.
a) width=80
b) width=”80″
c) WIDTH=”80″
d) WIDTH=80
View Answer
Answer: b

1. 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
View Answer
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.
advertisement

2. XHTML is case insensitive and HTML is case sensitive.


a) True
b) False
View Answer
Answer: b
Explanation: Traditionally XHTML is case sensitive while HTML is case insensitive. In HTML
these are ignored by default by browsers.

3. What output do you expect if the following markup is rendered?

<strong>T e s t o f s p a c e s</strong><br>
<strong>T e s t &nbsp;o f&nbsp; s p a c e s </strong><br>

a) T e s t o f s p a c e s
Testofspaces
b) Testofspaces
Testofspaces
c) T e s t o f s p a c e s
T e s t  o f  s p a c e s
d) T e s t o f s p a c e s T e s t o f s p a c e s
View Answer
Answer: c
Explanation: The strong tag is used to highlight the importance of text/paragraph. <br> tag
is used for a line break in HTML. Ant white space between characters displays as a single
space.

4. Which of the following options follows content model in HTML?

i.<ul>
<p>Option one </p>
</ul>
ii.<ul>
<li>Option two </li>
</ul>

a) i
b) ii
c) i and ii
d) Neither i nor ii
View Answer
Answer: b
Explanation: Content model specifies that certain elements are supposed to occur only
within other elements. The <ul> tag which is for unordered list should contain <li> tags
which are for list specification. The <p> tag is used for paragraph in HTML.

5. Which of the following is not an empty element?

a) <hr/>
b) <br/>
c) <p/>
d) Both <hr/> and <br/>

View Answer
Answer: c
Explanation: An element is said to be empty if it doesn’t contain any content in it. The <hr/>
and <br/> tag which is used for a horizontal line and line break respectively, doen’t contains
any content in it and thus are called empty elements in HTML. <p> tag contains
text/paragraph in it so it’s not an empty element.

 
 
6. State true or false.

<p></p><p></p><p></p>produces numerous blank lines.

a) True
b) False
View Answer
Answer: b
Explanation: As a block tag, <p> induces a return by default, but when used repeatedly, like
<p></p><p></p>, it does not have any effect on document.

7. Which of the following markup is correct?

i. <b><i>is in error as tags cross</b></i>


ii. <b><i>is not since tags nest</i></b>

a) i
b) ii
c) i and ii
d) Neither i nor ii
View Answer
Answer: b
Explanation: In markup, tags can be nested. The first tag who is going to nest other tag
must end after that nested tag which means if <i> tag is nested in <b> tag then <b> must be
closed after closing of the <i> tag.

8. Which of the following is not a correct (X)HTML rule?


a) Attributes should be quoted
b) Tags should not nest tag
c) Attribute minimization is forbidden
d) Unknown attributes are not ignored by the browser
View Answer
Answer: d
Explanation: Rules of XHTML are as- 1) XHTML elements must be properly nested
2) XHTML elements must always be closed
3) XHTML elements must be in lowercase
4) XHTML documents must have one root element
5) Attribute names must be in lower case
6) Attribute values must be quoted
7) Attribute minimization is forbidden

9. Choose the incorrect escape character entity.

a) &gt;
b) &#62;
c) &lt;
d) &st;

View Answer
Answer: d
Explanation: Character escapes in markup is to represent any Unicode character in HTML,
XHTML or XML using only ASCII characters. There are different types of escape character
entity in HTML. Some of them are > which is used for greater than(>) , > is basically a entity
number which is used for greater than(>), < stands for less than(<), etc. There doesn’t exist
any &st escape character entity in markup.
 
 
10. Identify the count of mistakes in the following markup.

<html>
<head>
</head>
<body>
<li>
<ul><p>Hello</p></ul>
</li>
<br>
<hr>
</body>
</html>

a) 2
b) 3
c) 1
d) 0
View Answer
Answer: b

1. A Rendering engine is not responsible for ________


a) parsing the markup content (HTML)
b) parsing style information (CSS, XSL, and so on)
c) generating a visual presentation of the formatted content including media files referenced
d) parsing style information (CSS only)
View Answer
Answer: d
Explanation: A rendering engine is a software that draws text and images on the screen.
The engine draws structured text from a document (HTML, XML) and formats it properly
based on the given style declarations (CSS, XSL, etc). The primary job of a browser engine
is to transform HTML documents and other resources of a web page into an interactive
visual representation on a user’s device.

2. Firefox uses _________ rendering engine.


a) WebKit
b) Gecko
c) Trident
d) Presto
View Answer
Answer: b
Explanation: Gecko is a web browser engine used in many applications developed by
Mozilla Foundation and the Mozilla Corporation as well as in many other open source
software projects. Gecko is free and open-source software subject to the terms of the
Mozilla Public License version 2.

3. State true or false. It is faster to render HTML and CSS than to interpret and execute
JavaScript.
a) True
b) False
View Answer
Answer: a
Explanation: When it comes to ordering your CSS and JavaScript, you want your CSS to
come first. The reason is that the rendering thread has all the style information it needs to
render the page. If the JavaScript includes come first, the JavaScript engine has to parse it
all before continuing on to the next set of resources.
advertisement

4. What is the use of “defer” attribute?


a) It defers rendering of html page
b) It defers script execution until the page has been rendered
c) It defers rendering of css attributes
d) It is only for internal scripts
View Answer
Answer: b
Explanation: The defer attribute is a boolean attribute. The script is executed after the page
has finished parsing. The defer attribute is used if and only if there is src attribute. Defer is
for external not internal scripts.

5. Which of the following statements is false?


a) async and defer attributes of script tag execute before the DOMContentLoaded event
b) defer executes each script sequentially
c) async executes each script when it is ready
d) all older browsers supports async attribute
View Answer
Answer: d
Explanation: In async attribute, the script is executed asynchronously with the rest of the
page (the script will be executed while the page continues the parsing). Defer, the Boolean
attribute is set to indicate to a browser that the script is meant to be executed after the
document has been parsed, but before firing DOMContentLoaded event. Older browsers
doesn’t support async attribute.

6. Which of the following is used to read a HTML page and render it?
a) Web browser
b) Web server
c) Web matrix
d) Web network
View Answer
Answer: a
Explanation: A web browser (commonly referred to as a browser) is a software application
for retrieving, presenting and traversing information resources on the World Wide Web. A
web server process, store and display output to client as per their request. Web matrix is a
discontinued cloud-connected website builder and HTML editor for Windows.

7. Which of the following is the first web browser?


a) Nexus
b) Netscape Navigator
c) Internet Explorer
d) Mosaic
View Answer
Answer: a
Explanation: The first web browser was invented in 1990 called World Wide Web which was
later renamed to Nexus. In 1995, a graphical web browser named Internet Explorer was
developed. The Netscape is a web browser produced by Netscape Communications. NCSA
Mosaic, or Mosaic, is the web browser which in turn popularized World Wide Web.

8. Who created the first web browser


a) Tim Berners Lee
b) Jacobs, Lan
c) Marc Andeersen
d) Mozilla foundation
View Answer
Answer: a
Explanation: Sir Timothy John “Tim” Berners-Lee, also known as TimBL, is an English
computer scientist, best known as the inventor of the World Wide Web. He made a proposal
for an information management system in March 1989, and he implemented the first
successful communication between a Hypertext Transfer Protocol (HTTP) client and server
via the Internet sometime around mid-November of that same year.

9. Nexus is first graphical web browser.


a) True
b) False
View Answer
Answer: b
Explanation: Mosaic was the first browser to display images inline with text instead of
displaying images in a separate window, while often described as the first graphical web
browser.

10. The open source software version of netscape is _________


a) Chrome
b) Mozilla
c) Internet Explorer
d) Erwise
View Answer
Answer: b

1. Which of the following is not an IDE?


a) BlueGriffon 1.5.2
b) Aptana studio 3
c) TextEdit(Mac)
d) Dreamweaver
View Answer
Answer: c
Explanation: Dreamweaver is an Integrated Development Environment (IDE) tool. Aptana
Studio 3 is an open-source integrated development environment (IDE) used for web
applications. BlueGriffon 1.5.2 is an integrated development environment powered by
Gecko. TextEdit is a simple, open-source word processor.
2. IDE stands for _________
a) Internet Development Environment
b) Integrated Development Environment
c) Intelligent Development Environment
d) Integrated Developed Environment
View Answer
Answer: b
Explanation: An integrated development environment (IDE) or interactive development
environment is a software application that provides comprehensive facilities to computer
programmers for software development. An IDE normally consists of a source code editor,
build automation tools and a debugger.

3. We can define ________ number of sites with one copy of dreamweaver installed on our
computer.
a) 990
b) 10
c) only 1
d) unlimited
View Answer
Answer: d
Explanation: Dreamweaver is an IDE to build custom web apps and applications. There is
no definite liit to it.
advertisement

4. What should we add to a template in Dreamweaver in order to control where page


content goes?
a) Editable Regions
b) HTML controllers
c) Frames
d) Content Controllers
View Answer
Answer: a
Explanation: A template is a special type of document that you use to design a “fixed” page
layout; you can then create documents based on the template that inherit its page layout.
Editable template regions control which areas of a template-based page a user can
edit. Frames appear inside a web page.

5. Blue Griffon is based on ________ rendering engine.


a) WebKit
b) Gecko
c) Presto
d) Mecko
View Answer
Answer: b
Explanation: BlueGriffon is a new WYSIWYG content editor for the World Wide Web.
Powered by Gecko, the rendering engine of Firefox, it’s a modern and robust solution to edit
Web pages in conformance to the latest Web Standards. WebKit is a browser engine used
in safari. Presto is a dynamic engine.
6. Swapping images in dreamweaver is best if __________
a) The images are the same “Mime” type
b) The images are the same color
c) The images are the same size
d) You use the “Constrain” tool
View Answer
Answer: c
Explanation: Before you start creating a more complex page design with Dreamweaver’s
Swap Image behavior, look at a finished page. Swapping means replacing any or all images
on the page. While swapping images, it is important to make all images of same size (height
and width). MIME stands for “Multipurpose Internet Mail Extensions.

7. Choose the inappropriate option with respect to Blue Griffon 1.5.2. Blue Griffon
_________
a) includes tools for developing HTML5 pages
b) abstracts out many css3 effects
c) supports direct embedding of audio and video files
d) supports swapping of videos of any length
View Answer
Answer: d
Explanation: Blue Griffon 1.5.2 is a new WYSIWYG content editor for the World Wide Web.
Blue Griffon 1.5.2 includes tools for developing HTML5 pages. It can abstracts out many
CSS3 effects, supports direct embedding of audio and video files. Blue Griffon 1.5.2 does
not support swapping of videos of any length.

8. Maqetta is an open source initiative of the Dojo Foundation to geared towards visual
designers through a WYSIWYG user interface.
a) True
b) False
View Answer
Answer: a
Explanation: Maqetta is an open source initiative of the Dojo Foundation to build an HTML5-
based editor geared towards visual designers through a WYSIWYG user interface. Maqetta
was developed by IBM and then donated to the Dojo.

9. Choose the correct statement.


a) Exo is a cloud-based ide that offers collaboration and developed features
b) Exo does not support java and python
c) Exo does not support javascript and html5
d) Exo is a cloud-based ide that offers collaboration and deployment features & its supports
javascript and html5
View Answer
Answer: d
Explanation: Exo provides a free, cloud-based IDE that offers collaboration and deployment
features. In addition to HTML5 and JavaScript, it supports the development of Java, Ruby,
and Python applications.

10. Which of following statement is true?


i. Cloud9 has gained particular interest for its integration with GitHub and Bit Bucket
authentication integration and real-time collaboration.
ii. Cloud9 does not account for SSH and FTP access.
a) ii
b) i
c) i and ii
d) Neither i and ii
View Answer
Answer: b

1. Which of the following is not a web server?


a) Apache tomcat
b) BlueGriffon
c) Jetty
d) Tornado
View Answer
Answer: b
Explanation: Tornado is a web server written in python language. Eclipse is a web server
(Java HTTP server). Apache Tomcat, is a web server which is also known as Tomcat
server. BlueGriffon is an IDE.

2. Tomcat is an open source web server that provides a servlet container allowing you to
run Java code.
a) True
b) False
View Answer
Answer: a
Explanation: Apache Tomcat, a web server developed by the Apache Software Foundation
and which is also known as Tomcat Server. Apache Tomcat provides several Java EE
specifications such as Java Servlet, JavaServer Pages (JSP), Java EL, and WebSocket. It
also provides “Java” HTTP web server which is used to run java code.

3. Which of the following interface is not supported by LightTPD?


a) FastCGI
b) SCGI
c) GCGI
d) CGI
View Answer
Answer: c
Explanation: Interfaces like FastCGI, SCGI and CGI are supported by LightTPD to external
programs to be used with the server.
advertisement
      
volume is gedempt

4. Which of the following is not a prepackaged server stack?


a) WAMP
b) XAAMP
c) MAMP
d) NAMP
View Answer
Answer: b
Explanation: Collection of software that forms operational infrastructure is a server stack.
WampServer refers to a software stack.XAMPP is prepackaged stack developed by Apache
Friends. To run dynamic web sites on computers, a solution stack known as MAMP is used.
There is nothing like NAMP.

5. Which of the following is not a channel of mozilla?


a) Firefox
b) Firefox alpha
c) Firefox Beta
d) Firefox Aurora
View Answer
Answer: b
Explanation: Mozilla Foundation & Corporation developed a open source web browser
named Mozilla Firefox. Later on, new version of mozilla arrived in market, which are named
as Firefox Beta & Firefox Aurora respectively. Firefox alpha is not a channel of mozilla.

6. Google Chrome has its own task manager, which allows you to view and manage your
memory and CPU usage.
a) True
b) False
View Answer
Answer: a
Explanation: A task manager provides many functions to us including, managing
applications, handling running pc, providing informative statistics, enabling computer on or
off, etc. Google Chrome also has a task manager, which allows you to view and manage
your memory and CPU usage.

7. Which of the following are automatically loaded and operates as a part of browser?
a) Add-ons
b) Plug-ins
c) Utilities
d) Widgets
View Answer
Answer: b
Explanation: Functionality of firefox can be extended as well as modified by using Add-ons.
Plugin programs operates as a part of browser. A utility provides an addition to the
capabilities provided by the operating system. A widget is a simple application extension
that is already installed on the device.

8. Which of the following allows user to view a webpage?


a) Operating System
b) Website
c) Interpreter
d) Internet Browser
View Answer
Answer: d
Explanation: An interpreter is a computer program that directly executes, instructions written
in a programming or scripting language. A website is a collection of related web pages,
which contains multimedia content. An operating system is a balancing bridge between
hardware and software. A web/internet browser allows user to view a webpage

9. What is DOM?
a) Hierarchy of objects in ASP.NET
b) Application programming interface
c) Convention for representing and interacting with objects in html documents
d) Language dependent application programming
View Answer
Answer: c
Explanation: The Document Object Model is a cross-platform and language-independent
application programming interface that treats an HTML, XHTML, or XML document as a
tree structure. A document can be viewed as a logical tree with help of DOM Model.

10.

<meta http-equiv="X-UA-Compatible" content="IE=8"> is used to _________

a) make web page compatible only with IE8


b) mimic behaviour of IE8
c) make web page incompatible only with IE8
d) make web page compatible with IE7 and IE8
View Answer
Answer: b

1. Which one of the following is an open source JavaScript library that enables styling for
HTML5 elements in versions of Internet Explorer before IE 9 ?
a) HTML5
b) HTML5 Shiv
c) HTML5 Shim
d) HTML5 Sham
View Answer
Answer: b
Explanation: HTML5 Shiv is a JavaScript workaround, invented by Sjoerd Visscher, to
enable styling of HTML5 elements in versions of Internet Explorer prior to version 9, which
do not allow unknown elements to be styled without JavaScript. HTML 5 defines the
properties and behaviors of web page content. It is a web language.

2. Which one of the following is not a step to install a library you need to perform the
compatibility in browsers?
a) Download the library from the github location
b) Uncompress the file
c) Insert the following code inside the head tag
d) None of the mentioned
View Answer
Answer: d
Explanation: All steps are required.
3. Which property is used to detect the browser’s user agent and code based on the
pertinent cases?
a) navigator.userAgent
b) navigator.user
c) navigator
d) return
View Answer
Answer: a
Explanation: An old strategy was to look at the property navigator.userAgent to detect the
browser’s user agent and code based on the pertinent cases.
advertisement

4. Some users have requested tests for IE’s float double margin bug, and support for
position:fixed. Which API is suitable for them?
a) mq() media Plugin API
b) addTest() Plugin API
c) testAllProps() Plugin API
d) none of the mentioned
View Answer
Answer: b
Explanation: The navigator object contains information about the browser. UseAgent
property gives user-agent header sent by browser to the server. A navigator.userAgent is
used to detect the browser’s user agent and code based on the pertinent cases.

5. ___________ is an open source JavaScript library that allows support for different levels
of experiences based on the capabilities of each browser.
a) Navigator
b) Modernizr
c) Geolocation
d) Google API
View Answer
Answer: b
Explanation: Modernizr is an open source JavaScript library that allows support for different
levels of experiences based on the capabilities of each browser using a simple feature
detection model. Geolocation is the identification of geographic location of an object. The
navigator object contains information about the browser. Google API, i.e set of application
programming interface which allow communication with Google Services & integration to
other services.

6. ____________ allows you to add custom styles to the document and test an element
afterwards.
a) hasEvent()
b) testAllProps()
c) testProp()
d) modernizr.testStyles()
View Answer
Answer: d
Explanation: Modernizr.testStyles() allows you to add custom styles to the document and
test an element afterwards. An element with the id of “modernizr” is injected into the page.
7. Modernizr does actually add missing functionalities to browsers save for the HTML5 tags
styling support.
a) True
b) False
View Answer
Answer: b
Explanation: Modernizr is a JavaScript library which is designed to detect HTML5 and CSS3
features in various browsers, which lets JavaScript avoid using unimplemented features or
use a workaround such as a shim to emulate them. Modernizr, in spite of its name, does not
actually add missing functionalities to browsers save for the HTML5 tags styling support.

8. ___________ is used to test whether geolocation is supported in old browsers.


a) Modernizr
b) Modernizr.geolocation
c) Navigator.userAgent
d) Modernizr.js
View Answer
Answer: c
Explanation: Since Modernizr is a JavaScript object with methods, we can use
Modernizr.geolocation to test whether geolocation is supported. Geolocation API Detects
support for the Geolocation API for users to provide their location to web applications.

9. ____________ is a resource loader (CSS and JavaScript) that was made to specifically
to work side-by-side with Modernizr.
a) HasEvent()
b) Navigator.userAgent
c) Modernizr.load
d) Modernizer.geolocation
View Answer
Answer: c
Explanation: Modernizr.load is optional in your build, but if you are loading polyfills, there’s a
good chance it can save you some bandwidth and boost performance a bit. Modernizr.load
objects print out on your page in the exact spot they should be, coming after the Modernizr.

10. In case we want to implement a JavaScript fallback, we would need to create a


conditional statement using Modernizr.
a) True
b) False
View Answer
Answer: a

1. Metadata store information about the web page that is not necessarily visible to end
users.
a) True
b) False
View Answer
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).

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

3. Which of the following is not a function of robots meta tag?


a) noindex
b) nofollow
c) norepeat
d) noarchive
View Answer
Answer: c
Explanation: Valid values for the “CONTENT” attribute are: “INDEX”, “NOINDEX”,
“FOLLOW”, “NOFOLLOW”, “NOARCHIVE”. “NOREPEAT” is not any of robots meta tag.
advertisement

4. 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
View Answer
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.

5. __________ prevents the page from being indexed altogether.


a) noarchive
b) nofollow
c) noindex
d) novalue
View Answer
Answer: c
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. The
noindex value of an HTML robots meta tag requests that automated Internet bots avoid
indexing a web page.
6. Which of the following is not supported in HTML5?
a) scheme
b) content
c) http-equiv
d) name
View Answer
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.

7. ___________ prevents search engines from following links inside the page.
a) noarchive
b) nofollow
c) noindex
d) novalue
View Answer
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.

8. Different meta tags are defined by changing the __________ attribute to a valid value.
a) scheme
b) content
c) http-equiv
d) name
View Answer
Answer: d
Explanation: The information/value of the content is provided by http-equiv through http
header. Some values associated with http-equiv and name attribute are given by the
content attribute. A scheme that to be used to interpret the value of the content is specified
by the scheme tag. The name attribute specifies the name of input element and thus
provides information/value of it.

9. __________ prevents search engines from showing a cached link for the page.
a) nobot
b) nofollow
c) noarchive
d) nosearch
View Answer
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.

10. The value of the ___________ attribute refers to the time interval in seconds before the
refresh is performed.
a) scheme
b) content
c) http-equiv
d) name
View Answer
Answer: b

1. __________ is an HTML specification used to add more information to HTML tags.


a) Macrodata
b) Microdata
c) Minidata
d) Modifydata
View Answer
Answer: b
Explanation: The Microdata spec provides a standardized syntax for additional semantic
markup to your web pages to enhance the machine readability of your web pages. The
planning for distribution center operation is offered by minidata. Macrodata and Modifydata
are not any terms related to HTML5.

2. The microdata model consists of groups of name-value pairs known as ________


a) Item
b) Property
c) Value
d) URL
View Answer
Answer: a
Explanation: The microdata model consists of groups of name-value pairs known as items.
Each group is known as an item. Each item can have item types, a global identifier (if the
vocabulary specified by the item types support global identifiers for items), and a list of
name-value pairs. A Uniform Resource Locator, called URL, termed as web address and is
used for a reference to a web resource for finding its location. Property is information about
a particular id or else attribute.

3. Every HTML element may have an ____________ attribute specified.


a) itemtype
b) relevant types
c) itemscope
d) itemref
View Answer
Answer: c
Explanation: “itemtype” attribute specifies URL that is used to provide item’s data in data
structure. An element with the itemscope attribute specified creates a new item, a group of
name-value pairs.
advertisement

4. Which of the following is true if the property value of a name-value pair added by an
element with an itemprop attribute is a meta element?
a) The value is the item created by the element
b) The value is the value of the element’s value attribute, if it has one, or the empty string
otherwise
c) On getting, if the element has a datetime content attribute, the IDL attribute must return
that content attribute’s value
d) The value is the element’s textContent
View Answer
Answer: b
Explanation: When the property value of a name-value pair added by an element with an
itemprop attribute which is a meta element then the value is the value of the element’s value
attribute, if it has one, or the empty string otherwise. The “itemprop” attribute is a global
attribute which adds properties to item.

5. Which of the following is true if the property value of a name-value pair added by an
element with an itemprop attribute is a time element?
a) The value is the element’s datetime value
b) The value is the value of the element’s content attribute, if any, or the empty string if
there is no such attribute
c) The value is the value of the element’s value attribute, if it has one, or the empty string
otherwise
d) The value is the element’s textContent
View Answer
Answer: a
Explanation: The “itemprop” attribute is a global attribute which adds properties to item.
When the property value of a name-value pair added by an element with an itemprop
attribute which is a time element then the value is the element’s datetime value.

6. The ___________ of an item is the value of its element’s itemid attribute.


a) token
b) typed item
c) global identifier
d) scope
View Answer
Answer: c
Explanation: The global identifier of an item is the value of its element’s itemid attribute, if it
has one, resolved relative to the element on which the attribute is specified. If the itemid
attribute is missing or if resolving it fails, it is said to have no global identifier. The “typed
item” creates new item.

7. If the element has an itemscope attribute, it returns an __________ object with all the
element’s properties.
a) itemscope
b) dom object
c) collection.namedItem
d) itemtype
View Answer
Answer: b
Explanation: When an HTML document is loaded into a web browser, it becomes a
document object. In web browser, document model represents document as a logical tree.
The “itemscope” attribute which is of boolean type is used to state the scope of metadata.
8. Which of the following is true if the property value of a name-value pair added by an
element with an itemprop attribute is a data element?
a) The value is the value of the element’s value attribute if it has one, or the empty string
otherwise
b) The value is the item created by the element
c) The value is the element’s datetime value
d) The value is item’s scope
View Answer
Answer: a
Explanation: The “itemprop” attribute is a global attribute which adds properties to item.
When the property value of a name-value pair added by an element with an itemprop
attribute which is a data element then the value is the value of the element’s value attribute
if it has one, or the empty string otherwise.

9. Which method takes a string that contains an unordered set of unique space-separated
tokens that are case-sensitive, representing types?
a) document.getItems
b) element.itemProp
c) collection.namedItem
d) object.itemref
View Answer
Answer: a
Explanation: When called, the method must return a live NodeList object containing all the
elements in the document, in tree order, that are each top-level microdata items whose
types include all the types specified in the method’s argument, having obtained the types by
splitting the string on spaces.

10. The goal of microdata is to create a unified way to define the data in a way any web
crawler or reader implementation can read it.
a) True
b) False
View Answer
Answer: a

1. Which of the following applications/software can be used to create a favicon?


a) Unity
b) Adobe Photoshop
c) Dreamweaver
d) VLC
View Answer
Answer: b
Explanation: Favicon means favorite icon. To create a favicon, we can use any graphics
editor program in the market such as Adobe Photoshop or Fireworks.

2. By default, iOS adds ____________ effects to icons.


a) reflective shine
b) square corners and reflective shine
c) rounded corners and reflective shine
d) apple trademark
View Answer
Answer: c
Explanation: Most of these icons are beautifully designed, and after Apple introduced a new
meta tag named apple-touch-icon you can now display website icons on the iOS home
screen when you bookmark a site. By default, IOS adds rounded corners with reflective
shine.

3. Favicon stands for ______


a) Fave icon
b) Favorite icon
c) Both Fave icon and Favorite icon
d) Fav icon
View Answer
Answer: c
Explanation: A favicon which is also known as a shortcut icon, Web site icon, tab icon, Fave
icon and also a Favorite icon. It is associated with a particular website or a web page.
Favicon is a graphical representation for a site.
advertisement

4. Which attribute is used for favicon?


a) icon
b) title
c) rel
d) head
View Answer
Answer: c
Explanation: Favicon is associated with a particular website or a web page. Favicon is a
graphical representation for a site. The “rel” attribute is used for favicon generation. The
syntax is
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />

5. Which image file format is not supported in Firefox?


a) MNG
b) PNG
c) SVG
d) APNG
View Answer
Answer: a
Explanation: There are different file formats such as MNG stands for “Multipe-image
Network Graphics”, PNG stands for “Portable Network Graphics”, SVG stands for “Scalable
Vector Graphics”, APNG stands for “Animated Portable Network Graphics” etc. Many
browsers have theri own criteria to support those types of files. Among those, Firefox
browser suuport PNG, APNG files, it also supports SVG partially. The MNG file format is not
supported in Firefox.
6. The favicon was standardized by the _______
a) IANA
b) W3C
c) WIPO
d) EPO
View Answer
Answer: b
Explanation: In december 1999, the favicon was standardized by W3C i.e World Wide Web
Consortium. IANA is Internet Assigned Numbers Authority. WIPO stands for World
Intellectual Property Organization and EPO for European Patent Office.

7. In 2003, the .ico format was registered with the ____________


a) IANA
b) W3C
c) WIPO
d) EPO
View Answer
Answer: a
Explanation: In 2003, the .ico format was registered with the Internet Assigned Numbers
Authority (IANA) under the MIME type image/vnd.microsoft.icon. W3C is World Wide
Consortium which standardized facicon for HTML 4.01 recommendation. WIPO stands for
World Intellectual Property Organization and EPO for European Patent Office.

8. The recommended basic size for a favicon is ___________ pixels.


a) 16×16
b) 26×26
c) 48×48
d) both 16×16 and 48×48
View Answer
Answer: d
Explanation: Facicon is a graphical representation of a site which stands for favorite icon.
The basic size for a favicon varies from 16×16 pixels, 32×32 pixels, 48×48 pixels etc in ICO
image file format.

9. In March 1999, Microsoft released Internet Explorer 5, which supported favicons for the
first time.
a) True
b) False
View Answer
Answer: a
Explanation: Favicons are graphical interface given to a site. Firstly, in 1999, favicon was
supported by Internet Explorer 5 which was owned by Microsoft. Later on, in 1999 favicon
was standardized by the W3C.

10. A favicon is an image used by the browser to identify a website or web application.
a) True
b) False
View Answer
Answer: a
1. Which tag is used if you want to highlight something that is important to the reader?

a) <b>
b) <strong>
c) <em>
d) <i>

View Answer
Answer: a
Explanation: : The <b> tag is used to make the text bold. The <strong> tag is used to
highlight the importance of text. The <em> tag is emphasis tag and is displayed in italic by
browser. <i> tag is used to write text in italic font.

 
 
2. Which tag is not used if you want to indicate the importance of the phrase?
a) <i>
b) <h1>
c) <em>
d) <strong>

View Answer
Answer: a
Explanation: Tags like <h1> (including all headings from h1 to h6), <em> and <strong> can
be used to indicate the importance of the phrase. The <i> is none other than a type of font
displaced in italic bond by the browsers.

 
 
3. Which of the following statement is not true?
a) XHTML DOCTYPE is mandatory
b) The xmlns attribute in <html> is mandatory
c) <html>, <head>, <title>, and <body> are mandatory
d) None of the mentioned

View Answer
Answer: d
Explanation: XHTML is a markup language. There are certain terms and conditions (rules
and regulations) for it. There are as: 1) In XHTML, the DOCTYPE is compulsory, 2) Xmlns
attribute in <html> in manndatory, 3) The basic building blocks of markup i.e. <html>,
<head>, <title>, and <body> are must in one. 4) Last but not least, XHTML is case sensitive
where as HTML is case in-sensitive.

 
 
4. According to the rules of XML and XHTML, all elements must be closed either with an
end tag or by self-closing with space, slash, and a right-pointing angle bracket.
a) True
b) False
View Answer
Answer: a
Explanation: XML and XHTML are markup languages used for creating web pages. XHTML
is case sensitive, and thus they must be closed either an end tag or by self-closing with a
space, slash, and a right pointing angle bracket. Ex) <p></p> is paragraph tag closed with
ending tag. <br/> is break tag whose closing is done either by a slash or right pointing angle
bracket.
advertisement

5. __________ is the XML equivalent to strict HTML 4.01.


a) XHTML 1.0 Strict
b) XHTML 1.0 Frameset
c) XHTML 1.0 Transitional
d) XHTML 1.1 Strict
View Answer
Answer: a
Explanation: XML is a markup language while XHTML is a extensible hypertext markup
language. XHTML 1.0 Strict is the XML equivalent to strict HTML 4.01, and includes
elements and attributes that have not been marked deprecated in the HTML 4.01
specification.

6. Which of the following statement is true?


a) Attribute names must be in uppercase
b) Attribute values must be quoted
c) Attribute minimization is mandatory
d) Attribute values should not be quoted
View Answer
Answer: b
Explanation: HTML is hypertext markup language. There are many rules and regulations in
HTML for attribute specification. HTML is case in-sensitive and thus we can write attribute
name in either uppercase or lowercase, none of it is going to make difference. There is
nothing like that atrribute name should be minimized, we can write attribute name as long
as and as short as we want. The only rule for attribute name is that it should be in quoted
form.

7. The root element of an XHTML document must be html, and must contain an
__________ attribute to associate it with the XHTML namespace.
a) source
b) src
c) xmlns
d) link
View Answer
Answer: c
Explanation: The xmlns attribute specifies the xml namespace for a document. It is
manadatory in XHTML while in HTML5 it is optional. The root element of an XHTML
document must be html, and must contain an xmlns atrribute to associate it with the XHTML
namespace.

8. Which of the following encoding an XML parser assumes?


a) UTF-8
b) UTF-16
c) UTF-32
d) Both UTF-8 and UTF-32
View Answer
Answer: d
Explanation: Basically parsers are used in softwares and they convert user data into
machine data in short in memory form to use. In XML, parser is used to read XML. If an
XML document lacks encoding specification, an XML parser assumes that the encoding is
UTF-8 or UTF-16.

9. __________ is an extended version of the XHTML markup language for supporting RDF
through a collection of attributes and processing rules in the form of well-formed XML
documents.
a) XHTML + RDFa
b) XHTML+XHTML5
c) XHTML1.0+XHTML2.0
d) XHTML + RDF
View Answer
Answer: a
Explanation: XHTML+RDFa (Extensible Hypertext Markup Language + Resource
Description Framework in attributes) is an extended version of the XHTML markup
language for supporting RDF through a collection of attributes and processing rules in the
form of well-formed XML documents.

10. XML is a markup language where documents must be marked up correctly.


a) True
b) False
View Answer
Answer: a

1. Which feature was already introduced before HTML5?


a) Canvas/SVG
b) Video
c) Geolocation
d) Frames
View Answer
Answer: d
Explanation: Until recently you could not draw on the web and graphics were not very
interactive but canvas/SVG which were introduced by HTML5 solved all the problems.
Video, Geolocation were also new features introduced by HTML5. Frames were already
there before the launch of HTML5.

2. Which tag is used with JavaScript?


a) <canvas>
b) <table>
c) <article>
d) <footer>
View Answer
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.

3. What application can one create even before the introduction of HTML5?
a) Web applications
b) Mobile applications
c) Forms
d) Browser based games
View Answer
Answer: c
Explanation: With the help of HTML5 and JavaScript it became possible to create excellent
mobile applications, browser based games, web applications and many more other
applications. Forms were already introduced before HTML5.
advertisement

4. What is the correct syntax of doctype in HTML5?


a) <!doctype html>
b) <doctype html!>
c) <doctype html>
d) </doctype html>
View Answer
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.

5. 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
View Answer
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.

6. Which of the following is not semantic element for text in HTML5?


a) <mark>
b) <time>
c) <wbr>
d) <article>
View Answer
Answer: d
Explanation: Semantic elements used for text are <mark>, <time>, <wbr> whereas
<article>, <aside>, <figure>, <footer>, <header> etc. are the semantic elements for
structuring a page in HTML5.
7. Which tag supports Non-English language?
a) <input>
b) <audio>
c) <embed>
d) <bdo>
View Answer
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.

8. Which element was not removed by HTML5?


a) <strike>
b) <center>
c) <small>
d) <big>
View Answer
Answer: c

1. Which of the following defines the title of a work?


a) <cite>
b) <hr>
c) <a>
d) <address>
View Answer
Answer: a
Explanation: The <cite> tag defines the title of a work. The <hr> tag is used to give a
horizontal break. When we want to link one page to another, then <a> tag is used. The
<address> tag is used to define the contact information about owner of document.

2. Which element is design to wrap a single piece of information?


a) <time>
b) <nav>
c) <footer>
d) <header>
View Answer
Answer: a
Explanation: <time> tag wrap single piece of information i.e. it defines date, month and
year. The <nav> element identifies a set of navigation links, <footer> is introduced in
HTML5 which is present at the end of page and do conatins footer information i.e copyright
information.

3. What an article element should not contain?


a) Main element
b) Text or embedded content
c) Image
d) Video & Audio
View Answer
Answer: a
Explanation: The <main> element must NOT be a descendant of an <article>, <aside>,
<footer>, <header>, or <nav> element. The article element may contain audio/video clips,
images and also text or embedded content.
advertisement

4. Which of the following statement is true?


a) Canvas Contains built-in animations
b) SVG needs scripts to draw elements
c) In canvas, drawing is done with pixels
d) SVG don’t support to event handlers
View Answer
Answer: c
Explanation: In SVG drawing is done with vectors and it support event handlers. Canvas
doesn’t contains any built-in-animations and drawing is done with pixels.

5. What does <main> include?


a) Header
b) Sidebar
c) Article
d) Footer
View Answer
Answer: c
Explanation: <header> element contains navigation links. Slidebar is for hoverable/sliding
text. <footer> is introduced in HTML5 which is present at the end of page and do contains
footer information i.e copyright information. Main content is the entire article which wraps
the <article> element. It holds the page’s main content. It can be useful for screen readers.
E.g. <main> <article>…………</article> </main>

6. Which of the following is not sectioning elements?


a) <article>
b) <aside>
c) <nav>
d) <header>
View Answer
Answer: d
Explanation: The <section> element represents a section of a document or application.
Tags like <article>, <aside>, <nav>, <section> are the ones that create a nested, new
outline inside the page.

7. How many times can HTML5 events be fired?


a) Multiple
b) One
c) Only two
d) Zero
View Answer
Answer: a
Explanation: We can call events like drag, ondragover, etc multiple times in HTML5.

8. Which element is used to get highlighted text in HTML5?


a) <highlight>
b) <b>
c) <mark>
d) <u>
View Answer
Answer: c

1. In OSI model USB lies under the layer ___________


a) data Link layer
b) physical layer
c) network layer
d) transport layer
View Answer
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.

2. IP is used in the level ___________


a) presentation layer
b) network layer
c) application layer
d) data Link layer
View Answer
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.

3. Which one is not the feature of HTTP protocol?


a) media independent
b) connectionless
c) responsive
d) stateless
View Answer
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.
advertisement

4. Which of the following are not the valid character set in HTTP?
a) ISO-8859-1
b) US-ASCII
c) ISO-8859-7
d) ISO-8859-12
View Answer
Answer: d
Explanation: A character set must know to web browsers to display HTML pages correctly.
For the preference of clients we use character sets for specifying characters. The default
value is US-ASCII. The valid character sets are ISO-8859-1, US-ASCII or ISO-8859-7.

5. Which one is the correct syntax for specifying media type?


a) type ”/” subtype *( “;” parameter)
b) subtype ”/” type *(“;” parameter)
c) parameter “/” type *(“;” subtype)
d) (“;” subtype) “/” type *(parameter)
View Answer
Answer: a
Explanation: Internet media types are used in Content-Type and Accept header fields.
Media types are registered with IANA (Internet Assigned Number Authority). The syntax for
a media type is m-type = type “/” subtype *(“;” parameter). The name of subtype, type and
parameter attribute all are case sensitive.

6. Which header field defines meta information?


a) Request-header
b) Response-header
c) General-header
d) Entity-header
View Answer
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.

7. Which of the following is not the request method?


a) Head
b) Get
c) Remove
d) Put
View Answer
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.

8. Which symbol is used when HTTP request does not apply to the particular source?
a) ‘&’
b) ‘*’
c) ‘#’
d) ‘@’
View Answer
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
9. Which of the following is not a request-header field?
a) Expect
b) Host
c) Delete
d) If-None-Match
View Answer
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.

10. What does ‘3xx’ code denote?


a) Redirection
b) Server Error
c) Success
d) Informational
View Answer
Answer: a
Explanation: ‘3xx’ means Redirection, any further action have to be taken for completing the
request. ‘1xx’ is for Informational, it signifies that the request was received and the process
is going on. ‘2xx’ denotes Success, which signifies the action was successfully understood,
received and accepted.

11. Which of the following is not a response-header field?


a) Location
b) Server
c) ETag
d) Referer
View Answer
Answer: d

1. Which of the following element represents a thematic break rather than a horizontal rule,
though that is the likely representation?

a) <dd>
b) <dt>
c) <hr>
d) <menu>

View Answer
Answer: c
Explanation: The <dd> & <dt> tag defines names/terms. <menu> tag in HTML is for list of
commands. The hr tag defines a thematic break in an HTML page (e.g. a shift of topic).
Thematic is break between paragraph-level elements.

 
 
2. Which of the following element was redefined to represent user interface menus,
including context menus?
a) <ul>
b) <dt>
c) <hr>
d) <menu>

View Answer
Answer: d
Explanation: <dt> tag defines terms/names. The <hr> tag is used for thematic break
between paragraph-level. <ul> tag is used to represent list of items/objects. <menu> tag in
HTML is for list of commands. The menu tag is used for context menus, toolbars and for
listing form controls and commands.

 
 
3. Which of the following HTML 4 attributes is not removed in HTML5?
a) text
b) rules
c) link
d) mark
View Answer
Answer: d
Explanation: Mark attribute is still used in HTML5 but rest of attributes i.e. text, rules, link
are deprecated in HTML5.
advertisement

4. Which of the following element is not removed by HTML5?


a) vlink
b) span
c) marginwidth
d) compact
View Answer
Answer: b
Explanation: A <span> element (used to color a part of a text) is still used in HTML5.
Elements like vlink, marginwidth and compact has been removed in HTML5, which were
part of HTML markup. In earlier they have been deprecated.

5. Which of the following is not a newly added element in HTML5?


a) article
b) audio
c) nav
d) frameset
View Answer
Answer: d
Explanation: An article tag is semantic element newly introduced in HTML5 along with nav
and audio. Frameset was already introduced in HTML markup used to divide window/web
page in frames.

6. ____________ defines the accelerator key to be used for keyboard access to an


element.
a) data-X
b) accesskey
c) rp
d) command
View Answer
Answer: b
Explanation: Command tag specifies a command provided with action. When one want to
provide parentheses around ruby text, rp tag is used. The accesskey attribute specifies a
shortcut key to activate/focus an element. Data-X stores data.

7. Which of the following element represents the header of a section or the document and
contains a label or other heading information for the related content?
a) data-X
b) header
c) mark
d) meter
View Answer
Answer: b
Explanation: Data-X element consist of data. The mark element indicates
highlighted/marked text. The header element represents a container for introductory content
or a set of navigational links.

8. Which of the following element sets is an item of metadata?


a) itemscope
b) itemref
c) itemtype
d) none of the mentioned
View Answer
Answer: a
Explanation: Itemscope is a boolean global attribute that defines the scope of associated
metadata. The itemscope attribute creates a new item, a group of name-value pairs. The
URL of vocabulary is specified by itemtype global attribute. List of element ID’s is provided
by itemref.

9. _____________ defines a group of content that should be used as a figure and may be
labeled by a legend element.
a) figure
b) details
c) output
d) aside
View Answer
Answer: a

1. Which element is used to define a discrete unit of content such as a blogpost, comment,
and so on?
a) section
b) class
c) article
d) media
View Answer
Answer: c
Explanation: Sections in document is made by the section tag. The class attribute specifies
one or more class names to HTML. An article element is semantic element and it contains a
standalone piece of content that would make sense if syndicated as an RSS item, for
example a news item.

2. HTML5 documents may contains a ___________ element, which is used to set the
header section of a document.
a) header
b) footer
c) section
d) drive
View Answer
Answer: a
Explanation: Section element is used to make sections in document. The copyright/footer
information is provided by footer element in HTML5. A header for document section is given
by header element. The header tag is used to contain the header content of a site.

3. Which element may be used within content to represent material that is tangential?
a) aside
b) cite
c) article
d) class
View Answer
Answer: a
Explanation: <cite> tag defines the title of work. The class attribute specifies one or more
class names to HTML. An article tag is similar to <section> or <header> which contains
information. The aside tag defines a block of content that is related to the main content
around it, but not central to the flow of it.
advertisement

4. ____________ contains the navigation menu, or other navigation functionality for the
page.
a) section
b) header
c) nav
d) aside
View Answer
Answer: c
Explanation: The nav element is for marking up the navigation links or other constructs (eg
a search form) that will take you to different pages of the current site, or different areas of
the current page. Header contains section of headings. Section element is used to make
sections in document. The aside tag defines a block of content that is related to the main
content around it, but not central to the flow of it.

5. Which of the following attribute is used to display date/time content?


a) time
b) datetime
c) date
d) year
View Answer
Answer: b
Explanation: To provide both human and machine-friendly date/time content, the element
supports a datetime attribute, which should be set to the previously mentioned date format
of YYYY-MM-DDThh:mm:ssTZD. Time tag defines date and time (human readable) while
datetime tag display machine readable date/time.

6. The element ___________ simply groups items within an enclosed dd tag, though it may
associate them with a caption defined by a dt tag.
a) object
b) figure
c) embed
d) collect
View Answer
Answer: a
Explanation: HTML documents are delivered as “documents”.These are then parsed, which
turns them into the Document Object Model (DOM) internal representation, within the web
browser. A self-contained information like images, diagrams are specified by figure tag in
HTML. External applications are embed using embed tag.

7. Which of the following element is used for highlighting content similarly to how a
highlighter pen might be used on important text in a book?
a) em
b) strong
c) mark
d) bold
View Answer
Answer: c
Explanation: <em> tag convert the font in italic one. The <strong> tag is used to denote the
importance of text. <bold> tag is used to make the text bold in font size. The mark tag
defines marked text and is used to highlight parts of your text.

8. To insert a video, we use a video tag and set its src attribute to a local or remote URL
containing a playable movie.
a) True
b) False
View Answer
Answer: a
Explanation: To show a video in HTML, video element is used. One of the attribute of video
called src is used to provide the location of video i.e. it’s URL address.

9. Which tag is used to encapsulate navigation and then style the elements appropriately as
menu items?
a) ul
b) li
c) nav
d) both ul and li
View Answer
Answer: d

1. __________ can be used to advise the browser to download media content in the
background to improve playback.
a) poster
b) autobuffer
c) buffer
d) data-X
View Answer
Answer: b
Explanation: Data-X stores custom data. Buffer property is used to decide whether the
output should be buffered or not. If autobuffering attribute is used, then the video will
automatically begin to buffer even if it’s not set. It suggests to the browser that it should load
as much of the resource as possible. As long as the browser’s own media cache isn’t full, it
will keep on downloading. URL of an image is given by poster attribute until the user seek
for it.

2. The _________ element is used to render simple graphics such as line art, graphs, and
other custom graphical elements on the client side.
a) metadata
b) css
c) canvas
d) art
View Answer
Answer: c
Explanation: Metdata gives data or information of other data. CSS i.e. Cascading Style
Sheets is a style sheet language. Canvas is introduced in HTML5 for providing/drawing
graphics. The canvas element is part of HTML5 and allows for dynamic, scriptable
rendering of 2D shapes and bitmap images.

3. Prior to HTML5 in web market, traditionally, multimedia has been inserted with the
concept of tag-based multimedia back.
a) True
b) False
View Answer
Answer: b
Explanation: Multimedia has different formats, it can be anything that you can hear or see.
Traditionally, multimedia has been inserted with the embed and object elements, particularly
when inserting Adobe Flash, Apple QuickTime, Windows Media, and other formats.
advertisement

4. Consider the following markup and answer the question that follow.

<source src="html_5.mp4" type="video/mp4">


<source src="html_5.ogv" type="video/ogg">

What is the need to add multiple file formats for the same file?
a) To provide fallback support
b) To address the media support problem
c) To provide fallback support & address the media support problem
d) To provide foul back support
View Answer
Answer: c
Explanation: To address the media support problem, you need to add in alternative formats
to use by including a number of source tags.

5. Consider the markup and answer the question that follow.

<? controls autobuffer autoplay>


</?>
Which HTML5 element can replace the "?" ?
a) <audio>
b) <video>
c) <media>
d) both <audio> & <video>

View Answer
Answer: d
Explanation: Autobuffer is a attribute for both <audio> and <video>, so we can replace it
with either <audio> or <video>. As with the video element, you also have autobuffer and
autoplay attributes for the audio element.

 
 
6. Which plugins can provide the fallback support for old browsers?
a) Flash
b) Quicktime
c) Both Flash and Quicktime
d) Fireback and Quickertime
View Answer
Answer: c
Explanation: An attribute of the format: type=”application/x-shockwave-flash” will justify the
purpose.

7. Which of the following is not the promises of the open web platform?
a) Security and Privacy
b) Performance and Tuning
c) Media and Real-Time Communications
d) Device Interconnection
View Answer
Answer: d
Explanation: The different promises of the open web platform are –
• Security and Privacy
• Core Web Design and Development
• Device Interaction
• Application Lifecycle
• Media and Real-Time Communications
• Performance and Tuning
• Usability and Accessibility
• Services

8. HTML5 brings to the Web video and audio tracks without needing plugins.
a) True
b) False
View Answer
Answer: a

1. Which protocol is supported by Android browsers?


a) HTTPS
b) HLS
c) RTMP
d) FTP
View Answer
Answer: b
Explanation: HTTPS i.e. Hypertext Transfer Protocol Secure is used on internet. HLS which
stands for Hypertext Transfer Protocol Live Streaming invented by Apple Inc., a new
streaming protocol which is supported by android browsers. RTMP stands for Real-Time
Messaging Protocol, FTP stands for File Transfer Protocol.

2. __________ is a JavaScript library that implements the most common user interface
elements and interactions like sliders, accordions, tabs, and so on.
a) JavaScript
b) JQuery UI
c) VTS
d) JCL
View Answer
Answer: b
Explanation: JQuery UI is a curated set of user interface interactions, effects, widgets, and
themes built on top of the jQuery JavaScript Library. JavaScript is a scripting language. VTS
is a powerful rendering engine browser for JavaScript. JCL is Job Control Language which
is also named as scripting language.

3. In HTML Audio/Video DOM, __________ sets or returns whether the audio/video should
be loaded when the page loads.
a) preload
b) autoplay
c) buffered
d) controller
View Answer
Answer: a
Explanation: Autoplay, preload, buffered, controller etc are the different kinds of attribute of
video/audio element. Using autoplay, video/audio automatically begins to play. The preload
property allows the author to provide a hint to the browser about what he/she thinks will lead
to the best user experience. This attribute may be ignored in some instances.
advertisement

4. Which of the following is not a HTML5 tag?


a) <video>
b) <source>
c) <track>
d) <slider>

View Answer
Answer: d
Explanation: <video> tag is used to display video clips in HTML5. Multiple media resources
for media elements is specified by <source> tag. Text track for media elements i.e. <audio>
& <video> is provided by <track> tag in HTML5. There is no such thing as slider tag in
HTML5.

 
 
5. What will happen if height and width of video are not set while video loads?
a) page flickers
b) page does not load
c) page crash
d) page closes
View Answer
Answer: a
Explanation: If height and width are not set, the browser does not know the size of the
video. The effect will be that the page will change (or flicker) while the video loads.

6. Which of the following HTML Video – Media Type is not supported in IE?
a) WebM
b) MP4
c) Ogg
d) MP4 FLAC
View Answer
Answer: c
Explanation: The Ogg container format with the Theora video codec and the Vorbis audio
codec is supported in desktop/mobile Gecko (Firefox), Chrome, and Opera, and support for
the format can be added to Safari (but not on iOS) by installing an add-on. The format is not
supported in Internet Explorer in any way. The most widely used format for HTMl video i.e
MP4 format is supported in IE.

7. In HTML Audio/Video DOM, __________ sets or returns the default speed of the
audio/video playback.
a) currentTime
b) duration
c) defaultPlaybackRate
d) playbackRate
View Answer
Answer: c
Explanation: CurrentTime set or returns current playback position while playing audio/video.
The length of the current audio/video is set or returned by duration. Default speed of
playback is given by defaultPlaybackRate while playback returns speed of the audio/video.
8. In HTML Audio/Video DOM, __________ sets or returns the CORS settings of the
audio/video.
a) currentTime
b) duration
c) defaultPlaybackRate
d) crossOrigin
View Answer
Answer: d
Explanation: CurrentTime set or returns current playback position while playing audio/video.
The length of the current audio/video is set or returned by duration. Default speed of
playback is given by defaultPlaybackRate. The purpose of the crossorigin attribute is to
allow you to configure the CORS requests for the element’s fetched data.

9. In HTML Audio/Video DOM, __________ returns a TimeRanges object representing the


buffered parts of the audio/video.
a) preload
b) networkState
c) buffered
d) controller
View Answer
Answer: c

1. There is an audio format supported across all browsers.


a) True
b) False
View Answer
Answer: b
Explanation: There are 3 formats that are used in HTML5 Audio and are .mp3, .m4a AAC
also known as H.264 format.

2. Which of the following tag is used for audio in HTML5?

a) <bgsound>
b) <audio>
c) <video>
d) <canvas>

View Answer
Answer: b
Explanation: <video> tag is used for video clips in HTML5. <canvas> is for graphical user
interface. The audio tag defines sound, such as music or other audio streams.

 
 
3. Which tag is used to defines multiple media resources for media elements audio and
video?

advertisement

a) <source>
b) <canvas>
c) <audio>
d) <video>

View Answer
Answer: a
Explanation: <video> tag is used for video clips in HTML5. <canvas> is for graphical user
interface. The audio tag defines sound, such as music or other audio streams.defines
multiple media resources for media elements, such as <video> and <audio>.

 
 
4. Which of the following browser does not support wav file format?
a) Opera
b) Firefox
c) Chrome
d) Internet Explorer
View Answer
Answer: d
Explanation: Opera, firefox, chrome and internet explorer are different kinds of browsers.
Out of which audio file format named wav is not supported by internet explorer.

5. In HTML Audio/Video DOM __________ sets or returns the volume of the audio/video.
a) src
b) volume controls
c) volume
d) video Tracks
View Answer
Answer: c
Explanation: Src attribute gives current source of audio/video element. The videoTrack list
is returned representing available video tracks by video track attribute. Volume attribute sets
the current volume of video/audio.

6. Which of the following attribute adds audio controls, like play, pause, and volume?
a) audio
b) controls
c) source
d) src
View Answer
Answer: b
Explanation: The audio attribute defines sound, such as music or other audio streams.
Source attribute defines multiple media resources for media elements, such as <video> and
<audio>. Src attribute gives current source of audio/video element. The controls attribute is
a boolean attribute. When present, it specifies that audio controls should be displayed.

7. In HTML Audio/Video DOM __________ sets or returns whether the audio/video should
start playing as soon as it is loaded.
a) controls
b) audio Tracks
c) autoplay
d) currentSrc
View Answer
Answer: c
Explanation: Control attribute is used to set whether audio/video should display controls.
AudioTrack list representing audio tracks is set by audio track. The autoplay attribute is a
boolean attribute. When present, the audio will automatically start playing as soon as it can
do so without stopping. A current src of audio/video is returned by currentSrc.

8. In HTML Audio/Video DOM __________ sets or returns whether the audio/video should
start over again when finished.
a) loop
b) autoplay
c) seeking
d) played
View Answer
Answer: a
Explanation: The loop attribute is a boolean attribute. When present, it specifies that the
audio will start over again, every time it is finished. With autoplay, it ensures whether
video/audio should play immediately after loading page. Seeking returns whether user is
currently seeking video/audio. Timeranges representing played parts of audio/video is set
by played attribute.

9. In HTML Audio/Video DOM __________ returns a MediaError object representing the


error state of the audio/video.
a) ended
b) seeking
c) error
d) mediaGroup
View Answer
Answer: c
Explanation: Seeking returns whether user is currently seeking video/audio. Ended attribute
fires up when current playing playlist is finished. The error property returns a MediaError
object. The MediaError object has a code property containing the error state of the
audio/video. The group to which audio/video belongs is returned by mediaGroup.

10. In HTML Audio/Video DOM __________ returns a TextTrackList object representing the
available text tracks.
a) readyState
b) startDate
c) videoTracks
d) textTracks
View Answer
Answer: d

1. Which of the following element is used for canvas graphics?

a) <paint>
b) <canvas>
c) <graphic>
d) <css>
View Answer
Answer: b
Explanation: CSS i.e. Cascading Style Sheet is a scripting language. Canvas graphics is
introduced in HTML5. Element used for canvas graphics is <canvas>. The HTML canvas
element is used to draw graphics, on the fly, via scripting (usually JavaScript).

 
 
2. Which of the following statement is not true?
a) SVG stands for Scalable Vector Graphics
b) SVG is used to define graphics for the Web
c) SVG is a W3C recommendation
d) SVG doesn’t support event handlers
View Answer
Answer: d
Explanation: SVG stands for “Scalable Vector Graphics”, it is used to draw graphics for the
web. W3C recommends SVG graphics. SVG also supports event handlers which is not
supported in canvas.
advertisement

3. To draw on the canvas, authors must first obtain a reference to a context using the
______________ method of the canvas interface element.
a) getImageData
b) toDataURL
c) getContext
d) restore
View Answer
Answer: c
Explanation: The method getImageData(), returns an imageData that copies pixel data for a
specified thing in canvas. ContextType is a DOMString containing the context identifier
defining the drawing context associated to the canvas.

4. The ___________ method must add the scaling transformation described by the
arguments to the transformation matrix.
a) scale(x, y)
b) translate(x, y)
c) rotate(angle)
d) skew(x,y)
View Answer
Answer: a
Explanation: HTML5 canvas provides scale(x, y) method which is used to increase or
decrease the units in our canvas grid. The position (0, 0) is remaped in canvas by
translate(x, y) method. If one want to rotate the current drawing then rotate(angle) method
can be used.

5. Which method must clear the pixels in the specified rectangle that also intersects the
current clipping region to a fully transparent black, erasing any previous image?
a) strokeRect(x, y, w, h)
b) clearRect(x, y, w, h)
c) fillRect(x, y, w, h)
d) removeRect(x,y,w,h)
View Answer
Answer: b
Explanation: StrokeRect(x, y, w, h) draws rectangle without filling it. The clearRect() method
clears the specified pixels within a given rectangle. FillRect(x, y, w, h) method draws filled
rectangle.

6. When the _____________ method is passed an animated image as its image argument,
the user agent must use the poster frame of the animation, or, if there is no poster frame,
the first frame of the animation.
a) measureText()
b) imageData()
c) drawImage()
d) setImage()
View Answer
Answer: c
Explanation: The width of specified text present in an object is given by measureText()
method. The drawImage() method draws an image, canvas, or video onto the canvas.
ImageData() method provides image data in pixels in canvas.

7. The ____________ method must create a new clipping region by calculating the
intersection of the current clipping region and the area described by the current path, using
the non-zero winding number rule.
a) fill()
b) stroke()
c) clip()
d) get()
View Answer
Answer: c
Explanation: The path one defines is drawn by stroke() method. Any region/shape or size in
canvas is clipped by clip(). The fill() method fills the current drawing (path). The default color
is black. There is no method like get().

8. The ____________ method must fill all the subpaths of the current path, using fillStyle,
and using the non-zero winding number rule.
a) fill()
b) stroke()
c) clip()
d) get()
View Answer
Answer: a
Explanation: The path one defines is drawn by stroke() method. Any region/shape or size in
canvas is clipped by clip(). The fill() method fills the current drawing (path). The default color
is black. There is no method like get().

9. Which of the following methods must empty the list of subpaths so that the context once
again has zero subpaths?
a) closePath()
b) beginPath()
c) moveTo(x, y)
d) endPath()
View Answer
Answer: b
Explanation: ClosePath() creates a path that starts from current point up to the starting
point. The beginPath() method begins a path, or resets the current path. MoveTo(x, y)
moves the point specified in canvas but without creating the line. There is nothing like
endPath() in canvas.

10. An API is an application programming interface consisting of methods and properties


which allow the author to get or set data or execute commands to the user agent.
a) True
b) False
View Answer
Answer: a

1. Which of the following is not a type of attribute for input tag?


a) day
b) week
c) month
d) time
View Answer
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.

2. 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
View Answer
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.

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

4. 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
View Answer
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.

5. Which of the following allows the sandboxed iframe to run scripts from the same domain?
a) allow-same-origin
b) allow-forms
c) allow-scripts
d) allow-pointer-lock
View Answer
Answer: c
Explanation: Scripts are re-enabled by allow-scripts. The sandbox attribute enables an extra
set of restrictions for the content in the iframe. 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.

6. __________ 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
View Answer
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.

7. Which of the following is not a HTML5 added form element?

a) <datalist>
b) <keygen>
c) <output>
d) <password>

View Answer
Answer: d
Explanation: <datalist>, <keygen> and <output> are HTML5 added form element. Element
<password> is not a HTML5 added form element. Password is an attribute used in input
type in HTML.

 
 
8. Which element specifies a list of pre-defined options for an input element?
a) <datalist>
b) <keygen>
c) <output>
d) <password>

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

 
 
9. Which of the following defines a group of related options in a drop-down list?
a) <form>
b) <optgroup>
c) <output>
d) <option>

View Answer
Answer: b

1. What does ‘On-Screen Action’ means in the testing of HTML5 applications?


a) Using Drag action
b) Using new input type
c) Using play and pause action of audio and video elements
d) Verifying SVG and Canvas elements
View Answer
Answer: a
Explanation: While testing of HTML5 for a browser i.e. whether its elements are supported
by the browser or not one can use draggable content using Drag action and this action can
be called through On-Screen Action operation.

2. What can be used to verify a displayed graphics?


a) Property checkpoints
b) Region checkpoints
c) On-Screen Action
d) Local STorage
View Answer
Answer: b
Explanation: Region checkpoints are used to verify a displayed graphics. It is a kind of test
operation which gives verification of application’s window or control is displayed correctly or
not. Object’s property is verified by region checkpoints which is test operation. Local storage
is for storing data.

3. Which element has been removed from HTML5 (W3C) specification?


a) <figure>
b) <nav>
c) <hgroup>
d) <aside>
View Answer
Answer: c
Explanation: A section that is tangentially related to its surrounding content is defined by
<aside> tag. A block of navigation links is provided by newly added element in HTML5
called <nav>. <hgroup> tag has been removed from HTML5 specification, but it can be
seen in WHATWG version of HTML. The purpose of this element is how headings are
displayed. It’s practice is limited to theory only. <figure> tag specifies its own self defined
content which may contain diagrams, photos etc.
advertisement

4. Which of the following is used for plug-in content?


a) <embed>
b) <progress>
c) <meter>
d) <source>
View Answer
Answer: a
Explanation: <embed> tag is new in HTML5 which also helps in validation of HTML5 page.
It has attributes like height, src, type and width. HTML4 does not support this tag. Multiple
media sources for video , audio and pictures are provided by <source> tag. <meter> tag
gives a scalar measurement within a particular range. Progress of a task is shown by
<progress> element.

5. Which of the following does not lie under the attribute of <input> and is not supported by
Opera?
a) url
b) time
c) tel
d) option
View Answer
Answer: d
Explanation: <input> element type has new values as ‘url’, ‘email’, ‘datetime’, ‘date’, ‘month’,
‘tel’, ‘time’, ‘number’, ‘search’, ‘color’, ‘range’, ‘datetime-local’, ‘week’.

6. Which is the new attribute of <input> element that is used to change the appearance of
checkbox?
a) Indeterminate
b) Media
c) EI
d) Target
View Answer
Answer: a
Explanation: The indeterminate is actually not an attribute, it is the property of checkbox
which can be change via JavaScript, e.g. Var checkbox=document.getElementById(“any-
checkbox”); Checkbox.indeterminate=true;

7. Which attribute does not lie inside <a> and <area> elements?
a) Media
b) Ping
c) Hreflang
d) Preload
View Answer
Answer: d
Explanation: Preload is the attribute of the <video> element. Media, ping, hreflang, rel are
the attribute used with <a> and <area> elements.

8. Which element does not support autofocus attribute?


a) <input>
b) <select>
c) <textarea>
d) <base>
View Answer
Answer: d
Explanation: Autofocus is a new attribute as well as very interesting one. It can be specified
on <input>, <textarea>, <button> and <select> elements. It is a way to focus a form control
when the page is loaded.

9. Which element does not support form attribute?


a) <input>
b) <output>
c) <meta>
d) <button>
View Answer
Answer: c
Explanation: The new form attribute is for <input>, <select>, <textarea>, <button>, <output>
and <fieldset>. One can place these elements anywhere on the page.

10. Which attribute of <input> element can be used both with <datalist> and <select>
elements?
a) List
b) Pattern
c) Multiple
d) Max
View Answer
Answer: a
Explanation: List is the new attribute of <input> element and can be used together with
<datalist> and <select> elements. Other attributes like pattern, multiple, max, min, step are
new attribute used with the <input> element only.

11. Which is not a Boolean attribute?


a) Multiple
b) Novalidate
c) Formvalidate
d) Formtarget
View Answer
Answer: d
Explanation: Formtarget attribute is a Boolean attribute that must have a value that is a valid
browsing context name. Multiple is a new Boolean attribute of <input> the element which
specifies constraint, novalidate, and formvalidate are <form> attribute and are Boolean as
well.

12. Which of the following is not the keyword of form method attribute?
a) GET
b) POST
c) PUT
d) OUT
View Answer
Answer: d
Explanation: The keyword GET, POST, PUT, DELETE mapped to the state GET, POST,
PUT, DELETE and indicating the HTTP method respectively.

13. What is the work of async attribute?


a) It influences script loading
b) It gives a label to the menu
c) It validates form data
d) Enables a set of extra restrictions on any content
View Answer
Answer: a
Explanation: Async is the new attribute of the <script> element which influences script
loading and its execution. It is a Boolean attribute which shows the manner of script
execution. If async is present, the script will be executed asynchronously, as soon as it is
available.

14. Which is not <iframe> attribute?


a) Seamless
b) Srcdoc
c) Sizes
d) Sandbox
View Answer
Answer: c
Explanation: Sizes is the attribute of <link> element. Sandbox is the attribute of <iframe>
element that enables a set of extra restrictions on any content, seamless is a Boolean
attribute of <iframe> which seamlessly included in the parent document, srcdoc attribute
gives the content of the page that the nested browsing context is to contain.

15. Which is not a new global attribute in HTML5?


a) Contenteditable
b) Contextmenu
c) Title
d) Draggable
View Answer
Answer: c

1. How do we write comments in HTML5?


a) <!……>
b) <…….!>
c) </…….>
d) </……/>
View Answer
Answer: a
Explanation: Browser ignores comment in a code. There are always two types of command
i.e. single line command and multiple line command. If one wants to add a comment in
code, add the text between these characters <!…..comment….>. It will not visible in the
user’s browser.

2. Which one is correct syntax?


a) <p id=”1td”>
b) <p id=”td”>
c) <p id=”%td”>
d) <p id=”#td”>
View Answer
Answer: b
Explanation: <p id=”td”> is the correct syntax for id type declaration. Id attribute’s value
should start with a letter or an underscore. We cannot use any number or other character
for defining name of the id.

3. Which of the following is not example of block element?


a) <h1>
b) <ul>
c) <p>
d) <a>
View Answer
Answer: d
Explanation: The elements which always appear to start on a new line in browser are known
as block level elements. Examples are <h1>,<ul>,<li> and <p>.
advertisement

4. What does semantic markup not define?


a) provides extra information
b) where an emphasis is placed in a sentence
c) meaning of an acronym
d) that describes paragraphs
View Answer
Answer: d
Explanation: < Semantic markup> which provides extra information, such as where
emphasis is placed in a sentence, that something you have written is a quotation, the
meaning of acronyms etc.

5. How many levels of headings HTML has?


a) 6
b) 3
c) 7
d) 2
View Answer
Answer: a
Explanation: HTML has six “levels ” of headings.<h1> is used for main headings,<h2> is
used for subheadings. There is no other levels other than <h1>, <h2>, <h3>, <h4>, <h5>,
<h6>

6. What is the size of content of an <h1> element?


a) Smallest
b) Largest
c) Medium
d) Anything between smallest and largest
View Answer
Answer: b
Explanation: The contents of an <h1> element is the largest and the contents of an <h6>
element is the smallest. Rest of <h2>, <h3>, <h4>, <h5> lies in between largest and
smallest.

7. What is the tag used for making character appearance bold?


a) <b>content</b>
b) <i>content</i>
c) <u>content</u>
d) <br>content</br>
View Answer
Answer: a
Explanation: By enclosing words in the tags <b>and</b> we can make characters appear
bold. <i> element is for content in italics, <u> is for underlined content, <br> is for vertical
breaking.

8. For writing chemical formula of water which tag will be used?


a) <sup>
b) <sub>
c) <br/>
d) <ul>
View Answer
Answer: b
Explanation: The <sub> element is used to contain characters that should be subscript. It is
commonly used with foot notes or chemical formulas. E.g. H 20, <sup> is use for superscript,
<br> is for horizontal break, <ul> is for unordered list.

9. which tag will be used For raising number to a power?


a) <sup>
b) <sub>
c) <br/>
d) <ul>
View Answer
Answer: a
Explanation: The <sup> element is used to contain characters that should be superscript. It
is commonly used with foot notes or chemical formulae. E.g. X 2 , <br> is for break, <ul> is
for unordered list.

10. What is the use of <hr/> tag?


a) To create horizontal rule between sections
b) To create a line break
c) To create vertical rule between sections
d) For making content appearance italics
View Answer
Answer: a
Explanation: To create a break between themes-such as change of topic in a book or a new
scene in a play-you can add a horizontal rule between sections using <hr/> tag

11. Which of the following is not an empty element.


a) <hr/>
b) <br/>
c) <sup>
d) <img/>
View Answer
Answer: c
Explanation: There are a few elements that do not have any words between an opening and
closing tag. They are known as empty elements. An empty element usually has only one
tag. Before the closing angled bracket of an empty element, there will often be a space and
a forward slash.

12. Which attribute is not essential under <iframe>?


a) src
b) height
c) width
d) frameborder
View Answer
Answer: d
Explanation: An iframe is equivalent to a window that has been cut into our page, it is
created using <iframe> element. Src, height, width attribute are essentially used inside of
this. Src attribute specifies the URL of the page which is to be shown. Height and width
specify the height and width of an iframe in pixels.

13. Which is not the attribute of <meta> element?


a) description
b) keywords
c) robots
d) seamless
View Answer
Answer: d
Explanation: <meta> element contains information about web page. Description attribute
contains the description of the web page, keywords contains the list of comma separated
words, robots decide to add pages to search results.

14. Copyright symbol can be included by _________


a) &lt
b) &copy
c) &amp
d) &gt
View Answer
Answer: b
Explanation: HTML code has some characters that are reserved so for using those on the
page one need to know “escape” characters. If you want to add a copyright symbol to the
web page they can use &copy or &#169.

15. Attributes that allow to identify particular element are ____________


a) <div> and <span>
b) <meta>
c) id and class
d) <iframes>
View Answer
Answer: c

1. All elements are identified by their __________ and are marked up using either start tags
and end tags or self-closing tags.
a) attribute name
b) tag name
c) class name
d) none of the mentioned
View Answer
Answer: b
Explanation: The attribute name describes name of <input> element. The tagName property
returns the tag name of the element. In HTML, the returned value of the tagName property
is always in UPPERCASE. Name of class is returned by class name.

2. The __________ element represents a span of text that is isolated from its surroundings
for the purposes of bidirectional text formatting.
a) b
b) bdi
c) bdo
d) base
View Answer
Answer: b
Explanation: The base Url target relative to all URL’s in document is specified by base tag in
html. B is for bold text representation. bdi stands for Bi-directional Isolation. This element is
useful when embedding user-generated content with an unknown directionality. Direction of
text is displayed by bdo element.

3. The interactive element audio with the attribute controls must not appear as a
descendant of which element?
a) a
b) button
c) audio
d) both a and button
View Answer
Answer: d
Explanation: The anchor and the button tag acts as link which cannot be a parent of audio
element.
advertisement

4. A ____________ element must have a start tag but must not have an end tag.
a) details
b) command
c) code
d) both details and command
View Answer
Answer: b
Explanation: The command tag is new in HTML5 and specifies a normal command with an
action. Details has end tag.

5. Which type attribute of input element sets the element’s value to a string representing a
number?
a) range
b) email
c) file
d) date
View Answer
Answer: a
Explanation: The input element with a type attribute whose value is “range” represents an
imprecise control for setting the element’s value to a string representing a number.

6. Which of the following type attributes of input element defines control for entering a
telephone number?
a) mob
b) tel
c) mobile
d) telephone
View Answer
Answer: b
Explanation: The input element with a type attribute whose value is “tel” represents a one-
line plain-text edit control for entering a telephone number.
7. Which element represents a control for generating a public-private key pair?
a) ins
b) keygen
c) key
d) command
View Answer
Answer: b
Explanation: The command tag is new in HTML5 and specifies a normal command with an
action. The keygen element represents a control for generating a public-private key pair and
for submitting the public key from that key pair.

8. The World Wide Web’s markup language has always been HTML.
a) True
b) False
View Answer
Answer: a
Explanation: The World Wide Web’s markup language has always been HTML. HTML was
primarily designed as a language for semantically describing scientific documents, although
its general design and adaptations over the years have enabled it to be used to describe a
number of other types of documents.

9. Which element represents marked or highlighted text for reference purposes?


a) highlight
b) mark
c) strong
d) blink
View Answer
Answer: b
Explanation: Highlight element is used to highlight a particular text when used in a
document. Strong element specifies the importance of text. The mark element represents a
run of text in one document marked or highlighted for reference purposes, due to its
relevance in another context. An enclosed text which flashes later on is created by blink
element.

10. Which element(s) represents a section of a document that links to other documents?
a) navigation
b) anchor tag
c) nav
d) option
View Answer
Answer: c
Explanation: The nav element represents a section of a page that links to other pages or to
parts within the page: a section with navigation links.

11. Which of the following element marks the ruby text component of a ruby annotation?
a) r
b) rt
c) ruby
d) rubytxt
View Answer
Answer: b
Explanation: A ruby annotation is specified by ruby text, which is small text attached to the
main text, which is used to indicate the pronunciation of characters. The rt element is the
markup for ruby text.

12. Subtitle tracks and caption tracks to be specified for audio and video elements can be
added using which of the following element?
a) sink
b) track
c) stable
d) caption
View Answer
Answer: b

1. Which of the following is not the property of SVG images?


a) SVG images are scalable
b) SVG images are zoomable
c) SVG is an open standard
d) SVG images are resolution dependent
View Answer
Answer: d
Explanation: SVG images stands for Scalable Vector Graphics which are scalable,
zoomable and resolution independent. SVG is an open standard.

2. _______ drawings can be dynamic and interactive.


a) Canvas based
b) SVG
c) CSS3
d) JavaScript
View Answer
Answer: b
Explanation: Scalable Vector Graphics (SVG) is an XML-based vector image format for two-
dimensional graphics with support for interactivity and animation. The SVG specification is
an open standard developed by the World Wide Web Consortium (W3C) since 1999. SVG
images and their behaviors are defined in XML text files.

3. Which of the following is the predefined shape elements that can be used by developers?

advertisement

a) Path <path>
b) Rectangle <rect>
c) Circle <circle>
d) Line <lin>

View Answer
Answer: d
Explanation: SVG images stands for Scalable Vector Graphics. Path <path> is used to
define path. Rectangle element draws rectangle and Circle <circle> draws circle in SVG. All
of the respective SVG elements are used to draw respective images.

 
 
4. Which element must reference a resource that can provide an image for the cursor
graphic?
a) hover
b) i
c) cursor
d) fill
View Answer
Answer: c
Explanation: The cursor attribute specifies the mouse cursor displayed when the mouse
pointer is over an element. This attribute behaves exactly like the css cursor property
except that if the browser supports the cursor element, you should be able to use it with the
funciri notation.

5. Which element serves as a container for atomic filter operations?


a) filter
b) feimage
c) feblend
d) tref
View Answer
Answer: a
Explanation: Composition of two images together is done by a primitive filter called feblend.
A filter is referenced by using the filter attribute on the target SVG element and is never
renderd directly. Fetching of image data from external sources is done by feimage.

6. The __________ element must reference either an ‘altGlyphDef’ element or a ‘glyph’


element.
a) href
b) src
c) animate
d) altGlyph
View Answer
Answer: d
Explanation: Src is the URL of image. The href is Hypertext Reference which is used to link
pages in html and is also an attribute for anchor tag. The altGlyph element allows
sophisticated selection of the glyphs used to render its child character data.

7. The ___________ element must reference a ‘linearGradient’ or ‘radialGradient’ element.


a) script
b) radialGradient
c) animateTransform
d) clip-Path
View Answer
Answer: b
Explanation: Script is line of command which are executed by script engine. Allowing
animation to control translation, scaling or rotation is done by animateTransform element. A
radialGradient lets authors define radial gradients to fill or stroke graphical elements. A
clipping path is defined by clip-path element.

8. SVG also stands for Scalar Vector Graphics.


a) True
b) False
View Answer
Answer: b
Explanation: SVG stands for Scalable Vector Graphics.

9. Which property of SVG restricts the region to which paint can be applied?
a) animateTransform
b) clip-Path
c) linearGradient
d) radialGradient
View Answer
Answer: b
Explanation: Allowing animation to control translation, scaling or rotation is done by
animateTransform element. A clipping path is defined by clip-path element. A clipping path
is defined with a clipPath element. A clipping path is used/referenced using the clip-path
property. A radialGradient lets authors define radial gradients to fill or stroke graphical
elements.

10. Which SVG element produces the same effect as if the nodes were deeply cloned into a
non-exposed DOM?
a) tref
b) use
c) stroke
d) bin
View Answer
Answer: b

1. Which of the following MP3 player has not been written in Flash?
a) musicplayer.sourceforge.net
b) www.wimpyplayer.com
c) flash-mp3-player.net
d) soundcloud.com
View Answer
Answer: d
Explanation: There are several MP3 players that have been written in Flash like flash-mp3-
player.net, www.wimpyplayer.com, musicplayer.sourceforge.net. Every player has different
functionality. So you should be aware of that. Soundcloud.com and MySpace.com are
different sites which provide a player that one can embed in the page.

2. Which of the following is not the attribute for <audio> element?


a) controls
b) src
c) preload
d) width
View Answer
Answer: d
Explanation: <audio> element has various attributes like src, controls, autoplay, preload,
loop, buffered, crossorigin, muted. Width is attribute basically use for <video> not for
<audio> element. All the attributes and <audio> element is newly introduce by HTML5 to
make page responsive and user friendly.

3. What is the work of controls?


a) specify the path to an audio file
b) indicates if the player displaying controls
c) audio starts playing automatically
d) play again after finishing the audio
View Answer
Answer: b
Explanation: Controls attributes specify if the player is displaying controls or not. If one does
not use it no control will be display by default. One can set his own control by using
JavaScript. Syntax: <audio src=”example.ogg” controls autoplay>
advertisement

4. Which element is used for inserting more than one audio file?
a) <source>
b) <src>
c) <command>
d) <ins>
View Answer
Answer: a
Explanation: <src> provides or states location i.e Url of audio file. For inserting more than
one audio file, use <source> instead of src attribute between <audio> and </audio>. This
can be important because many browser support different formats for audio. For example
MP3 is supported by Chrome6+, Safari 5+.

5. What is the work of src?


a) audio starts playing automatically
b) play again after finishing the audio
c) specify the path to an audio file
d) insert more than one audio
View Answer
Answer: c
Explanation: src attribute basically specifies a path to the audio file. It is also used by
<source> element which indicates where the audio file is located. Autoplay attribute starts
playing audio automatically, loop plays audio again after it finishes.

6. Which of the following file extension is not used for audio MIME?
a) .ogv
b) .aac
c) .wav
d) .webm
View Answer
Answer: a
Explanation: For accessing audios in different browsers we can use various extensions
like .aac, .mp1, .mp1, .m4a, .mp2, .mpg, .mp3, .mpeg, .oga, .ogg, .wav, .webm. For video
we have file extensions like .mp4, .ogv, .m4v, .webm. It is noticeable that some extensions
are common both in audio and video. So user should pay attention where to put these as
per the need.

7. Which format is a restricted version of Matroska?


a) WebM
b) Ogg Opus
c) Ogg Flac
d) MP4 Flac
View Answer
Answer: a
Explanation: WebM format rely on the restricted version of Matroska format. WebM format
is both for video and audio in HTML5. The MIME types as WebM files are audio/webM. This
is the example where WebM media file is there only containing audio.

8. Which format is not supported in Internet Explorer?


a) WebM
b) Ogg Theora Vorbis
c) MP4 H.264
d) MP3
View Answer
Answer: b
Explanation: Ogg format is supported in mobile, desktop, chrome, safari, opera. WebM is
preferable over Ogg Theora Vorbis due to the better ratio of compression and quality and
most of the browsers support WebM. Ogg format can be used to support old browsers. The
MIME type of Ogg file that has audio is audio/ogg.

9. Which browser does not support MP4 H.264 format?


a) Opera
b) Chrome
c) Safari
d) Internet Explorer
View Answer
Answer: a
Explanation: The MP4 H.264 format is supported by Safari, Chrome, Internet Explorer.
Opera and Chromium do not support this format. This MP4 H.264 is used for both video and
audio. This format is not freely licensed so commonly not that much used on an open web
platform.

10. MP3 format is not supported by ____________


a) Firefox
b) Chrome
c) Safari
d) Opera
View Answer
Answer: d
Explanation: MP3 audio format is supported by Firefox, Firefox for android as well as for
iOs, Internet Explorer, Safari, and Chrome. The MIME type for audio is audio/mpeg, .mp3.
Usually used with <audio> element. Opera does not support the MP3 format.

11. WAVE PCM is not supported by _________


a) Chrome
b) Firefox
c) Safari
d) Internet Explorer
View Answer
Answer: a
Explanation: WAVE format is usually supported by Firefox, Internet Explorer and Safari. The
files end with the extension “.wav”. MIME type for audio is audio/wave or audio/x-wav or
audio/wav or audio/ x-pn-wav.

12. Flac is supported by ___________


a) Firefox
b) Chrome
c) Safari
d) Internet Explorer
View Answer
Answer: a
Explanation: Flac audio format is supported by mobile Gecko 58.0 (Thunderbird 58.0/
Firefox 58.0/ SeaMonkey 2.55) and desktop Gecko Firefox 51.0 (Thunderbird 51.0/ Firefox
51.0/ SeaMonkey 2.48). Extension for the FLAC format is “.flac”. MIME type is audio/ flac or
audio/ x-flac.

13. Which of the following is not a Boolean attribute for <audio> element?
a) autoplay
b) loop
c) muted
d) buffered
View Answer
Answer: d
Explanation: Autoplay is a Boolean attribute and its default value is set as false. Basically,
this feature of autoplay is avoided due to the unpleasant experience of users. Loop is also a
Boolean attribute. Muted is Boolean attribute whose value is set as false by default.
Buffered is not boolean attribute in <audio> element.

14. What can not be done by controls attribute?


a) playback
b) resume playback
c) pause playback
d) looping
View Answer
Answer: d
Explanation: Controls attribute of <audio> element provides a user the facility of playback
with volume, seeking, pause, resume playback. Looping can be done with loop attribute
which is a Boolean attribute. It automatically seeks back to start when audio reaches to end.

15. Which browser supports mozCurrentSampleOffset?


a) Chrome
b) Internet Explorer
c) Opera
d) Firefox
View Answer
Answer: d

. What is the default type of ‘type’ attribute of <input> element?


a) Text
b) Password
c) Numerals
d) Special Characters
View Answer
Answer: a
Explanation: Text input type defines single line text field. Type is the attribute that displays
type of <input> elements. Its default type is text. It is supported by most of the browsers like
Chrome, Internet Explorer, Firefox, Opera. Syntax is: <form action=”jump.php”>
Name:<input type=”text” name=”name”> </form> A password field is defined by password
input.

2. Which of the following is a new input attribute introduce by HTML5?


a) text
b) checkbox controls
c) submit buttons
d) date
View Answer
Answer: d
Explanation: HTML4 has attributes with <input> elements like radio buttons, Checkbox
controls, submit buttons, text input etc.
HTML5 has introduced new attributes like date, color, month, time, week, datetime-local,
email, number, range, tel, url, search etc.

3. How does the color attribute work?


a) Changes color of the text
b) Changes background color
c) The color picker is defined by it
d) Changes color of the text as well as background
View Answer
Answer: c
Explanation: color is the attribute of <input> element introduce by HTML5. It defines the
color picker i.e we can select a color of our choice from the color picker. Syntax is Select
the color that you want: <input type=”color” name=”favorite color”>
advertisement
4. Which attribute is used for activation of JavaScript?
a) button
b) checkbox
c) url
d) submit
View Answer
Answer: a
Explanation: Input type button is used for the activation of JavaScript on the clicking of the
button. Its syntax is <input type=”button” value=”click” onclick=”source()”>. This will display
a button named click and when we click that button JavaScript function source() will be
invoked.

5. Which attribute defines the file-select field?


a) file
b) checkbox
c) button
d) text
View Answer
Answer: a
Explanation: file input type defines a file-select field, also gives a “Browse” button for file
uploads. Syntax is <input type=”file” name=”image”>. Checkbox gives the facility to select
one or more than one options from the given choices. The button activates JavaScript code.
The text defines a single-line text field.

6. How image attribute works?


a) Sets an image background
b) Set an image as submit button
c) Set an image anywhere on the page
d) Bring default image to the page
View Answer
Answer: b
Explanation: the image input type set an image as submit button. The syntax is <input
type=”image” src=”imghj.gif” alt=”Submit”> this sets the image provided by url as the submit
button. Input type image sends the X and Y coordinates of click and hence the image is
activated by clicking the submit button.

7. month attribute defines ___________


a) the only month
b) month and year
c) date
d) date and time
View Answer
Answer: b
Explanation: month and year are defined by month attribute. It does not define the time
zone. The syntax is Anniversary (month and year) <input=”month” name=”anniversary
month” >., date attribute defines the date, datetime-local defines date and time but no time
zone.
8. week attribute defines ____________
a) week
b) year
c) week and year
d) week, month and year
View Answer
Answer: c
Explanation: week input type defines a week and year. It does not define the time zone.
Syntax is <form action=”ghu.php”> week: <input type=”week” name=”week and year”>
<input type=”submit”> </form>, this gives a selection box and display a calendar like chart
from where we can select a week and the year as well.

9. tel attribute is supported by the _________ browser.


a) Chrome
b) Safari
c) Opera
d) Internet Explorer
View Answer
Answer: b
Explanation: tel is the attribute which specifies field for telephone number. Syntax is <form
action=”hkjk.php”> Telephone number: <input type=”tel” name=”usertelephone”> <br>
<input type=”submit”> </form>, tel attribute is usually supported by newer versions like
Safari 8.

10. Which attribute is not used on new forms?


a) size
b) text
c) name
d) maxlength
View Answer
Answer: a
Explanation: size attribute denotes the width of text input i.e measured by the number of
characters inputted. E.g. If we input value 3 then it will create a box of width enough to
display three characters. The user can enter more characters if they want. Syntax is <input
type=”text” name=”firstname” size=”12” maxlength=”30”>

11. Which of the following is not used with password attribute?


a) name
b) size
c) maxlength
d) min
View Answer
Answer: d
Explanation: password is the attribute that creates a text box which is similar to the single
line text input, but the characters are blocked out. They are hidden due to the privacy of the
user. The name attribute with a password set the name of the password input, size and
maxlength attributes define the size and maximum length of the text box which is to be used
for the password.
12. Which element is used to create multi-line text input?
a) text
b) textarea
c) submit
d) radio button
View Answer
Answer: b
Explanation: For creating multi-line text input we use <textarea> element. This is not empty
element i.e. it requires both opening tag and closing tag. The cols attribute defines a width
of the text area. The row attributes the number of rows that the textarea can require.

13. Which attribute is not used for the radio type?


a) name
b) value
c) checked
d) selected
View Answer
Answer: d
Explanation: When we want to pick one option from the given many options we use radio
type. Name attribute sent the value of the option selected to the server. Value attribute
indicates the value that has been sent to the server for the selected option. The checked
attribute indicates that which value should be selected on the loading of the page.

14. Which attribute is used with <select> element?


a) multiple
b) selected
c) name
d) value
View Answer
Answer: a

1. Before HTML5 where data had to be stored?


a) cookies
b) browser
c) only in Internet Explorer
d) only in Chrome
View Answer
Answer: a
Explanation: When HTML5 was not introduced application data had to store in cookies
when server requested for it. Web storage was secure then as well as large data could be
stored even it does not affect performance. After coming of HTML5 web applications can
store data within the browser that the user is using.

2. In localStorage object data ________


a) is deleted after the browser has been closed
b) is not deleted after the browser has been closed
c) can be seen but can not edit
d) can be seen as well as edit
View Answer
Answer: b
Explanation: Data with no expiration date is stored by localStorage object. Here the data is
not deleted if we close the browser. We can have data at the next day or week or year.
Syntax is
localStorage(“firstname”,”Tanya”); document.getElementById(“fo”).innerHTML=
localStorage.getItem(“firstname”); here fo is id.

3. In sessionStorage object data __________


a) is not deleted after the browser has been closed
b) can be seen but can’t edit
c) can be seen as well as edit
d) is deleted after the browser has been closed
View Answer
Answer: d
Explanation: sessionStorage object works same as localStorage object except the data is
stored for one session only. When the use closes the browser the data is deleted. Syntax is
advertisement

sessionStorage.firstname-“Tanya”; document.getElementById(“fo”).innerHTML=
sessionStorage.firstname;

4. What is the limit of character storage for chrome 23.0 in localStorage?


a) unlimited
b) none
c) 1021 k
d) 4.98 M
View Answer
Answer: b
Explanation: We can’t store any character in localStorage in chrome 23.0, for chrome 18.0 it
is unlimited i.e. can store any number of characters, for chrome 19.77 it is 1021 k, for
chrome 22.0 it is 2.49 M, for chrome 24.0, 25.0, 27.0 it is 2.49 M, for chrome 28.0, 30.0,
31.0 and 31.1 it is 4.98 M.

5. What is the limit of character storage for chrome 23.0 in sessionStorage?


a) 510 k
b) unlimited
c) 1021 k
d) 2.49 M
View Answer
Answer: a
Explanation: We can store 510 k characters in sessionStorage in chrome 23.0, for chrome
18.0 and chrome 24.0 we can store unlimited characters, for chrome 19.77 its value is 1021
k, for chrome 25.0 and 27.0 it is 2.49 M, for chrome 28.0, 30.0, 31.0, 31.1 its value is 4.98
M.

6. Which of the following is not a web storage interface?


a) storage
b) window
c) storageEvent
d) privacy
View Answer
Answer: d
Explanation: There is only three web storage interface window, storage, and StorageEvent.
Window object provides access to the local storage objects. Storage retrieves, set and
remove data from the domain. Storage event is fired when the storage area on a
document’s window changes.

7. Which of the following returns a number of value pairs?


a) storage.key(n)
b) storage.length
c) storage.setItem(key,value)
d) storage.clear()
View Answer
Answer: b
Explanation: storage.length returns number of value pairs that are currently present in the
list, storage.key(n) returns name of nth key from the list, storagesetItem(key,value) sets the
value which is identified by key to value, storage.clear() empties the list which is associated
with values.

8. Which of the following is invoked when it is not fired on window object?


a) removeItem()
b) clear()
c) setItem()
d) getItem()
View Answer
Answer: d
Explanation: When removeItem(), clear() and setItem() are invoked the events are fired on
window object, which accesses newly stored or removed data, as defined by LocalStorage
and sessionStorage attributes, getItem(key) method returns the current value associated
with the key.

9. Which of the following is not the storageEvent interface?


a) event.newValue
b) event.url
c) event.key
d) event.clear
View Answer
Answer: d
Explanation: There are many storgeEvent interfaces like event.key, event.newValue,
event.url, event.oldValue, event.storageArea. Event.key returns the key if the storage item
is changed, event.oldValue and event.newValue returns old value and the new value of the
key whose value has been changed. Event.url returns the URL of a document which has
been changed.

10. For clearing all the settings which function should be called?
a) localStorage.remove(key)
b) localStorage.clear()
c) localStorage.remove()
d) localStorage.clearAll()
View Answer
Answer: b

1. Which of the following is not the form type for adding text?
a) Text input
b) Text area
c) Password input
d) Submit button
View Answer
Answer: d
Explanation: There are many types of form controls. Adding text, Submitting forms, Making
choices and Uploading files are some of them. For an adding text, we can use Text input,
Text area, and Password input. For making choices there are checkboxes, radio buttons,
and drop-down boxes.

2. In the processing of information, the server does not use the language _____
a) C#
b) JAVA
c) C++
d) VB.net
View Answer
Answer: c
Explanation: When we enter a new value through form it goes to the server for processing
information and this information is processed using languages C#, PHP, JAVA or VB.net.
The database can also store the information.

3. For creating single line text box for searching queries, we use the type ___________
a) placeholder
b) search
c) url
d) hidden
View Answer
Answer: b
Explanation: For creating a single line text box for searching queries we use the
type=”search”. In old browsers, it will be simply a single line text box. Safari adds across
that clear search box when we enter new data to search. It also rounds the corners on
search input fields by default.
advertisement

4. Form validation traditionally was performed by ___________


a) PHP
b) HTML
c) JavaScript
d) jQuery
View Answer
Answer: c
Explanation: Form validation is checking if the form has been filled correctly. Traditionally it
has been performed by JavaScript but now HTML5 is introducing validation. Hence browser
does all the work of validation. Validation reduces the amount of work for the server.

5. For grouping form controls we can use ___________


a) <legend>
b) <fieldset>
c) <label>
d) <select>
View Answer
Answer: b
Explanation: For grouping form controls together we use <fieldset> element. Fieldset is
shown with a line around edge. Appearance can be adjusted by CSS.
E.g. <fieldset> <legend> details </legend> <label> Name: <br/> <>input
type=”text” name=”name”/> </label> <br/> </fieldset>

6. Which one has the most potential for minification?


a) JavaScript
b) CSS
c) HTML
d) PHP
View Answer
Answer: a
Explanation: Among the four languages JavaScript, PHP, HTML and CSS, JavaScript has
the most potential for minification. In JavaScript whitespaces and comments are removed.
Windows-style line breaks (CRLF) is converted to UNIX-style breaks (LF). Moreover,
variable names can also be shortened.

7. YUI compressor is written in ____________


a) HTML
b) C++
c) C
d) Java
View Answer
Answer: d
Explanation: YUI compressor is one of the best compressor. It is a command-line minifier
which is written in Java. It can process CSS as well as JavaScript. It is simple to run it like-
$java –jar /usr/local/bin//yuicompressor-2.3.5/build/yuicompressor-2.3.5.jar
input.js > output.js

8. Which compressor gives maximum GZIPPED compression?


a) YUI
b) JSMin
c) Packer
d) Closure(advanced)
View Answer
Answer: a
Explanation: YUI compressor gives maximum GZIPPED compression i.e. 21 out of 122.
JSMin gives 23 out of 122, Closure(simple) gives 21 out of 122, Closure(advanced) gives
18 out of 122, Packer gives 23 out of 122. There is also redundancy due to GZIP
compression.
9. CSSMin is written in ___________
a) C++
b) Java
c) PHP
d) C
View Answer
Answer: b
Explanation: CSSMin is written in Java. It preforms conversion of lowercase, ordering of
properties, replacement of names with numeric or hex equivalents. E.g. font-weight:bold
can be written as font-weight: 600, color: black to color: #000.

10. HTMLMinifier is written in ________


a) JavaScript
b) Java
c) C++
d) C
View Answer
Answer: a
Explanation: There are mainly two popular HTML minifier. HTMLMinifier and
htmlcompressor first are written in JavaScript. It is to be run via a web browser. Second is
command-line Java application. HTMLMinifier offers better levels of compression.

11. Which option is not available in HTMLMinifier?


a) remove attribute quotes
b) use the short doctype
c) remove empty elements
d) replace <strong> with <b>
View Answer
Answer: d

1. Which of the following is not associated with web socket communication?


a) https
b) wss
c) ws
d) http
View Answer
Answer: d
Explanation: For opening WebSocket we call WebSocket constructor. The syntax is
var conn=new WebSocket(‘ws://rtyyghj.websocket.org/echo’,[‘brush’, ‘xmpp’]);

for using secure HTTP connections use https: ,ws: is the new URL scheme for connecting
WebSockets. There is wss: also.
advertisement

2. Which of the following is the wire protocol for WebScoket?


a) RFC6455
b) RFC6477
c) RFC6567
d) RFC8967
View Answer
Answer: a
Explanation: Wire protocol is handshaking and data transferring between server and client.
It is the RFC6455. Chrome for Android and Chrome are compatible with RFC6455. It
includes binary messaging also. Firefox version 11 and Internet Explorer 10 is also
compatible with this.

3. The maximum bytes for control frames is _______________


a) 100 bytes
b) 125 bytes
c) 130 bytes
d) 150 bytes
View Answer
Answer: b
Explanation: Control frames must be of 125 bytes or less than this. Control frames must not
be fragmented. They have opcode of 0x02 (Ping), 0x01 (close) or 0x03 (Pong). Control
frames help in communicating state about webSocket.

4. Which of the following is the server library for Node.js?


a) Caddy
b) SignalR
c) ws
d) jsonrpc
View Answer
Answer: c
Explanation: ws is server library and WebSocket client for Node.js. Caddy is used for
proxying arbitrary commands. WebSocket under covers is used by SignalR. To use
asynchronous RPC library with the bidirectional call we use JSONRPC.server.

5. In desktop which browser does not support WebSocket?


a) Chrome version 7
b) Chrome version 6
c) Chrome version 43
d) Internet Explorer 10
View Answer
Answer: a
Explanation: In desktops, WebSockets are supported by Chrome version-6, version-43,
version-14. Edge-14 supports WebSockets. All the versions of firefox support WebSocket.
Opera version-76 and version-7 do not support WebSocket. Safari version-5.0.1 and
version-6.0 support WebSocket.

6. Which one is not associated with Gecko?


a) Firefox
b) SeaMonkey
c) Thunderbird
d) Internet Explorer
View Answer
Answer: d
Explanation: Gecko 7.0 includes Firefox 7.0/SeaMonkey 2.4/Thunderbird 7.0. Gecko 8.0
includes Firefox 8.0/SeaMonkey 2.5/Thunderbird 8.0. In Gecko 11.0 WebSocket API is no
longer used as a prefix. In Gecko 7.0 network.websocket.max-connections is used.

7. Messages from the server are received by ____


a) onmessage
b) send
c) arrayBuffer
d) blob
View Answer
Answer: a
Explanation: onmessage function is used for receiving messages from the server. E.g.
memeDocket.onmessage = function (eve) { console.log(eve.data); }. For sending data as a
string we use ArrayaBuffer and Blob.

8. For duplex communication we can’t use ____________


a) Long Polling
b) HTML5
c) JavaScript
d) Streaming
View Answer
Answer: c
Explanation: There are some existing techniques for the communication between client and
server known as duplex techniques. They are Streaming, HTML5, Postback and AJAX,
Long Polling, Polling. For real-time transferring of data, Streaming is the best option. Polling
performs periodic requests.

9. Which of the following is not the event of WebSocket API?


a) Close
b) Message
c) Send
d) Error
View Answer
Answer: c
Explanation: There are four WebSocket API, Close, Message, Error and Open. We can
implement these events by using functions like onmessage, onopen, onerror,
addEventListener and onclose. When there is an end of communication between client and
server then onclose method is called.

10. Which one is not a very good developer support?


a) Opera
b) Internet Explorer
c) Firefox
d) Chrome
View Answer
Answer: b

1. Which attribute specifies a unique alphanumeric identifier to be associated with an


element?
a) class
b) id
c) article
d) html
View Answer
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
View Answer
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
View Answer
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.
advertisement

4. The __________ attribute sets the text direction as related to the lang attribute.
a) lang
b) sub
c) dir
d) ds
View Answer
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. Which of the following is the attribute that specifies the column name from the data
source object that supplies the bound data?
a) dataFormatAs
b) datafld
c) disabled
d) datasrc
View Answer
Answer: b
Explanation: DataFormatAs specifies how data is rendered. The identifier for data source is
set by dataSrc. Datafld attribute specifies the column name from the data source object that
supplies the bound data. This attribute is specific to Microsoft’s data binding. A Disabled is a
boolean attribute which specifies that <input> element should be disabled.

6. Which of the following is the attribute that indicates the name of the data source object
that supplies the data that is bound to this element?
a) dataFormatAs
b) datafld
c) disabled
d) datasrc
View Answer
Answer: d
Explanation: The identifier for data source is set by dataSrc. When the dataSrc property is
applied to a tabular data consumer, the entire data set is repeated by the consuming
elements. DataFormatAs specifies how data is rendered. A Disabled is a boolean attribute
which specifies that <input> element should be disabled.

7. Which of the following is the attribute that specifies additional horizontal space, in pixels,
to be reserved on either side of an embedded item like an iframe, applet, image, and so on?
a) height
b) hspace
c) hidefocus
d) datasrc
View Answer
Answer: b
Explanation: Height of element is pixels is specified by height attribute. The hspace attribute
specifies the whitespace on left and right side of an object. The hidefocus specifies whether
a focused rectangle is drawn around an object. The identifier for data source is set by
dataSrc.

8. The accesskey attribute specifies a keyboard navigation accelerator for the element.
a) True
b) False
View Answer
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.
9. 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
View Answer
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.

10. Which of the following is the attribute that is used to add a name/value pair to a
microdata item?
a) itemscope
b) itemref
c) itemprop
d) itemid
View Answer
Answer: c

1. What does wrap attribute denote?


a) Whether the text is in bold
b) Whether the text is wrapped
c) Whether the text is in italics
d) Whether the text is highlighted
View Answer
Answer: b
Explanation: wrap is the attribute of <textarea> element and it indicates whether the text
should be wrapped. Syntax: <textarea wrap=””> if we use wrap=”hard” it will contain
newlines in the submission of a form. This attribute is newly introduced by HTML5 and is
supported by all the browsers.

2. With which element width attribute is not define?


a) <input>
b) <object>
c) <embed>
d) <textarea>
View Answer
Answer: d
Explanation: width attribute is defined with <object>, <iframe>, <img>, <video>, <canvas>,
<embed>, <input>. <textarea> is used commonly with autofocus, cols, dirname, disabled,
form, maxlength, minlength, name, placeholder, readonly, rows and many other attributes.

3. Which of the following defines a default value on page load?


a) <object>
b) <input>
c) <progress>
d) <area>
View Answer
Answer: c
Explanation: <button>, <li>, <progress>, <param>, <meter>, <input>, <option> are some
elements used with value attribute and defines a default value on the page load. <object>
element is used with many attributes like border, data, form, height etc. <area> is used with
attributes like alt, cords, download, href, hreflang and many more.
advertisement

4. How title attribute works?


a) Displays text when hovering over the element
b) Focus text when hovering over the element
c) Highlight text when hovering over the element
d) Zoom in and zoom out text when hovering over the element
View Answer
Answer: a
Explanation: the title is a global attribute that displays text in a tooltip when hovered over the
element. Syntax is:
<p><abbr title=”Indian Association Service”>IAS</abbr> is India’s one of the
most difficult job.</p>

Output: IAS is India’s one of the most difficult job.

5. Which attribute is not for overriding the actions?


a) Formaction
b) Style
c) Tabindex
d) Slot
View Answer
Answer: d
Explanation: formaction is used for overriding <form> action, style is a global attribute that
overrides previously set styles, tabindex is also a global attribute which overrides default tab
order. A slot is a global attribute which assigns a slot in a shadow.

6. srclang attribute is used with the element ____________


a) <track>
b) <input>
c) <iframe>
d) <table>
View Answer
Answer: a
Explanation: srclang attribute is used with <track>. It specifies the language of text. E.g
<track src=”xyz.ogg” srclang=”en” label=”English”>, <input> is used with many attributes
like accept, alt, async, autocomplete, autofocus, checked, dirname, disabled, form,
formaction, height, list and many more.

7. What is the use of spellcheck attribute?


a) Checks spelling
b) Indicates if spell checking is allowed
c) Checks spelling and corrects it
d) Checks spelling of a given particular text only
View Answer
Answer: b
Explanation: spellcheck is a global attribute, it indicates if spell checking is allowed or not for
the element. Syntax is
<p contenteditable=”true” spellcheck=”true”> William Shakespeare was a great
novelist. </p>

Output:

William Shakespeare was a great novelist.

8. Which parameter is commonly used for size attribute?


a) centimeter
b) pixels
c) inch
d) millimeter
View Answer
Answer: b
Explanation: Size is an attribute commonly used with <input> and <select> element, it
defines the width of element in pixels. If we have password or text as attribute then it will be
count number of characters. Sizes is a attribute use with <link>, <source>, <img>

9. Which attribute indicates a descending order of displaying a list?


a) reversed
b) forward
c) straight
d) circular
View Answer
Answer: a
Explanation: Reverse attribute commonly use with <ol> element. It indicates that if the list is
to be displayed in descending order instead of ascending order or not. There is no
reference for options like forward, straight and circular in HTML.

10. The major difference between minlength and min attribute is ______
a) ‘minlength’ is for the minimum number of characters and ‘min’ is for the minimum value
b) ‘minlength’ is for the minimum value and ‘min’ is for the minimum number of characters
c) ‘minlength’ is for multiple values and ‘min’ is for the single value
d) ‘minlength’ is for single value and ‘minlength’ is for multiple values
View Answer
Answer: a
Explanation: minlength attribute use with <input>, <textarea> elements and it defines
minimum number of character allowed. Min is used with <input>, <meter> elements and
indicates minimum value allowed in element.
11. loop attribute is not used with _____________
a) <audio>
b) <marquee>
c) <video>
d) <track>
View Answer
Answer: d
Explanation: loop attribute is commonly use with <audio>, <bgsound>, <video>, <marquee>
and denotes whether the media should start playing from the beginning when it is finished.
<track> element is use with default attribute and it checks whether the track is enabled or
not.

12. How does download attribute work?


a) An indication that hyperlink is to be used for downloading
b) Directly downloads as per the need of the user
c) Gives various source links to download
d) List the topics which one can download from a certain page
View Answer
Answer: a
Explanation: Download attribute basically use by <a> and <area> elements. It shows the
hyperlink is to be used to download a resource when user clicks on it.

13. datetime attribute is not related with ______________


a) <del>
b) <time>
c) <ins>
d) <form>
View Answer
Answer: d
Explanation: datetime shows the date and time related with the element. Commonly use
with <del>, <time>, <ins> elements. <del> is use with cite attribute, <ins> is also use with
cite attribute, <form> element is use with various attributes like accept, action, accept-
charset etc.

14. cols attribute is use with ___________


a) <td>
b) <th>
c) <textarea>
d) <ol>
View Answer
Answer: c
Explanation: cols indicates number of columns in a certain textarea, use with <textarea>
element. <td> element is use with align attribute, <th> is also use with align attribute, <ol> is
basically use with reversed attribute.

15. Use of checked attribute is ____________


a) Whether on page load element should be checked
b) Whether on page load all form element should be checked
c) Whether on page load all list element should be checked
d) Whether on page load all multimedia elements should be checked
View Answer
Answer: a

1. Syntax of entity declaration is ___________


a) <!entity name “value”>
b) <entity name “value”!>
c) <”value” entity name>
d) <!”value” entity name>
View Answer
Answer: a
Explanation: Character entity reference declaration is done by syntax <!entity name
“value”> in HTML and in XML. This syntax is define in Document Type Definiton(DTD).

2. What is the correct format of numeric character reference?


a) &nnnn;
b) &#nnnn;
c) #nnnn;
d) $*nnnn;
View Answer
Answer: b
Explanation: Numeric character reference uses the format &#nnnn, nnnn represents
decimal format. We can also use hhhh in place of nnnn for hexadecimal form and its syntax
will be like &#xhhhh; In XML documents use &#xnnnn; semicolon is mandatory.

3. What is the format for character entity reference?


a) &name;
b) $name;
c) %name;
d) !name;
View Answer
Answer: a
Explanation: The format for character entity reference is &name; name is case-sensitive
alphanumeric string and semicolon is necessary.
advertisement

4. For entity which term is used by XML?


a) character entity reference
b) numeric character reference
c) predefined entities
d) character and numeric entity reference
View Answer
Answer: c
Explanation: “character entity reference” term is not used by XML instead XML defines five
“predefined entities” which are & [&], < [<], > [>], " [“] and ' [‘].

5. Which entity is not defined in XML?


a) quot
b) apos
c) gt
d) copy
View Answer
Answer: d
Explanation: There is only five entity in XML that are predefined and those are quot, It, gt,
apos, amp. Copy is used in HTML, quot, apos, gt was first introduced by XHTML 1.0. Copy
was first introduced by HTML 3.2. Unicode code point for copy is U+00A9.

6. Which entity is not for both HTML and XML?


a) apos
b) It?
c) cent
d) quot
View Answer
Answer: c
Explanation: cent is only HTML character entity. Other entities like quot, lt, gt, apos, amp
are for the use of both HTML and XML. The Unicode point in Hex for apos is U+0027, for lt
is U+003C, for cent is U+00A2, for quot is U+0022.

7. Which entity is not for punctuation character?


a) &quot
b) &para
c) &not
d) &acute
View Answer
Answer: d
Explanation: &acute is character entity and denote small a of latin language. &quot, &para,
&not are punctuation character entities. Number representation of &quot is &#34, &para is
&#182, &not is &#172, &acute is &#180.

8. Which of the following is not character entity?


a) &aelig
b) &aring
c) &image
d) &ecirc
View Answer
Answer: c
Explanation: &image is used for imaginary part. &aelig, &aring, &ecirc are all punctuation
character. We represents &aelig by the number &#230, &aring by &#229, &image is by
&#8465, &ecirc by &#234.

9. Which entity is for the arrow?


a) &crarr
b) &zeta
c) &upsih
d) &oelig
View Answer
Answer: a
Explanation: &crarr represents a downwards arrow with corner leftwards. &zeta is for greek
small letter zeta, &upsih is for greek upsilon, &oelig is for latin small letter o. Number for
&crarr is &#8629, for &zeta is &#950, for &upsih is &#978, for &oelig is &#339.

10. Which entity is not for shape?


a) &harr
b) &clubs
c) &hearts
d) &spades
View Answer
Answer: a
Explanation: &harr is for left right arrow, &clubs for club suit, &hearts for heart suit, &spades
for spade suit. Number representation of &harr is &#8596, &clubs is &#9827, &hearts is
&#9830, &spades is &#9824.

11. Which of the following entity is for shape?


a) &uarr
b) &loz
c) &rarr
d) &larr
View Answer
Answer: b
Explanation: &loz is for the shape lozenge, &uarr is for upward arrow, &rarr for rightwards
arrow, &larr for leftwards double arrow. The number for &uarr is &#8593, for &loz is
&#9674, for &rarr is &#8594, for &larr is &#8592.

12. Which entity is for inverted question mark?


a) &iquest
b) &oline
c) &permil
d) &prime
View Answer
Answer: a
Explanation: For inverted question mark we used &iquest, &oline is for overline, &permil is
for per mille, &prime is for feet sign. In number &iquest is &#191, &olin is &#8254, &permil
is &#8240, &prime is &#8242.

13. For trade mark sign which entity is used?


a) &shy
b) &trade
c) &sect
d) &real
View Answer
Answer: b
Explanation: We used &trade for the trademark sign, &shy is used for soft hyphen, &sect for
section sign, &real for real part symbol. In number &shy is denoted by &#173, &trade by
&#8482, &sect by &#167, &real by &#8476.

14. For latin letter u with acute which entity is used?


a) &ucirc
b) &ugrave
c) &ucirc
d) &uacute
View Answer
Answer: d
Explanation: &uacute defines latin letter u with acute, &ucirc is for u with circumflex,
&ugrave is for u with a grave.

15. For upward double arrow which entity is used?


a) &uArr
b) &uarr
c) &rarr
d) &darr
View Answer
Answer: a

1. How many standard color names does HTML supports?


a) 120
b) 130
c) 140
d) 90
View Answer
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.

2. 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
View Answer
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.

3. 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
View Answer
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.

advertisement

4. Which of the following is not used with text-decoration property?


a) overline
b) underline
c) line-through
d) inline
View Answer
Answer: d
Explanation: overline, underline, line-through properties are used to decorate the text.
Syntax:
h1{text-decoration: line-through; },
h2 {text-decoration: overline ;},
h3{text-decoration: underline;}
it will produce headings h1 with text having line-through, h2 with text having overline and h3
with text having underline.

5. Which works similar to <i> element?


a) <strong>
b) <em>
c) <b>
d) <blockquote>
View Answer
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.
<p>I <em>like</em> dog.</p>
Output: I like dog.
6. Which works similar to <b> element?
a) <strong>
b) <em>
c) <i>
d) <blockquote>
View Answer
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.
7. Which element is used for short quote?
a) <q>
b) <blockquote>
c) <em>
d) <abbr>
View Answer
Answer: a
Explanation: <em> element indicates emphasis, browser will show the contents of <em>
element in italic. A section which is quoted from another source is specified by
<blockquote>. The <abbr> defines abbreviation. We used <q> element for shorter quote.
Browser put quote around <q> element.
<p>This is a <q>black dog</q>.</p>
Output: This is a “black dog”.

8. Which element is used for abbreviation or acronym?


a) <em>
b) <q>
c) <abbr>
d) <blockquote>
View Answer
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.

9. 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:enquiry@sanfoundry.com">Sanfoundry</a>
</address>
Output:
Sanfoundry
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.
11. Which element is used to show inserted element?
a) <ins>
b) <del>
c) <strong>
d) <em>
View Answer
Answer: a
Explanation: <del> element shows text that has been deleted from, usually it has a line
through the content. <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.
<p>This is the <ins>inserted </ins> element.</p>
Output: This is the inserted element.
12. 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
View Answer
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.

13. Which property is similar to C/C++ can be applied to comments?


a) for loop
b) while loop
c) ifelse
d) switch case
View Answer
Answer: c
Explanation: We can add conditional comments in our web page using if and endif, e.g. <!–
[if age 9]>..text….<![endif]–>, there is no provision of “for” or “while” loop in HTML, same
apply with switch case also.

14. Which element defines a title of the Work?


a) <abbr>
b) <cite>
c) <address>
d) <blockquote>
View Answer
Answer: b
Explanation: For using, abbreviation or acronym <abbr> element is helpful. The contact
details for author of a page is specified by <address> attribute. A section which is quoted
from another source is specified by <blockquote>. The tittle of a Work is defined by <cite>
elements, usually it displays in italics.
<p><cite>Hamlet</cite> by William Shakespeare</p>
Output: Hamlet by William Shakespeare.

15. For smaller text which element is used?


a) <tiny>
b) <min>
c) <small>
d) <em>
View Answer
Answer: c

1. All attribute declarations begin with the keyword ____________ followed by the element
name, attribute name, attribute type, and default data information.
a) XML
b) SGML
c) ATTLIST
d) HTML
View Answer
Answer: c
Explanation: The ATTLIST declarations identify which element types may have attributes,
what type of attributes they may be, and what the default value of the attributes are. Syntax
is <!ATTLIST elementName attributeName dataType default >. XML and HTML are web
markup language used to design and create web pages. SGML stands for Standard
Generalized Markup Language.

2. The ________ declaration specifies which characters and delimiters may appear in the
application.
a) DTD
b) SGML
c) XML
d) HTML
View Answer
Answer: b
Explanation: XML(Extensible Markup Language) and HTML(Hypertext Markup Language)
are web markup language used to design and create web pages. The DTD defines the
syntax of markup constructs. SGML (Standard Generalized Markup Language) is a
standard for how to specify a document markup language or tag set. Such a specification is
itself a document type definition (DTD). SGML is metadata.

3. The __________ defines the syntax of markup constructs and include additional
definitions such as character entity references.
a) Attributes
b) SGML
c) Elements
d) DTD
View Answer
Answer: d
Explanation: SGML (Standard Generalized Markup Language) is a standard for how to
specify a document markup language or tag set. Property of an element is defined by the
attribute. The DTD defines the syntax of markup constructs. The DTD may include
additional definitions such as character entity references.
advertisement

4. A/An _________ is essentially a macro that allows a short name to be associated with
the replacement text.
a) Entity
b) Attribute
c) Comment
d) Element
View Answer
Answer: a
Explanation: Comments are used to provide idea about coding syntax which is ignored by
the browser. Reserved characters in HTML must be replaced with character entities.
Characters, not present on your keyboard, can also be replaced by entities. Property of an
element is defined by the attribute.

5. The ___________ keyword begins the declaration of attributes that an element may take.
It is followed by the name of the element in question, a list of attribute definitions, and a
closing.
a) DOCTYPE
b) ATTLIST
c) DTD
d) SGML
View Answer
Answer: a
Explanation: The ATTLIST declarations identify which element types may have attributes,
what type of attributes they may be, and what the default value of the attributes are. The
DTD defines the syntax of markup constructs. The DTD may include additional definitions
such as character entity references. SGML (Standard Generalized Markup Language) is a
standard for how to specify a document markup language or tag set. In HTML 4.01, the !
DOCTYPE declaration refers to a DTD, because HTML 4.01 was based on SGML. The
DTD specifies the rules for the markup language so that the browsers render the content
correctly.

6. The __________ begins with a series of parameter entity definitions.


a) DTD
b) SGML
c) XML
d) HTML
View Answer
Answer: a
Explanation: SGML (Standard Generalized Markup Language) is a standard for how to
specify a document markup language or tag set. XML and HTML are web markup language
used to design and create web pages. The HTML DTD begins with a series of parameter
entity definitions. A parameter entity definition defines a kind of macro that may be
referenced and expanded elsewhere in the DTD. These macros may not appear in HTML
documents, only in the DTD. Other types of macros, called character references, may be
used in the text of an HTML document or within attribute values.

7. The ______________ parameter identifies a character encoding, which is a method of


converting a sequence of bytes into a sequence of characters.
a) class
b) element
c) charset
d) attribute
View Answer
Answer: c
Explanation: Class is an attribute and can be used on any HTML element. Property of an
element is defined by attribute. To display an HTML page correctly, a web browser must
know the character set (character encoding) to use. @charset “UTF-8”; is a string.

8. A model group contains the names of the elements that a tag may enclose.
a) True
b) False
View Answer
Answer: a

1. Which of the following defines a part of text that might be formatted in a different direction
from other text?

a) <details>
b) <aside>
c) <bdi>
d) <article>

View Answer
Answer: c
Explanation: The additional details the user wants to know as per the demand is fulfilled by
<details> tag. Content related to surroundings is given by <aside> tag. <bdi> element is
useful when embedding user-generated content with an unknown directional. <article> is
self defined independent content which contains data which can be anything including
photos, videos, and other contents. It provides a section.

 
 
2. Which of the following defines a caption for a figure element?
a) <figcaption>
b) <dialog>
c) <caption>
d) <figure>

View Answer
Answer: a
Explanation: The figcaption element can be placed as the first or last child of the figure
element. It defines a caption for a figure element. Caption in a table immediately after
<table> tag can be given by <caption> tag. The <figure> tag provides section for illustration,
diagrams, photos etc. A box else window is defined by <dialog> tag in HTML.

 
 
3. Which of the following defines a command/menu item that the user can invoke from a
popup menu?
advertisement

a) <menuitem>
b) <menu>
c) <nav>
d) <class>

View Answer
Answer: a
Explanation: The menuitem tag is new in HTML5 and as of now is only supported in Firefox
8+ versions. <menuitem> defines a command item that the user can invoke from a popup
menu. A list of of commands is defined by <menu> tag. <nav> is set of navigation links.
One or more class names are specified by the global <class> attribute.

 
 
4. Which of the following tag defines the progress of a task?
a) <meter>
b) <progress>
c) <gauge>
d) <wbr>

View Answer
Answer: b
Explanation: Scalar measurement within range or may be a fractional value can be
displayed through <meter> tag. Use the progress tag in conjunction with JavaScript to
display the progress of a task. <wbr> is used for whether it is okay to add a line break in a
text.
 
 
5. Which of the following defines the result of a calculation?
a) <output>
b) <keygen>
c) <datalist>
d) <datalist>

View Answer
Answer: a
Explanation: The output tag represents the result of a calculation (like one performed by a
script). <keygen> has been removed from HTML5 and it specifies a name to <keygen>
element which refers to data after it’s submission. <datalist> is a list of pre-defined option
for input element. The additional details the user wants to know as per the demand is
fulfilled by <details> tag.

 
 
6. Which of the following defines graphic drawing using JavaScript?
a) <class>
b) <canvas>
c) <graphics>
d) <draw>

View Answer
Answer: b
Explanation: One or more class names are specified by the global <class> attribute. The
canvas tag is only a container for graphics, you must use a script to actually draw the
graphics. <graphics> and <draw> are imaginary part.

 
 
7. Which of the following elements in HTML5 defines video or movie content?
a) <media>
b) <video>
c) <movie>
d) <audio>

View Answer
Answer: b
Explanation: The media to which linked document is optimized is given by <media> tag.
Before HTML5, videos could only be played with a plug-in (like flash). The HTML5 video
element specifies a standard way to embed a video in a web page. As like <video>
elements, <audio> element contains additional files or streams like music, recording, etc.

 
 
8. Which of the following defines some content aside from the content it is placed in (like a
sidebar)?
a) <aside>
b) <header>
c) <sidebar>
d) <nav>
View Answer
Answer: a
Explanation: Content related to surroundings is given by <aside> tag. The aside content
should be related to the surrounding content. An introductory content is represented by
<header> element. The <nav> element contains list of navigation links.

 
 
9. Which of the following defines a visible heading for a details element?
a) <brief>
b) <summary>
c) <mark>
d) <main>

View Answer
Answer: b
Explanation: The main content of document is in <main>. <mark> is used to highlight the
text to indicate it’s uniqueness. The summary tag defines a visible heading for the details
element. The heading can be clicked to view/hide the details.

 
 
10. Which of the following defines additional details that the user can view or hide?
a) <details>
b) <article>
c) <aside>
d) <figure>

View Answer
Answer: a

1. Which event is fired as the mouse is moving over an element when a drag is occurring?
a) dragover
b) dragenter
c) dragstart
d) dragleave
View Answer
Answer: a
Explanation: The dragover event is fired as the mouse is moving over an element when a
drag is occurring. Much of the time, the operation that occurs during a listener will be the
same as the dragenter event. When draggable element enters a drop target then dragenter
event has occurred. A dragleave event occurs when it leaves the valid drop target.
Whenever a user starts to drag an element, dragstart is fired.

2. The _________ event is fired on the element where the drop occurred at the end of the
drag operation.
a) drag
b) drop
c) dragstart
d) dragenter
View Answer
Answer: b
Explanation: The drop event is fired on the element where the drop occurred at the end of
the drag operation. A listener would be responsible for retrieving the data being dragged
and inserting it at the drop location. Whenever user starts to drag an element, dragstart is
fired. When draggable element enters a drop target then dragenter event is occurred. When
element is being dragged, drag event is happened.

3. Which of the following property is common in all drag events?


a) drag effects
b) drag data
c) dataTransfer
d) dragenter
View Answer
Answer: c
Explanation: The feedback given by the user using drag and drop operation is done by drag
effects. Drag data includes all the data needed for drag operation. The dataTransfer
property of all drag events holds data about the drag and drop operation. When draggable
element enters a drop target then dragenter event is occurred.
advertisement

4. _____________ in textboxes and selections on web pages is done automatically, so you


do not need to handle dragging yourself.
a) Dragging HTML and XML
b) Dragging Text
c) Dragging Files
d) Dragging Links
View Answer
Answer: b
Explanation: Although the process is automatic, it is recommended that you always add
data of the text/plain type as a fallback for applications or drop targets that do not support
other types, unless there is no logical text alternative. Always add the plain text type last as
it is the least specific.

5. Calling the ______________ method during both a dragenter and dragover event will
indicate that a drop is allowed at that location.
a) drop
b) drag
c) preventDefault
d) dataTransfer
View Answer
Answer: c
Explanation: The drop event is fired on the element where the drop occurred at the end of
the drag operation. When element is being dragged, drag event has happened. Calling the
preventDefault method during both a dragenter and dragover event will indicate that a drop
is allowed at that location. However, you will commonly wish to call the preventDefault
method only in certain situations, for example, only if a link is being dragged. The
dataTransfer property of all drag events holds data about the drag and drop operation.
6. Which of the following property is used to determine which drag operation was desired?
a) dragend
b) getData
c) dropEffect
d) captureData
View Answer
Answer: c
Explanation: When the user finishes dragging an element, dragend is occurred. During the
drop event, you should retrieve that data that was dropped from the event and insert it at
the drop location. One can use the dropEffect property to determine which drag operation
was desired.

7. ______________ should include data of two types; the first should be the URL using the
type text/uri-list, and the second is the URL using the text/plain type.
a) Dragging HTML and XML
b) Dragging Text
c) Dragging Files
d) Dragging Links
View Answer
Answer: d
Explanation: Dragging Links should include data of two types; the first should be the URL
using the type text/uri-list, and the second is the URL using the text/plain type.

8. A listener for the dragenter and dragover events are used to indicate valid drop targets,
that is, places where dragged items may be dropped.
a) True
b) False
View Answer
Answer: a
Explanation: The dragover event is fired as the mouse is moving over an element when a
drag is occurring. Much of the time, the operation that occurs during a listener will be the
same as the dragenter event. When draggable element enters a drop target then dragenter
event is occurred.

9. _____________ and elements in a document may be dragged using the application/x-


moz-node type.
a) Dragging HTML and XML
b) Dragging Text
c) Dragging Nodes
d) Dragging Links
View Answer
Answer: c

1. Which method is used to get user’s position?


a) getCurrentPosition()
b) getDirectPosition()
c) post()
d) getDirection
View Answer
Answer: a
Explanation: For getting user’s position we used getCurrentPosition() method. Syntax is
navigator.geolocation.getCurrentPosition(showPosition). It is supported by most of the
browsers like Chrome, Firefox, Internet Explorer, Opera etc.

2. What does showPosition() returns?


a) only latitude
b) only longitude
c) both latitude and longitude
d) direction
View Answer
Answer: c
Explanation: showPosition() method returns both latitude and longitude of user. Syntax is
navigator.geolocation.getCurrentPosition(showPosition); The value of latitude and longitude
returned will be in decimal.

3. What does getCurrentPosition() returns?


a) latitude
b) longitude
c) direction
d) coordinates
View Answer
Answer: d
Explanation: Coordinates of object is return by getCurrentPosition() method.
getCurrentPosition() function accepts three parameters i.e. success, position and error.
When data is fetched successfully success callback will be invoked. Lagitude, longitude,
direction etc are the properties to be returned.
advertisement

4. Which of the following technique is not for the mobile browser to identify the location of a
user?
a) GPS
b) IP based position
c) WIFI based position
d) A-GPS
View Answer
Answer: b
Explanation: Geolocation API uses the various techniques to identify the location of a user.
In desktop browser uses IP bases position technique or WIFI. Mobile browser uses A-GPS,
WIFI based position or GPS.

5. Success callback function evoke only when ___________


a) user accepts to share location information
b) always evoke
c) gps is accessible
d) only by mobile browser
View Answer
Answer: a
Explanation: There is a privacy for sharing of user’s location and the callback function is
evoke only when a user accepts to share his location. Its input parameter is a position of the
object. If this function fails then error callback function will be evoked.

6. What timestamp property denotes?


a) time at which WIFI is used
b) the time at which data of the location is retrieved
c) the time at which callback function is evoked
d) current time
View Answer
Answer: b
Explanation: The time at which data of the location is retrieved denoted by timestamp
property. This also provides the date. Timestamp is a read-only property.

7. Which of the following is not the property of the ‘cords’ object?


a) Accuracy
b) Altitude
c) AltitudeAccuracy
d) enableHighAccuracy
View Answer
Answer: d
Explanation: cords object has properties like Latitude, longitude, altitude, accuracy,
AltitudeAccuracy, speed, heading. Cords.speed defines speed in meters per second.
Cords.heading defines degrees clockwise from North.

8. Which parameter gives an accuracy of longitude and latitude?


a) Accuracy
b) AltitudeAccuracy
c) enableHighAccuracy
d) Extra accuracy
View Answer
Answer: a
Explanation: Accuracy of latitude and longitude coordinates is given by ‘accuracy’. It is in
meters. Cords.altitudeAccuracy gives altitude accuracy of the position of the object.
enableHighAccuracy is a Boolean variable which gives the most accurate position.

9. Which of the following property does not has always a return?


a) coords.longitude
b) coords.latitude
c) coords.accuracy
d) coords.altitude
View Answer
Answer: d
Explanation: coords.latitude is the latitude in decimal number, coords.longitude is the value
of longitude in decimal number, coords.altitude returns the value above mean sea level in
meters if and only is return is available there.

10. Which property is like the GPS in car?


a) watchPosition()
b) clearWatch()
c) getCurrentPosition()
d) showPosition()
View Answer
Answer: a
Explanation: Current position of the user is returned by watdhPosition(). It update the
position os th user as the user moves just like the GPS installed in a car. WatchPosition()
method is stopped by clearWatch() method. E.g. if(navigator.geolocation)
{navigator.watchPosition(showPosition);}

11. Which is not the case of invoking for error callback function?
a) user denies to share the information of a location
b) location information is unavailable
c) request timed out
d) when we are using WIFI
View Answer
Answer: d
Explanation: Error callback function takes the Position Error object as its input parameter.
The function is invoked by an unknown error occurred or if the user has denied sharing the
information of the location or if the request timed out or if location information is unavailable.

12. What is the default value of timeout?


a) infinity
b) 100
c) 0
d) 1000000
View Answer
Answer: a
Explanation: The value of timeout is positive long value. It specifies the maximum time in
milliseconds which the user has taken to respond with the data of the location. Its default
value is infinity.

13. maximumAge returns time in _____________


a) nano-seconds
b) milliseconds
c) hour
d) seconds
View Answer
Answer: b

1. Which of the following is not the benefit of cache application?


a) browsing offline
b) reduction of server load
c) speed
d) asynchronous
View Answer
Answer: d
Explanation: Application cache can be helpful in so many ways like we can browse offline,
as the cached resources are at local level hence they load at faster speed, it also reduces
the load of the server. Asynchronous is one of the problems with the use of application
cache due to this the resources which are not required like JavaScript or images will also be
downloaded.

2. Which line is mandatory in cache manifest file?


a) CACHE MANIFEST
b) CSS stylesheet
c) index.html
d) image address
View Answer
Answer: a
Explanation: For offline access, there is a text file named cache manifest. It lists the
resources of the browser. For enabling application cache for any app we must include
manifest attribute inside an html tag of the document like <html manifest=”text.appcache”>
this manifest should be included on every page that we want cached.

3. Which is not the section of manifest?


a) network
b) cache
c) fallback
d) cache status
View Answer
Answer: d
Explanation: If the files are not in cache they come from a list of the files in the network.
Cache is the default section. The files those are listed under this header are explicitly
cached after downloading for the first time. If the resource is inaccessible then this section
will be in use. There is no any rule to list these section, can be listed in any order.
advertisement

4. Resources do not fit into _______


a) explicit entries
b) master entries
c) fallback entries
d) idle entries
View Answer
Answer: d
Explanation: The categories for the resources to fit in are explicit entries, master entries,
network entries, fallback entries. Entry can be both fallback and explicit entry. Any HTML file
that contains manifest attribute is a master entry. Explicit entries are listed explicitly in the
cache section.

5. Which entry executes and load scripts from the server?


a) Explicit entry
b) Network entry
c) Fallback entry
d) Master entry
View Answer
Answer: b
Explanation: There are four types of resources in an application cache which are 1) Master
Entries 2) Explicit Entries 3) Network Entries 4) Fallback Entries. Resources are explicitly
listed in the application’s cache manifest file by the explicit entry. Fallback entry provides
fallback entries in the application’s manifest file. Master entries are the resources added to
the cache. Network entry executes and load scripts and code from the server, not from the
cache. Syntax is
CACHE MANIFEST
NETWORK:
/api
Resources are explicitly listed in a cache in explicit entries. When attempt to load fails
fallback entry is used.

6. Which of the following is not one of the cache state?


a) Downloading
b) Checking
c) Idle
d) Fallback
View Answer
Answer: d
Explanation: Updateready, obsolete, downloading, checking, idle, uncached are the states
of cache. Downloading state of cache denotes that the resources are being downloaded.
Checking state signifies that manifest is being checked for the updates. Idle state denotes
that the cache is not currently active for the process to update.

7. When a new version of any cache is available which even is fired?


a) progress
b) updateready
c) checking
d) obsolete
View Answer
Answer: b
Explanation: When there is an availability of the new version of the cache updateready
event is fired. When the resources are being downloaded then progress event is fired.
Checking event is fired when an update is being checked. Obsolete is fired when the
current cache is marked obsolete.

8. If the transparent part of the image has rounded or diagonal edges, which format is
suitable?
a) PNG
b) Transparent GIF
c) GIF
d) JPG
View Answer
Answer: a

1. Which of the following gives a text description of the image if it is not available?
a) alt
b) title
c) src
d) height
View Answer
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.
advertisement

2. Which of the following is not the software for editing images?


a) Adobe Fireworks
b) PaintShop Pro
c) Paint.net
d) Splashup
View Answer
Answer: d
Explanation: Web professionals use various tools for image optimization. Adobe Photoshop,
Pixelmator, PaintShop Pro, Paint.net, Adobe Fireworks are some of them. There are online
editors also like photoshop.com, splashup.com, pixler.com, ipiccy.com, photoshop.com.

3. JPEG format is useful when ___________


a) there are so many colors in the picture
b) there are not so many colors in the picture
c) we want to show more brightness
d) when we want to show haziness
View Answer
Answer: a
Explanation: When we have different colors in a picture we use JPEG format. But when
images have few colors or have large areas of the same color we use PNG or GIF format.
Photographs that contain sky, snow, grass etc. are not suitable for PNG or GIF format.

4. Up to what resolution image should be saved by using in the web?


a) 23 ppi
b) 34 ppi
c) 72 ppi
d) 100 ppi
View Answer
Answer: c
Explanation: Images that are created for the web should be saved at a resolution of 72 ppi.
Here ppi denotes pixels per inch. Resolution’s size is directly proportional to the size of the
file. The resolution of the image is measured as a number of squares that fit within 1 inch x
1 inch square area.

5. Images are usually printed at a resolution of ___________


a) 200 dpi
b) 100 dpi
c) 50 dpi
d) 300 dpi
View Answer
Answer: d
Explanation: Images in print materials like in books or in magazines are made up of tiny
circles. These tiny circles are called dots. The images are generally printed at a resolution
of 300 dpi, dpi stands for dots per inch.

6. Vector images are created in ___________


a) Adobe Illustrator
b) Adobe Photoshop
c) Adobe Fireworks
d) Splashup
View Answer
Answer: a
Explanation: Vector images are created commonly in Adobe Illustrator. Vector images are
different from bitmap images. Vector images are resolution independent. Images such as
logo, diagram, illustration are created in vector format. Bitmap format includes JPG, PNG
and GIF images.

7. What is the new format to display vector images?


a) SVG
b) GIF
c) JPG
d) PNG
View Answer
Answer: a
Explanation: SVG stands for Scalable Vector Graphics. It is the new format that is used to
display vector images directly, there is no need to create bitmap versions of the images. But
it is not yet that much widespread. A GIF is a graphics interchange format. Both JPG and
PNG are file format out of which one is lossy compressed while other is lossless
compressed one.

8. Which format can create a transparent image?


a) PNG
b) GIF
c) JPG
d) SVG
View Answer
Answer: a
Explanation: For creating transparent images one can use PNG or Transparent GIF format.
These formats can create see through or partially transparent image. However transparent
PNG format is not supported by old browsers like Internet Explorer. SVG stands for
Scalable Vector Graphics. It is a new format that is used to display vector images directly. A
GIF is a graphics interchange format. JPG is a lossy compressed file format.

9. For caption of the image we use ____________


a) <figure>
b) <src>
c) <alt>
d) <title>
View Answer
Answer: a

1. What is Modernizr?
a) CSS style sheet
b) JavaScript Library
c) The source code of a web page
d) PHP file
View Answer
Answer: b
Explanation: Small JavaScript Library is Modernizr. It detects the availability of
implementations for new web technologies. Many browsers do not support the new features
that were introduced by HTML5. Modernizr provides a way to detect new features.

2. What is the JavaScript check for the HTML5 video feature?


a) Modernizr.video
b) Modernizr.video[format].
c) Modernizr.rgba
d) Modernizr.rgba
View Answer
Answer: a
Explanation: HTML5 feature video is detected by Modernizr.video. Modernizr.video[format]
detects HTML5 video format feature. Modernizr.rgba detects rgba() feature of HTML5,
hsla() is detected by Modernizr.hsla

3. Modernizr.csstransformss detects _________


a) CSS 2D transforms
b) CSS 3D transforms
c) Input Types
d) Input Attributes
View Answer
Answer: a
Explanation: Modernizr.csstransforms detects CSS 2D transforms introduced by HTML5.
CSS 3D transform is detected by Modernizr.csstransforms3d. Input types are detected by
Modernizr.inputtypes[type], Input Attributes is detected by Modernizr.input[attribute].
advertisement

4. Which latest browser is able to detect CSS Grids?


a) Modernizr 3.5.0
b) Modernizr 3.4.0
c) Modernizr 3.2.0
d) Modernizr 3.1.0
View Answer
Answer: a
Explanation: Modernizr 3.1.0, Modernizr 3.1.1, Modernizr 3.4.0 and Modernizr 3.5.0 are the
updated versions of modernizr which fixes some bugs and some updated the feature.
Modernizr 3.5.0 can detect CSS Grids. In this latest Modernizr, we use two syntaxes, one is
Modernizr.cssgrid, and an old syntax Modernizer.cssgridlegacy. In addition, there is a
polyfill available named PEP.

5. classPrefix is used when _____________


a) it is mandatory prefix before all the classes
b) class name clashes
c) when there is no any class in the code
d) not mandatory it depends on user
View Answer
Answer: b
Explanation: If modernizr’s class names are clashing with already existing class then we
use classPrefix inside the configuration. It works same as hidden detects that adds .hidden
class. Syntax is { “classPrefix”: “tee”, “feature-detects”: [“dom/hide”]}, this means instead of
<html class=”hide”> we will get <html class=”tee-hidden”>.

6. Which of the following can be helpful in creating your own feature detect?
a) Modernizr.addTest
b) Modenizer.on
c) Modernizr._domPrefixes
d) Modernizr.atRule
View Answer
Answer: a
Explanation: If you want to create your own feature detects you can simply use
Modernizr.addTest, a string is passed generally in lowercase without any punctuation like
Modernizr.addTest(feature, test). It returns the Boolean value. Modernizr._domPrefixes
works same as _prefixes. Modernizr.atRule is one of modernizr API(Application
Programming Interface) having syntax like – Modernizr.atRule(prop).

7. Which of the following is used to determine browser support?


a) Modernizr.addTest
b) Modernizr.hasEvent
c) Modernizr.atRule
d) Modernizr.prefixed
View Answer
Answer: b
Explanation: If you want to create your own feature detects you can simply use
Modernizr.addTest. Modernizr.hasEvent helps in determining browser support. It does
detection of div element by default. Syntax is hasEvent(‘video’). But if we want to give an
object to detect something other than div, we can give second argument as hasEvent(‘blur’,
window). It also returns a Boolean value. Modernizr.atRule is one of modernizr
API(Application Programming Interface) having syntax like – Modernizr.atRule(prop).
Modernizr.prefixed Modernizr API takes string CSS value in Document Object Model.

8. For checking programmatically we use _________


a) Modernizr.mq
b) Modernizr.prefixed
c) Modernizr._prefixes
d) Modernizr.testAllProps
View Answer
Answer: a
Explanation: For checking programmatically we use Modernizr.mq, it checks if the window
of current browser matches a media query or not. Syntax is
var qu= Modernizr.mq(‘(min-width: 300px)’);
if(qu) {// browser window is larger than 300 px}

We should use only valid media query. Modernizr.prefixed Modernizr API takes string CSS
value in Document Object Model. Modernizr._prefixes is internal list of prefixes. To check
whether a given CSS property is supported by browser, Modernizr.testAllProps API.

9. The features that can’t be detected by checking idle are checked by ____________
a) Modernizr.prefixedCSS
b) Modernizr.testAllProps
c) Modernizr.testStyles
d) Modernizr.testProp
View Answer
Answer: c
Explanation: Modernizr.testProp is just like Modernizr.testAllProps but only difference is it
doesn’t check for vendor. The features that can’t be check by IDL is checked by
Modernizr.testStyles, it takes CSS rule and embed it onto current page with DOM elements.
Syntax is
Modernizr.testStyles (rule,callback,[nodes],[testnames]).

We can add additional div elements also on the page as per requirement.
Modernizr.prefixedCSS is same like Modernizr.prefixed except it returns result in
hyphenated form.

10. For testing prefixed CSS properties we use _____________


a) Modernizr.prefixed
b) Modernizr.prefixedCSS
c) Modernizr._prefixes
d) Modernizr.prefixedCSS value
View Answer
Answer: d
Explanation: For checkin prefixed CSS properties we use Modernizr.prefixedCSS value.
Syntax is
Modernizr.prefixedCSSVAlue (prop,value).

Modernizr.prefixed takes string css value in camelCase. Modernizr.prefixed takes string css
value in camelCase. Modernizr.prefixedCSS returns hyphenated value. Modernizr._prefixes
is internal list of prefixes.

11. Which of the following is internal list of prefixes?


a) Modernizr._prefixes
b) Modernizr.prefixedCSS value
c) Modernizr.prefixedCSS
d) Modernizr.prefixed
View Answer
Answer: a
Explanation: Modernizr._prefixes is internal list of prefixes. It is set against things like
prefixedCSS and prefixed. It is an array of kebab-case vendor.
E.g. var ru= Modernizr._prefixes.join(‘transform: rotate(10deg);’); ru ==
‘transform: rotate(10deg)’; webkit- transform: rotate(10deg); moz-transform:
rotate(10deg); o-transform: rotate(10deg); ms-transform: rotate(10deg);’

Modernizr.prefixedCSSVAlue (prop,value). Modernizr.prefixed takes string css value in


camelCase. Modernizr.prefixedCSS returns hyphenated value.

12. Which of the following detects support for basic Worker API?
a) web workers
b) shared workers
c) data workers
d) blob workers
View Answer
Answer: a
Explanation: The support of basic web worker is detected by web workers. Web workers
mean running a script in the background for web content. Shared workers detect support of
shared workers, data workers detect support for creating Web Workers from Data URI’s.
Blob workers detect support for creating web workers from Blob URI.

13. Which of the following detects support for the method of the form?
a) input formtarget
b) input formmethod
c) input formenctype
d) input formaction
View Answer
Answer: b
Explanation: input formmethod detects support for formmethod attribute, input formtarget
detects for formtarget attribute on forms, input formenctyp detects for the support of
formenctype attribute, it overrides form enctype attribute, input formactin detects for the
support of formaction attribute.

14. Which of the following check support for non-alpha, lossy webp?
a) Webp
b) Webp Lossless
c) Webp Animation
d) Webp Alpha
View Answer
Answer: b
Explanation: Webp Lossless detects for lossless webp, non-alpha webp support. Webp
tests for all forms of webp support like alpha, lossy, animated, lossless etc. Webp Animation
detects for the support of animation in webp, Webp Alpha detects the support of transparent
webp.

15. Which of the following detects for the support of size attribute of an image?
a) JPEG 2000
b) JPEG XR
c) Image crossOrigin
d) Sizes
View Answer
Answer: d
1. URL is ___________
a) web address
b) source code
c) user’s address
d) an attribute
View Answer
Answer: a
Explanation: URL is the second name of a web address. It is composed of IP (Internet
Protocol) address or words. Its full form is Uniform Resource Locators. Generally entering
name while surfing is easy as numbers are hard to remember.

2. What is the correct syntax of web address?


a) path://prefix.port:domain/filename/scheme
b) scheme://prefix.domain:port/path/filename
c) prefix://scheme.port:domain/filename/path
d) port://domain.filenmae:path/scheme/prefix
View Answer
Answer: b
Explanation: The correct syntax for a web address is
scheme://prefix.domain:port/path/filename, where scheme is for https or http, prefix is for
domain like www, domain denotes domain name, port defines port number, path defines
path at server, filename is for name of the document.

3. Which scheme is used for secure HyperText Transfer Protocol?


a) ftp
b) http
c) https
d) file
View Answer
Answer: c
Explanation: https scheme is for secure or encrypted web pages, http is HyperText Transfer
Protocol used for common web pages which are not encrypted, ftp is file transfer protocol
for downloading and uploading of documents.
advertisement

4. ASCII is _____________
a) 6-bit character set
b) 7-bit character set
c) 9-bit character set
d) 3-bit character set
View Answer
Answer: b
Explanation: ASCII consists 7-bit character set which has 128 characters. There are
numbers 0-9, upper and lower case letters from A-Z, and also include special characters.
Including modern computers, internet these characters are used in HTML also.

5. In URL encoding replaces non-ASCII characters with ________


a) “*”
b) “&”
c) “%”
d) “+”
View Answer
Answer: c
Explanation: In URL encoding non-ASCII characters are replaced with “%” which is followed
by hexadecimal digits. URL can only contain ASCII character set. There should be no space
in the URL, space is replaced by %20 or “+” in URL encoding.

6. Which function is used in JavaScript for URL encoding?


a) encodeURI()
b) Server.URLEncode()
c) rawurlencode()
d) UREncoding
View Answer
Answer: a
Explanation: There are some built in functions in JavaScript, ASP and PHP for URL
encoding. JavaScript use encodeURI() function. ASP uses Server.URLEncode() function,
rawurlencode() function is used by PHP. Space is encoded as %20 by JavaScript function.

7. What is URL encode of ‘&’?


a) %24
b) %2c
c) %3d
d) %26
View Answer
Answer: d
Explanation: URL encoding of ‘&’ is %26, its Decimal value is 38 and the Hex value is 26.
%24 is URL encode of ‘$’ whose Decimal value is 36 and Hex value is 24, %2c is URL
encode of ‘,’ its Decimal value is 44 and Hex value is 2c, %3d is URL encode of ‘=’, its
Decimal value is 61 and Hex value is 3d.

8. Which of the following is not a reserved character?


a) &
b) >
c) +
d) @
View Answer
Answer: b
Explanation: Reserved characters are ‘@’, ‘=’, ‘?’, ‘:’, ‘;’, ‘/’, ‘,’, ‘+’, ‘$’, ‘&’. Unsafe characters
are space, ‘”’, ‘>’, ‘<’, ‘#’, ‘%’, ‘{‘, ‘}’, ‘~’, ‘^’, ‘[‘, ‘|’, ‘\’, ‘`’, ‘]’. There is a URL Encode for all of
these characters. Apart from URL Encode there is Decimal and Hex value also for the
characters.

9. What is the URL Encode for tab character?


a) %09
b) %08
c) %0d
d) %0a
View Answer
Answer: a
Explanation: For tab character URL encode is %09, its Decimal value is 9 and Hex value is
09, %08 is URL encode for backspace, its Decimal value is 8 and Hex value is 08, %0d is
URL Encode for carriage return, Decimal value is 13 and Hex value is 0d, %0a is URL
encode for linefeed, Decimal value is 10 and Hex value is 0a.

10. Which of the following is not encode by encodeURI() function?


a) >
b) [
c) \
d) :
View Answer
Answer: d
Explanation: encodeURI() function is JavaScript function. It encodes special characters.
The characters that can’t be encoded are ‘,’, ‘?’, ‘/’, ‘@’, ‘=’, ‘&’, ‘$’, ‘+’, ‘#’, ‘:’. Its syntax is
encodeURI(uri), uri is the URI that to be encoded.

11. Which of the following is used to decode the encoded URI?


a) encodeURI()
b) encodeURIComponent()
c) decodeURI()
d) Server.URLEncode()
View Answer
Answer: c
Explanation: encodeURI(), encodeURIComponent, decodeURI() are the Java Script
function. encodeURI(), encodeURIComponent() are the functionsthat encode URL.
decodeURI() is the function that decode the encoded URL.

12. What is the URL Encode for the character ‘M’?


a) %47
b) %4A
c) %4D
d) %50
View Answer
Answer: c
Explanation: The URL Encode for character ‘M’ is %4D, %47 is URL Encode for ‘G’, %4A is
URL Encode for ‘J’, %50 is URL Encode for the character ‘P’. The URL Encode for A to Z
characters start from 41 to 5A followed by a ‘%’ sign serially.

13. Which of the following is not control character?


a) BS
b) NUL
c) ampersand
d) HT
View Answer
Answer: c
Explanation: ASCII control characters are defined from %00-%1F, these characters are to
design control hardware devices. These characters are not used inside URL. NUL, ENQ,
ETX, BEL, BS, HT, LF, EOT, CR, DLE, DC3 are some of the control characters. BS is for
backspace, NUL is for null character, HT is for the horizontal tab character.

14. What is the URL encoding of VT?


a) %0B
b) %09
c) %06
d) %02
View Answer
Answer: a
Explanation: The URL Encode for VT (vertical tab) character is %0B, %09 is for horizontal
tab character, %06 is the URL Encode for ACK (acknowledge), %02 is URL Encode for
STX (start of text) character. %00 is the URL Encode for NUL (null character).

15. Which is not a reserved character?


a) _
b) (
c) )
d) *
View Answer
Answer: a

1. Which function is used to return a handle to the database?


a) prepareDatabase()
b) showDocCount()
c) executeSql()
d) openDatabase()
View Answer
Answer: a
Explanation: prepareDatabase() function is used to return a handle to database. It is
necessary to first create the database. showDocCount() shows the real work after creating
the database. Syntax of calling a JavaScript function is: function prepareDatabase(ready,
error).

2. openDatabase() method does not take the argument in __________


a) database name
b) display name
c) database version
d) server name
View Answer
Answer: d
Explanation: openDatabase() and openDatabaseSync() methods takes the name of the
database, version of the database, display name, estimated size in bytes of the data that is
to be stored in the database. openDtabase() method works on WorkerUtils and Window,
openDatabaseSync() method works on WorkerUtils.

3. The sign is used for the placeholder _____________


a) &
b) *
c) ^
d) ?
View Answer
Answer: d
Explanation: ‘?’ is used for the placeholder. Binding of the ? placeholder is done at a literal
level. It is dynamically inserted into the statement. ‘?’ can be used in place of literals in SQL
statements. If this character is not supported then the error code 5 is invoked.
advertisement

4. Which feature is not used when SQL features are not being supported?
a) BEGIN
b) END
c) COMMIT
d) ROLLBACK
View Answer
Answer: b
Explanation: When SQL feature is not supported then we use COMMIT, BEGIN,
ROLLBACK SQL features and are marked as bogus. User agent uses the statements that
contain these three words in case of failure of the support of SQL features.

5. transaction() does not take the argument _______


a) callback
b) success callback
c) error callback
d) database name
View Answer
Answer: d
Explanation: transction() and readTransaction() are the two methods that take three
arguments i.e. transaction callback as the first argument, error callback as the second
argument, success callback as the third argument.

6. Which method is used to verifythe version number?


a) changeVersion()
b) readTransaction()
c) transaction()
d) executeSql()
View Answer
Answer: a
Explanation: changeVersion() method automatically verify version number and it also
changes it like doing a schema update. When this method is invoked it immediately returns
and then run transaction steps asynchronously by taking transaction callback as the third
argument, error callback as the fourth argument and success callback as the fifth argument.

7. Which error is invoked when SQLTransactionCallback does not execute?


a) INVALID_ACCESS_ERR
b) UNKNOWN_ERR
c) TIMEOUT_ERR
d) INVALID_STATE_ERR
View Answer
Answer: d
Explanation: When SQLTransactionCallback, SQLStatementErrorCallback,
SQLStatementCallback does not execute then INVALID_STATE_ERR error is raised. This
error is raised from inside a SQLTransactionErrorCallback.

8. Which object is created for read-only transaction?


a) Foo object
b) SQLTransactionSync
c) DatabaseSync object
d) SQLTransaction
View Answer
Answer: b
Explanation: For read-only transaction, we create the object SQLTransactionSync. If the
first argument is NULL then we throw SQLException which is Error code 0.
SQLTransactionSync object is fresh initially but when it is marked as stale it is committed or
rolled back.

9. insertId attribute returns ____________


a) column ID
b) row ID
c) user’s ID
d) database ID
View Answer
Answer: b
Explanation: insertId attribute returns the row ID of the row of the inserted SQLResultSet
object’s SQL statement that is inserted into the database. If multiple rows are inserted then
the ID of the last row will be returned. If there is no row then INVALID_ACCESS_ERR
exception will be raised.

10. Number of rows is returned by the attribute __________


a) insertIID
b) rows
c) rowsAffected
d) length
View Answer
Answer: c
Explanation: rowsAffected attribute returns the number of rows that were changed by SQL.
If there is no change by the SQL statement then this attribute will return zero. If we use
“SELECT” statement, this attribute will always return zero.

11. Which of the error is raised when the quantity of data is too much?
a) TOO_LARGE_ERR
b) UNKNOWN_ERR
c) TIMEOUT_ERR
d) QUOTA_ERR
View Answer
Answer: a
Explanation: When the quantity of the data returned from the database is very large then
TOO_LARGE_ERR is invoked. To minimize the data we can use SQL “LIMIT” i.e. modifier
to reduce the size of the resultant set.

12. What is the required argument to openDatabase?


a) version number
b) database name
c) size of a database
d) text description
View Answer
Answer: a
Explanation: The required argument to openDatabase is version number. So it is mandatory
that you should know the version number before we try to open the database. If we do not
pass this argument then an exception is thrown.

13. Which attribute is used for getting an individual row?


a) results.rows.item(i)
b) insertId
c) rowAffected
d) length
View Answer
Answer: a

1. Sprites are _____________


a) 1-D images
b) 2-D images
c) 3-D images
d) not the image
View Answer
Answer: b
Explanation: 2-D images are sprites. Sprite is a big image which is made up of combining
small images into one larger image. It is defined by X and Y coordinates. CSS background-
position property is used to define the exact position that is to be displayed.

2. Sprites are not used for _________


a) beautify the web page
b) reducing HTTP request
c) reduce loading time
d) reducing multiple server requests
View Answer
Answer: a
Explanation: If there are so many small icons, images, buttons etc. on the web page it will
take more time to load the web page. Hence image sprites are used, it combines small
images in one and loading time is reduced. This also reduces the HTTP request.

3. Each image in sprite should be approximately of ___________


a) 100 pixels
b) 20 pixels
c) 10 pixels
d) 50 pixels
View Answer
Answer: c
Explanation: For using image sprite we should try to round up to nearly 10 pixels, especially
when working with Photoshop. We should also use simpler figures so that it will be easy to
use ‘snap-to’ grids in photoshop, also for keeping things organized.
advertisement

4. Which of the following is not Sprite Sheet generator?


a) Lemonade
b) Firewoks CS6
c) SpriteMe
d) Pixelomator
View Answer
Answer: d
Explanation: There are many sprite sheet generators such as Lemonade, Compass,
SpriteMe, Fireworks CS6. Lemonade, Compass, and SpriteMe are available free of cost but
Fireworks CS6 is not free of cost. Pixelomator is image editing software.

5. Which is the best platform for working with the individual image?
a) SpriteMe
b) Fireworks CS6
c) Lemonade
d) Compass
View Answer
Answer: a
Explanation: SpriteMe is brilliant sprite sheet viewer and generator. It is available at a free
of cost. We can design our website using individual images. It is very simple to use. By
using SpriteMe we can also view current sprite sheets that are already present on a
website.

6. Which of the following does not generate a sprite sheet?


a) SpriteRight
b) Sprite Cow
c) CSS Sprites
d) Glue
View Answer
Answer: b
Explanation: Sprite Cow does not generate sprites, instead it helps to get the dimensions of
images that are within sprite sheet, SpriteRight is used for generating sprite sheets., here
the CSS is created on the fly. CSS Sprites is also one of the sprite sheet generators. Glue is
a command line tool that generates sprite sheets.

7. Templates can’t be placed inside ______________


a) <head>
b) <body>
c) <table>
d) <form>
View Answer
Answer: d
Explanation: Templates can be placed inside <body>, <head>, <frameset>. Template can
contain any type of elements. Template can be used as a child of <select> and <table>
elements.
<table> <tr> <template id=“teeds”> <td>..content..</td> </template> </tr>
</table>

8. The .content property is __________


a) read-only
b) write-only
c) read-write
d) hidden
View Answer
Answer: a
Explanation: The .content property is a read-only property i.e a DocumentFragment which
contains guts of template.
function support_temp() {return ‘content’ in
document.createElement(‘template’);} if (supportsTemplate()) {//go !} else
{//use another templating technique.}

9. <template> does not include the attribute ___________


a) id
b) hidden
c) lang
d) src
View Answer
Answer: d
Explanation: <template> only include global attributes. Id, hidden, lang, onsubmit, ontoggle,
onwaiting, onplay, onmousemove, onmousedown, onblur, oncancel, oncanplay, onabort,
title etc. are some of the global attributes.

10. Which browser does not support <template> element?


a) Chrome
b) Firefox
c) Internet Explorer
d) Opera
View Answer
Answer: c
Explanation: On desktop <template> element is supported by most of the browser like
Chrome, Edge, Opera, Safari, Firefox. Internet Explorer does not support this element. On
mobile, it is supported by Edge mobile, Firefox for Android and iOS Safari.

11. Which of the following is not DOM property?


a) element.appendChild(node)
b) document.createElement()
c) element.innerHTML
d) document.getElementById()
View Answer
Answer: d
Explanation: For generating DOM we use certain DOM properties or methods. Some of the
DOM methods are element.appendChild(node), document.createElement(),
element.innerHTML, document.removeElement().
12. Which of the following is not a template library?
a) Mustache
b) Underscore JS library
c) Live.js
d) Handlebars
View Answer
Answer: c
Explanation: There are templating libraries like Handlebars, Mustache, Underscore JS
library. Handlebars are like regular HTML which is embedded with handlebars expressions,
Mustache is used with JavaScript, Underscore JS library is one of the JavaScript libraries
which provides various useful functional programming.

13. Which process is used for the creation of the end result?
a) render()
b) compile()
c) eval(x)
d) encodeURI()
View Answer
Answer: a

1. Major portion of web page contributes _________________


a) image
b) text
c) video
d) audio
View Answer
Answer: a
Explanation: 64% of any website’s page is made up of images. The loading speed of the
websites also slows down due to this much contribution of images in a web page. To reduce
this loading time we use web performance optimization.

2. For image compression which tool is helpful?


a) WordPress cache enable a plugin
b) Optimus wordpress plugin
c) Glup-uglify
d) Speed test tool
View Answer
Answer: b
Explanation: Optimus WordPress plugin is used for lossless as well as lossy image
compression. It automatically reduces the size of the file. Reduction in size is possible up to
70%. There are three versions of Optimus i.e. Optimus HQ, Optimus, Optimus HQ PRO.
Speed test tools are used to measure/note down your pages speed performance.
WordPress cache enable a plugin used to enable caching.

3. HTTP request is between _______________


a) client and host
b) client and server
c) server and host
d) user and server
View Answer
Answer: a
Explanation: HTTP stands for Hypertext Transfer Protocol. For fetching, data from server
browser uses HTTP request, and in between client and host. The more HTTP request
slower the loading of a page will be.
advertisement

4. What does not come under minification?


a) removal of comments
b) removal of new line characters
c) removal of white space characters
d) removal of multimedia elements
View Answer
Answer: d
Explanation: For better web performance we use removal of unnecessary characters from
the source code like white space characters, comments, new line characters, block
delimiters etc.
E.g. the given JavaScript code
var arr=[]; for(var i=0;i<10;i++) {arr[i]=i}; }
is equivalent to the code
for(var arr=[i=0];++i<10;arr[i]=i);

5. Which of the following is not render blocking resource?


a) CSS
b) HTML
c) JavaScript
d) Jquery
View Answer
Answer: d
Explanation: HTML, CSS and JavaScript are render blocking resources to the DOM. To
enhance the speed of your web page these resources should be properly used.

6. For best speed position of JavaScript code should be at ______________


a) top of the code
b) bottom of the code
c) middle of the code
d) anywhere in the code
View Answer
Answer: b
Explanation: For better loading time of the page it is always recommended to put JavaScript
code at the bottom of the main code of the page before </body> tag. CSS code should be at
the beginning of the code.

7. What is the work of TTFB?


a) measures the responsiveness of web server
b) increases the load speed of web page
c) compresses the image
d) remove unnecessary characters
View Answer
Answer: a
Explanation: TTFB stands for time to the first byte and measures the responsiveness of
server. Its calculation is done as: process request time+ HTTP request time+ HTTP
response time. This speed up the website by downloading various smaller images through
sockets.

8. 404 HTTP error is generated due to ____________


a) missing JavaScript file
b) any missing file
c) slow loading of the web page
d) on removing the newline character
View Answer
Answer: b
Explanation: HTTP 404 is an error which indicates that the client was able to communicate
with the server but the server could not find the request. Due to missing of any file 404 error
is generated, this is a taxing error for the page.

9. What is the work of Gzip compression?


a) compresses an image
b) compresses web pages only
c) compresses JavaScript and CSS code only
d) compresses web pages, JavaScript and CSS
View Answer
Answer: d
Explanation: Basically Gzip compression is used to compress text data in websites. Gzip
compression is very useful in web performance optimization. It compresses web pages,
JavaScript and CSS. Gzip is also one of the file formats. Gzip compression can be enabled
via webserver configuration. Common webservers where it can me make enable is
.htaccess, Nginx, Apache and Litspeed.

10. What is hotlink protection?


a) stopping other sites from displaying images
b) stopping other sites from displaying videos
c) stopping access of source code
d) compresses an image
View Answer
Answer: a
Explanation: Hotlink protection is a kind of tool. Hotlink protection is related to restricting
HTTP, it stops other sites from displaying images of your webpage. We can create a list of
hostnames that can access the resources of our website.

11. For best speed position of CSS code should be at __________


a) at the bottom of the code
b) at the middle of the code
c) at the top of the code
d) anywhere in the code
View Answer
Answer: c
Explanation: CSS styling and code should be placed at the top of the code for best loading
result of the webpage. JavaScript code should be placed at the bottom of the page for best
performance and rapid loading speed of the website.

12. What is not the work of database optimization?


a) cleaning out old tables
b) creating indexes
c) optimize datatype
d) delete database
View Answer
Answer: d
Explanation: We store various information in the database. A database is a collection of
tables that contain information. Database delay takes a long waiting time, so there are
various techniques for database optimization. Database optimization basically optimizes
data types, tables, data size.

13. Which of the following is the Waterfall tool?


a) WebPageTest.org
b) dotcom-monitor
c) Pingdom Speed Test
d) GTmetrix
View Answer
Answer: a
Explanation: Waterfall views are useful for front end of the websites. These are the kind of
graphs which shows the order of requesting of resources from a browser. One of the best
online tools is WebPageTest.org also known as WPT.

14. Which of the following is not the layer of the OSI Model?
a) Transport Layer
b) Network Layer
c) Session Layer
d) Atomic Layer
View Answer
Answer: d
Explanation: OSI model stands for Open Systems Interconnection model. It is commonly
used for representing various parts of network traffic. There are seven layers in the OSI
model, Physical Layer, Data Link layer, Network Layer, Transport Layer, Session Layer,
Presentation Layer and Application Layer.

15. Which browser gives maximum parallel connections per host?


a) Opera 10
b) Chrome 1 and 2
c) Safari 3 and 4
d) Firefox 3
View Answer
Answer: a

1. What is the maximum cache size for Chrome?


a) unlimited
b) 300 MB
c) 400 MB
d) 1024 MB
View Answer
Answer: b
Explanation: Maximum Cache size for Chrome is 300 MB, for Safari it is unlimited, For
Opera 10+ it is 400 MB, for Firefox 17 the maximum cache size is 1024 MB, for Internet
Explorer 6,7,8 it is 50 MB and for Internet Explorer maximum cache size is 250 MB.

2. Which of the following is not possible compression value?


a) identity
b) deflate
c) compress
d) DNS
View Answer
Answer: d
Explanation: A identity indicates no compression. Compress is a method that uses UNIX
compress, it is based on LZW algorithm. Gzip is the most famous compression format,
deflate is a kind of gzip without checksum header, it is little faster but less efficient. DNS
stands for Domain Name System and is a naming system in computers.

3. Gzip is not fully supported by ___________


a) Netscape 4.60+
b) Firefox
c) Netscape 6+
d) IE 4+
View Answer
Answer: a
Explanation: Gzip or deflate is partially supported by Netscape 4.60+. Netscape 6+, IE 4+,
Opera 5+, Safari, Chrome, Lynx 2.6+ and Firefox fully support Gzip compression, IE 4.5
and 5 does not support Gzip compression, IE 5.5 and 6.0, IE 6.0 SPI, IE 6,7,8 partially
support Gzip compression.
advertisement

4. What is the size of PHP Module extension mysql.so?


a) 35 KB
b) 42 KB
c) 15 KB
d) 107 KB
View Answer
Answer: b
Explanation: There are more than 80 extensions of the PHP source code. Mysql.so takes
the size 42 KB, apc.so takes 655 KB, ffmpeg.so takes 35 KB, imap.so takes 86 KB, sasl.so
takes 15 KB, tidy.so takes 42 KB, mysqli.so takes 107 KB, gd.so takes 94 KB.

5. Which of the following locking method does not supported by APC?


a) File locks
b) Spin locks
c) Dead locks
d) IPC semaphores
View Answer
Answer: c
Explanation: APC supports four locking methods named File locks, Spin locks, Pthread
mutex, IPC semaphores. File locks are the most stable, Spin lock gives the best
performance, Pthread mutex is only available in Linux version 2.6, IPC semaphores are
faster than file locks.

6. Which of the following is not the class of NoSQL?


a) Document stores
b) Multidimension stores
c) Key-value stores
d) Memcache
View Answer
Answer: d
Explanation: The most basic class of NoSQL is key-value stores and commonly used in
web infrastructure. Multidimension stores are more complex data relationships, here data is
stored in rows and columns. MongoDB and CouchDB are the examples of Document
stores.

7. Which of the following is not a kind of MySQL backup?


a) File backups
b) CSV backups
c) SQL backups
d) Table backups
View Answer
Answer: d
Explanation: There are various backups in MySQL. File backups, SQL backups, backing up
from a slave, CSV backups, Incremental backups are some kind of backups. File backup is
the backup of MySQL database which creates a copy of files from MySQL data directory.
SQL backups are alternate to File backups.

8. Which of the following is the final method to create MySQL backups?


a) LVM snapshots
b) SQL backups
c) CSV backups
d) File backups
View Answer
Answer: a
Explanation: Copy of data or else database is known as backup. The final method for
creating MySQL backups is LVM snapshots. It uses a copy-on-write feature of storage
systems in which LVM i.e. Logical Volume Management is the most popular in Linux. It is
very quick as it creates the snapshots. CSV stands for Cluster Shared Volumes backups.
File backup is the backup of MySQL database which creates a copy of files from MySQL
data directory. SQL backups are alternate to File backups.

9. Which of the following is not MySQL Forks?


a) MariaDB
b) OurDelta
c) Drizzle
d) Sphinx
View Answer
Answer: d
Explanation: Forks are the drop-in replacement of MySQL. Some of the forks are MariaDB,
Drizzle, Percona Server, OurDelta. MariaDB provides compatible general public
license(GPL). Drizzle is better to fork than MariaDB, it is largely compatible with MySQL.
OurDelta provides a combination of MySQL and MariaDB. Sphinx is a full text search
engine of SQL.

10. Which command controls the maximum number of tables that the cache can hold?
a) table_open_cache
b) table_definition_cache
c) open_files_limit
d) read_buffer_size
View Answer
Answer: a
Explanation: The option for table cache is table_open_cache. It controls the maximum
number of tables that the cache can hold, we set the variable equal to the total number of
table, table_definition_cache is the lightweight partner to table cache.

11. For sequential scans of tables we use ____________


a) read_buffer_size
b) join_buffer_size
c) read_rnd_buffer_size
d) sort_buffer_size
View Answer
Answer: a
Explanation: For performing sequential scans of tables we used read_buffer_size, when
reading sorted rows we use read_rnd_buffer_size, join_buffer_size are allocated per-
session thus for multiple join buffers may be created. For performing sort operation we use
sort_buffer_size.

12. How many MPMs can be loaded at a time?


a) 3
b) 1
c) 4
d) 0
View Answer
Answer: b
Explanation: Multi-Process Modules i.e. MPMs is introduced by Apache 2, it controls how
Apache handles the requests. We can load only one MPM at a time. But in the case of
Linux, we can use two MPMs. There are two kind of MPM, worker and prefork.

13. Which version of web worker is introduced in Internet Explorer?


a) Version 3.5
b) Version 10.6
c) Version 10.0
d) Version 4.0
View Answer
Answer: c

1. Each cell of the table can be represented by using __________


a) <tr>
b) <td>
c) <th>
d) <thead>
View Answer
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.

2. For heading we can use ____________


a) <td>
b) <tr>
c) <thead>
d) <th>
View Answer
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.

3. Headings of table lies inside ___________


a) <thead>
b) <tfoot>
c) <th>
d) <tbody>
View Answer
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>
advertisement

4. Which of the following is not the element associated with HTML table layout?
a) size
b) spanning
c) alignment
d) color
View Answer
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.

5. Which of the following element is not associated with a class attribute?


a) Row
b) <thead>
c) Column cell
d) Rows
View Answer
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.

6. For adding caption to the table we use ____________


a) <caption>
b) <thead>
c) <th>
d) <tr>
View Answer
Answer: a
Explanation: For adding caption to the table we use <caption> tag. It should be used just
below the <table> tag.
Syntax is
<table>
<caption> Savings </caption>
<tr> <th> saving </th><th>loss</th> </tr>
<tr><td>$12</td>$45<td></td> </tr>
</table>.

<thead> tag contains the group of header. <tr> is used to indicate start of every row i.e. it
stands for table row. The header information is present in <th> tag.

7. border-spacing is given in _____________


a) pixels
b) cm
c) mm
d) inch
View Answer
Answer: a
Explanation: border-spacing and border-collapse are the two properties by which one can
set the border and its styling in a table. We give its value in pixels.
table { border-collapse: collapse; border-spacing: 14px } th, td{ border: 12
px solid red; padding: 20px 13px; }

8. Borders can’t be applied on ________________


a) <th>
b) <td>
c) <tr>
d) <thead>
View Answer
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;}

9. Which attribute defines numbers of columns in a group?


a) width=multi-length[CN].
b) span=number[CN].
c) scope=scope-name[CN].
d) headers=idrefs[CS].
View Answer
Answer: b
Explanation: span=number[CN] attribute’s value must be an integer and greater than 0. It
specifies the number of columns in a group. When span attribute is not in use, colgroup
defines a single column group containing one column. width=multi-length[CN] specifies
default width of for every column. scope=scope-name[CN] specifies set of data cells for
which going header cell gives header information. The headers=idrefs[CN] provides list of
header cells that gives header information.

10. Which of the following does not specify a column width?


a) Fixed
b) Percentage
c) Proportional
d) Pixels
View Answer
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.

11. Scope attribute can’t have the value __________


a) row
b) rowgroup
c) col
d) <head>
View Answer
Answer: d
Explanation: scope attribute defines a set of data cell. It is used in place of headers. This
attribute can have one of the value among rowgroup, row, colgroup, col, rowgroup, and
colgroup provides information of header cell of the corresponding row and column groups.
12. Which of the following is not the value for frame attribute?
a) above
b) void
c) none
d) box
View Answer
Answer: c
Explanation: Frame attribute gives information about which sides of the frame surrounding
that table will be visible. The values that this attribute can take are lhs, rhs, box, border,
vsides, hsides, below, above, void.

13. Which of the following is not the value for rules attribute?
a) vsides
b) rows
c) all
d) groups
View Answer
Answer: a
Explanation: The rules which will appear between cells of the table is specified by this
attribute. It can take the values groups, none, rows, all and cols. None is the default value,
rows are for appearance between rows only and cols is for columns only.

14. Which of the following is not the value for align attribute?
a) justify
b) char
c) middle
d) left
View Answer
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.

15. valign attribute does not take the value __________________


a) justify
b) middle
c) baseline
d) bottom
View Answer
Answer: a

1. External scripts can’t take the tag _________


a) <script>
b) <form>
c) <h1>
d) <title>
View Answer
Answer: a
Explanation: We used external JavaScript code by saving is as .js extension, we can’t use
<script> tag in external JavaScript file. For using external script, we can use src attribute
and put file name inside it with <script> tag.
Syntax is <script src=”external_file.js”></script>.

When one wants to write a message in console, console.log() is used. The window.alert()
alerts message in box on window.
advertisement

2. For displaying data in JavaScript, we can’t use ____________


a) document.write()
b) console.log()
c) innerHTML
d) document.getElementById()
View Answer
Answer: d
Explanation: We can display data in many ways in JavaScript.They are innerHTML,
console.log(), window.alert(), document.write. document.getElementById(id) is a method
used for accessing HTML element by JavaScript. Here id defines the HTML element.

3. For testing we should use ________


a) document.write()
b) console.log()
c) window.alert()
d) innerHTML
View Answer
Answer: a
Explanation: For testing we used document.write() in JavaScript. If we use document.write()
after HTML document, it will delete all existing HTML. This method can only be used for
testing purposes.
<script> document.write(9*6); </script>

4. Which of the following keyword stops the execution of JavaScript?


a) break
b) return
c) debugger
d) try….catch
View Answer
Answer: c
Explanation: By using debugger keyword execution of JavaScript stops, and is debugger
function is defined it is called at the moment, break is the keyword used to terminate a loop
or a switch, return is used for exit from a function, try…catch handle the errors.

5. Arrays in JavaScript are written within ____________


a) {}
b) [].
c) “”
d) ()
View Answer
Answer: b
Explanation: Arrays in JavaScript are written in square brackets. The elements of array are
separated by commas. Index of array items starts from 0. E.g. var fruits= [“apple”, “orange”,
“banana”, “pine-apple”]; objects in JavaScript are written inside curly brackets.

6. typeof “null” in JavaScript is _______


a) number
b) string
c) object
d) undefined
View Answer
Answer: c
Explanation: typeof “null” in JavaScript is an object. Basically null indicates nothing like it is
a thing that does not exist. It is like a bug in JavaScript that its typeof comes to be an object.
For emptying an object we can set it to null.

7. Negative positions for string do not work in ______________


a) Internet Explorer 8
b) Chrome
c) Safari
d) Opera
View Answer
Answer: a
Explanation: While using slice(), substr() and substring() method we pass numbers as
parameters respective to the string. E.g var tes= str.slice(-10). -10 is indicates negative
position. It does not work in Internet Explorer or older versions.

8. For converting string to array we can use ______________ method.


a) charAt()
b) charCodeAt()
c) split()
d) toLowerCase()
View Answer
Answer: c
Explanation: For converting any string to an array we use split() method. E.g. var
tr=”t,o,I,k,l”; tr.split(“,”); tr.split(“|”); tr.split(“ ”); charAt returns a character from the given
index, charCodeAt() returns Unicode of character at the given index. toLowerCase() method
converts input string into lower case string.

9. JavaScript numbers are stored as ______________


a) integers
b) double precision floating point
c) double
d) floating point
View Answer
Answer: b
Explanation: The numbers according to international IEEE 754 standard are stored as a
double precision floating point. It stores the numbers in 64-bit format, stored in bits from 0 to
51, exponent in bits is from 52 to 62 and signs in a bit is 63.
10. The integers in JavaScript are precise up to ___________
a) 12 digits
b) 10 digits
c) 23 digits
d) 15 digits
View Answer
Answer: d
Explanation: The integers in JavaScript have accuracy up to 15 digits. E.g. var
y=111111111111111; // value of y will be 111111111111111. For decimal the maximum
number of decimals is 17.

11. Typeof “infinity” will return ___________


a) string
b) number
c) object
d) undefined
View Answer
Answer: b
Explanation: The typeof “infinity” will return number. E.g. typeof Infinity; // it will return
“number”, when we divide any number by zero it will generate infinity.
Syntax is var number=9; while(number != Infinity) { number= number + number; }

12. By default JavaScript displays the numbers as ___________


a) base 16
b) base 10
c) base 6
d) base 2
View Answer
Answer: b
Explanation: base 10 decimals are displayed as numbers by default by JavaScript. We can
use toString() method for converting numbers as any of the base among 16, 2, 8. E.g var
number= 1256; number.toString(6); number.toString(16); number.toString(2).

13. Which method is not used for converting variables to number?


a) parseInt()
b) Number()
c) parseFloat()
d) valueOf()
View Answer
Answer: d
Explanation: There are mainly three methods with the help of those we can convert
variables to numbers. The methods are the parseFloat() method, the Number() method, the
parseInt() method. These are global JavaScript methods. valueOf() method return number
as a number only.

14. Math.random() returns _______________


a) random number between 0 and 1
b) random number between 1 and 10
c) random number between 1 and 100
d) random number between 0 and 10
View Answer
Answer: a
Explanation: Math.random() generate any random number between 0 and 1. If we use
Math.random() with Math.floor() it returns any random integer. E.g. Math.floor(Math.random
* 1000); It will generate any random number between 0 and 999. For the sake of
convenience we can also define a random function.

15. What is the Boolean value of “” in JavaScript?


a) true
b) on
c) off
d) false
View Answer
Answer: d

1. jQuery does not contain the _____________ feature.


a) AJAAX
b) AJAX
c) CSS manipulation
d) Effects and animations
View Answer
Answer: a
Explanation: jQuery contains many features like CSS manipulation, AJAX, Effects, and
animations, Utilities, HTML event methods, HTML/DOM manipulation. There are also
jQuery plugins for every given task. jQuery simplifies complicated things in JavaScript.

2. What is the correct syntax of jQuery?


a) action().$(selector)
b) $(selector).action()
c) (selector)$.action()
d) action().(selector)$
View Answer
Answer: b
Explanation: The basic syntax of jQuery is $(selector).action(), $ sign defines access of
jQuery, (selector) is HTML element, action() is for the jQuery action that is to be performed.
E.g. $(“h1”).hide(), this will hide all the <h1> elements.

3. In jQuery all the elements are selected by writing ____________


a) $(this)
b) $(“:button”)
c) $(“*”)
d) $(“.class_name”)
View Answer
Answer: c
Explanation: In jQuery all the elments are selected by writing $(“*”). $(this) helps in selecting
current HTML element. All the button elements are selected by writing $(“:button”). If we
want to select a specific class we should write $(“.class_name”).
advertisement
4. Which of the following is not event method in jQuery?
a) click()
b) mouseenter()
c) mousedown()
d) hide()
View Answer
Answer: d
Explanation: The actions that can be performed on the web page are called events. Some
common DOM events are blur(), click(), bilnd(), change(), dbclick(), eroor(), delegate(),
die(), event.data, event.currentTarget, event.pageX, mouseenter(), mousedown(),
event.result, event.target, focus(), hover(), keydown(), focusout(), live(), load(), keyup() etc.

5. hover() method is the combination of ____________


a) mouseleave() and mouseeneter()
b) mousedown() and mouseenter()
c) mouseup() and mousedown()
d) mouseleave() and mousedown()
View Answer
Answer: a
Explanation: hover() method is the combination of mouseleave() and mouseenter(). It takes
two functions. When the mouse leaves HTML element then mouseleave() function is called
and when mouse enters HTML element then mouseenter() function is called.

6. Which of the following is not the fade method in jQuery?


a) fadeTo()
b) fadeOn()
c) fadeOut()
d) fadeIn()
View Answer
Answer: b
Explanation: jQuery has various fade methods including fadeout(), fadeTo(), fadeToggle(),
fadeIn().
The syntax of fadeIn() is $(selector).fadeIn(speed,callback);
For fadeout() we use $(selector).fadeOut(speed,callback);
For fadeToggle we use $(slecetor).fadeToggle(speed,callback);
For fadeTo() syntax is $(selector).fadeTo(speed,opacity,callback).

7. Which of the following is not the sliding method in jQuery?


a) slideToggle()
b) slideDown()
c) slideUp()
d) slideIn()
View Answer
Answer: d
Explanation: jQuery have three slide methods namely slideUp(), slideDown() and
slideToggle().
Syntax for slideDown() is $(selector).slideDown(speed,callback);
For slideUp() we use $(selector).slideUp(speed,callback).
For slideToggle() method the syntax is $(selector).slideToggle(speed,callback).
8. Which of the following is not the jQuery method for manipulation?
a) stop()
b) html()
c) text()
d) val()
View Answer
Answer: a
Explanation: For attributes manipulation we use three methods named html(), text() and
val(). The content of selected elements is returned by html(). The text content of selected
elements is returned by text(). The values of form fields is returned by val().

9. The method not used to add new content is ___________


a) after()
b) prepend()
c) before()
d) add()
View Answer
Answer: d
Explanation: In jQuery there are four methods to add new content namely prepend(),
before(), after(), append(). The append() method inserts at the end, prepend() method
inserts at the beginning of the content, after() method inserts the content after selected
HTML element, befor() inserts before the selected HTML element.

10. Which method is not used for CSS manipulation?


a) toggleClass()
b) removeClass()
c) beforeClass()
d) css()
View Answer
Answer: c
Explanation: There are several functions for CSS manipulation. Some of them are css(),
removeClass(), toggleClass(), addClass(). The style attribute is returned by css() method.
Classes are added by addClass() method. Classes are removed by removeClass() method.
The toggling between adding and removing classes is achieved by toggleClass() method.

11. Which of the following is not a jQuery dimension method?


a) innerWidth()
b) outerHeight()
c) height()
d) css()
View Answer
Answer: d
Explanation: There are various important methods for dimension. Some of them are
height(), innerHeight(), outerWidth(), outerHeight(), width(), innerWidth(). Width() method
includes border, margin and padding. innerWidth() and innerHeight() method includes
padding. outerHeight() and outerWidth() method includes border and padding. CSS()
method is used for CSS manipulation in jQuery.
12. Which method is not used for traversing DOM tree?
a) parent()
b) parentsUntil()
c) parents()
d) after()
View Answer
Answer: d
Explanation: There are three methods for the traversal of DOM tree. Parent(),
parentsUntil(), parents(). Direct parent element is returned by parent() method. All the
ancestor elements are returned by parents() method. All the ancestor elements that are
between given two arguments are returned by parentsUntil() method.

13. Which method is not for traversing DOM tree sideways?


a) parent()
b) siblings()
c) prev()
d) nextAll()
View Answer
Answer: a
Explanation: There are methods for traversing DOM tree sideways. Some of them are
next(), prev(), prevAll(), nextAll(), siblings(), prevUntil(), next(). All the sibling elements are
returned by siblings() method. The next sibling is returned by next() method. All the next
siblings are returned by nextAll() method.

14. Which method is not used for filtering in jQuery?


a) next()
b) first()
c) eq()
d) last()
View Answer
Answer: a
Explanation: The basic filtering methods are eq(), not(), filter(), last() and first(). The first
element is returned by first() method, last element is returned by last() method, the specific
index number of element is returned by eq() method.

15. AJAX is not used in _____________


a) Gmail
b) Youtube
c) Facebook
d) Yahoo
View Answer
Answer: d

1. Which of the following is not a method of AJAX?


a) get()
b) getJSON()
c) post()
d) stop()
View Answer
Answer: d
Explanation: AJAX is basically used for exchanging data with server. There are several
methods in jQuery for AJAX. Ajax(), ajaxSetup(), ajaxPrefilter(), ajaxTransport(), getJSON(),
post(), ajaxSend(), ajaxError(), load(), serializeArray(), serialize(), ajaxStop(), ajaxStart() are
some of the methods.

2. Correct syntax for $.post() method is ____________


a) $.post(URL,data,callback)
b) $.post(URL,data)
c) $.post(URL,callback)
d) $.post(data,callback)
View Answer
Answer: a
Explanation: The correct syntax for $.post() method is $.post(URL,data,callback). URL is
the URL we want to request for. Callback is the name of the function that is to be executed.
Data specifies the data that is to be send with the request.

3. The method releases jQuery’s control of $ is __________


a) $.param()
b) $.noConflict()
c) each()
d) data()
View Answer
Answer: b
Explanation: $.noConflict() method releases control of $ in jQuery. A reference to jQuery is
returned by noConflict() method. E.g. var ty=$.noConflict(); ty(document).ready(function())
{ ty(“button”).click(function() {ty(“h”).text(“It is working!”);}); });. $.param() jQuery AJAX
method is the representation of an object or array. An each() method particularize function
to run for every matched element. data() method either connects data to selected elements
or get data from them.
advertisement

4. In JavaScript, which one is used to finding the non-whitespace characters?


a) \d
b) \s
c) \S
d) \w
View Answer
Answer: c
Explanation: There are metacharacters defined in JavaScript. \S is used to find the non-
whitespace character. \d is used for finding a digit. \s is used for finding whitespace
character. \w is used to find word character. \W is used to find non word character.

5. Which one is not regular expression object method?


a) test()
b) exec()
c) compile()
d) each()
View Answer
Answer: d
Explanation: compile(), toString(), exec(), test() are some of the regular expression methods
in JavaScript. Compile() is method that compiles regular expression. Test() method is for
matching in a string. Exec() is also for matching in a string but it returns first match.
toString() method returns string value.

6. Which is not a JavaScript global function?


a) compile()
b) eval()
c) decodeURI()
d) isNaN()
View Answer
Answer: a
Explanation: There are various global functions in JavaScript, decodeURI(), escape(),
isFinite(), eval(), isNaN(), encodeURI(), decodeURIComponent(), encodeURIComponent(),
isFinite(), is NaN(), parseFloat(), String(), parseInt(), unescape() are some of the methods.

7. Which of the following is not window object property?


a) defaultStatus
b) closed
c) constructor
d) frames
View Answer
Answer: c
Explanation: Window object properties are frames, history, frameElement, defaultStatus,
closed, innerHeight, document, innerWidth, location, name, outerHeight, outerHeight,
opener, pageXOffset, parent, screenTop, screen, screenLeft, screen, scroll, status, self,
sessionStorage, top.

8. Which of the following is not window object method?


a) blur()
b) close()
c) confirm()
d) unescape()
View Answer
Answer: d
Explanation: Some of the window object methods are atob(), close(), focus(), blur(), alert(),
clearInterval(), confirm(), btoa(), getComputedStyle(), open(), moveTo(), prompt(),
matchMedia(), moveBy(), getSelection(), scroll(), setInterval(), stop(), setTimeout() etc.

9. Which of the following is not navigator object property?


a) appVersion
b) geolocation
c) document
d) cookieEnabled
View Answer
Answer: c
Explanation: The navigator object properties are appVersion, cookieEnabled,
appCodeName, geolocation, appName, product, userAgent, platform, online, language.
Engine name of the browser is returned by product and the language of the browser is
returned by language.

10. Which of the following is the Navigator object method?


a) javaEnabled()
b) moveBy()
c) scroll()
d) stop()
View Answer
Answer: a
Explanation: There are two navigator object methods namely taintEnabled() and
javaEnabled(). taintEnabled() the ability of the browser of data tainting. This method can’t
be used in JavaScript 1.2 version. javaEnabled() method specifies whether Java is enabled
in the browser or not.

11. Which of the following is not screen object property?


a) width
b) colorDepth
c) pixelDepth
d) language
View Answer
Answer: d
Explanation: The screen object properties are availWidth, pixelDepth, width, height,
colorDepth, availDepth. The total width of the screen is returned by width, height returns the
total height of the screen, pixelDepth returns color resolution of the screen in pixels.

12. Which is not the method of History object?


a) go()
b) moveBy()
c) forward()
d) back()
View Answer
Answer: b
Explanation: There are mainly three methods of history object, forward(), back() and go().
The next URL of history list is loaded by calling forward() function. The previous URL in the
history list is loaded by back() method. A specific URL from history list is loaded by go()
method.

13. Which is not the location object method?


a) stop()
b) reload()
c) assign()
d) replace()
View Answer
Answer: a
Explanation: assign(), replace(), reload() are the location object methods. A new document
is loaded by calling assign() method. The current document is replaced by the new one by
calling replace() method. Current document is reloaded by reload() method.
14. Which is not the property of location object?
a) origin
b) port
c) host
d) geolocation
View Answer
Answer: d
Explanation: The properties of location object are host, origin, port, pathname, hostname,
href, hash, protocol, search. The port number of URL is set by port. The entire URL is set by
href, path name of URL is set by pathname property, protocol of URL is set by protocol
property.

15. Which of the following is not DOM property?


a) document.anchors
b) document.cookie
c) document.body
d) document.origin
View Answer
Answer: d

1. For explaining, which new technology is used?


a) <dfn>
b) <cite>
c) <abbr>
d) <address>
View Answer
Answer: a
Explanation: When for the first time when we explain any new terminology like any jargon or
any academic concept in the document we use <dfn> It is defining an instance of it. It is
used for defining an instance of a new term. In some browsers, the content of <dfn> are
shown in italics but in Chrome and Safari, nothing will be changed. Title of work is defined
by <cite>. <abbr> is for abbreviation. Information about author or owner is provided by
<address>.

2. Which element indicates about something which is no longer accurate?


a) <s>
b) <ins>
c) <del>
d) <address>
View Answer
Answer: a
Explanation: <s> indicates about something that is no longer relevant or accurate. It should
also not to be deleted. The content of this element is displayed a line through the center. In
older versions of HTML it had <u> element for the content to be underlined, but now it is no
longer in use. Information about author or owner is provided by <address>. A text which has
been inserted into a document is defined by a <ins>. <del> describes a text that has been
deleted from a document.
3. Metadata does not define _________
a) character set
b) links
c) scripts
d) color
View Answer
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>.
advertisement

4. In HTML5 which element defines thematic change in the content?


a) <hr>
b) <h1>
c) <head>
d) <p>
View Answer
Answer: a
Explanation: For thematic change in the content <hr> tag is used. It is also used to separate
content or for defining a change in any HTML page. All the browsers like Internet Explorer,
Firefox, Opera, Chrome, Safari supports this element.

5. Which element defines preformatted text?


a) <p>
b) <pre>
c) <hr>
d) <ins>
View Answer
Answer: b
Explanation: <p> defines paragraph/text.

element is used for horizontal/thematic break. 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>..

6. Which element is used for creating links?


a) <a>
b) <p>
c) <li>
d) <ol>
View Answer
Answer: a
Explanation: <a> element is used for creating links. We can click anything written between
opening <a> tag and closing </a> tag. E.g. <a href= “http://www.gmail.com”> GMAIL </a>.
The text written between <a> and </a> is called link text. <p></p> defines paragraph. <li>
specifies list of item. <ol> is ordered list which can be either numerically or alphabetically.

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

8. What is the color of an unvisited link?


a) red
b) blue
c) purple
d) green
View Answer
Answer: b
Explanation: In all browsers by default the color of an unvisited link is blue. The color of a
visited link is purple. The color of the active link is red. The link is underlined by default. E.g.
www.google.com We can also change these default colors by the use of style.

9. Which one of the following is not the value of the target attribute?
a) _blank
b) _top
c) _self
d) _empty
View Answer
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.

10. 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”>
View Answer
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.

 
 
11. File paths are not used for linking in _________
a) JavaScripts
b) PHP
c) Style Sheets
d) Images
View Answer
Answer: b
Explanation: The location of a file in web site’s folder structure is described by file path. File
paths are used for linking to external files like Images, JavaScripts, Web Pages, Style
sheets. The full URL to internet file is an absolute file path.

12. For defining bookmarks in a page we use __________


a) href
b) id
c) target
d) <a>
View Answer
Answer: b

1. Which tag is used for List items?


a) <li>
b) <ol>
c) <ul>
d) <dl>
View Answer
Answer: a
Explanation: li is for the list items. The list is indented by default by the browser. <li> is
written inside <ol> element having opening <li> tag and closing </li> tag. Sometimes <ol>
can also include type attribute which defines type of numbering. <ol> represents a ordered
list where as <ul> is unordered list. A description list is specified by <dl> tag.

2. Which element contains definition?


a) <dl>
b) <dd>
c) <dt>
d) <ul>
View Answer
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.

3. Which of the following can’t be the value of list-style-type?


a) square
b) circle
c) ellipse
d) disc
View Answer
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.
advertisement

4. For displaying a list horizontally, we can use ______________


a) <dd>
b) display:inline
c) <dt>
d) type
View Answer
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.

5. Which attribute is only used with <ol>?


a) value
b) type
c) compact
d) start
View Answer
Answer: d
Explanation: The number attribute is only used with <ol>. The starting number of the first
item in an ordered list is specified by this attribute. The default number for starting is ‘1’. The
corresponding labels can be non numeric even its value is set to numeric. The “start” and
“type” attribute are removed from HTML4.01 but can be still used in HTML5 where as
“compact” attribute is not used in HTML5.

6. Which element is restricted to inline content?


a) <dt>
b) <dd>
c) <ul>
d) <dl>
View Answer
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.

7. Which element was designed for creating multicolumn directory lists?


a) menu
b) dir
c) ul
d) ol
View Answer
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.

8. The content property does not include __________


a) Strings
b) URIs
c) Normal
d) Color
View Answer
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.

9. Which character is used to differentiating between choices to list items?


a) ‘|’
b) ‘>’
c) ‘#’
d) ‘$’
View Answer
Answer: a
Explanation: ‘|’, a pipe character is used to differentiate between choices. It is a separating
character. It can be emulated by adding borders to list items. E.g. #pipe ul li.first {margin-
left: 0; list-style: none; margin-left: none; display: inline; }. Here we have added class=”first”
so that it does not end up with a border on the left side.

10. Which of the following is not true regarding to counter?


a) counter(name,style)
b) counter(name)
c) counter(string)
d) counter(name,string,style)
View Answer
Answer: c
Explanation: There are two functions for specifying counters, ‘counter()’ or ‘counter()’. First
one has two forms ‘counter(name,style)’ and ‘counter(name)’. The second one also has two
forms ‘counter(name,string,style)’ and ‘counter(name,string)’.

11. Which property specifies the distance between nearest border edges of marker box and
prinicipal box?
a) marker-offset
b) counter increment
c) list-style
d) list-style-image
View Answer
Answer: a

1. target attribute cannot have?


a) _blank
b) _self
c) _parent
d) _color
View Answer
Answer: d
Explanation: Target attribute can have values _blank, _self, _parent, _top and filename.
_blank opens the linked document in a new tab window or tab, _self opens linked document
in the same window, _parent opens linked document in the parent frame.

2. Which of the following opens linked document in full body?


a) _blank
b) _top
c) _parent
d) framename
View Answer
Answer: b
Explanation: _parent opens linked document in parent frame, _top opens the linked
document in full body of the window, framename opens the linked document in a named
frame,
e.g. <a href= https://www.sanfoundry.com/ target= “_parent”> Visit The site !!
</a>.

3. Which attribute is used to link the bookmark?


a) href
b) id
c) target
d) <img>
View Answer
Answer: a
Explanation: href attribute is used to link the bookmark. The id attribute is for defining
bookmarks in a page, target attribute is for specifying where to open linked document i.e. in
new tab, same frame, parent frame, full body of the window etc.
advertisement
4. Which of the following sets the color of a link before it has been clicked on?
a) ALINK
b) LINK
c) VLINK
d) ULINK
View Answer
Answer: b
Explanation: LINK set the color of a link before it has been clicked on, ALINK set the color
of a link when a link is clicked on, VLINK set the color of a link after it has been clicked on,
here A and V stands for Active and Visited.

5. What is used for specifying an email to be sent?


a) mailto:
b) target
c) id
d) href
View Answer
Answer: a
Explanation: Target attribute is for specifying where to open linked document i.e. in a new
tab, same frame, parent frame, full body of the window etc. We use mailto: with <a> and
href for specifying the email address that we want to be sent to. It will open a new email
message and address to a person specified in the link. The email link will appear like a
normal link. The id attribute is for defining bookmarks in a page.

6. Which of the following is not the parameter for email link?


a) body
b) bcc
c) cc
d) #
View Answer
Answer: d
Explanation: There are various parameters used for email links like mailto, bcc, body, cc,
subject, ‘&’, ‘?’. mailto: is used for e-mail recipient address, bcc is for blind carbon copy mail
address, cc is for carbon copy e-mail address, subject is for the subject of the e-mail, ‘?’ is
first parameters delimiter.

7. Which one of the following is used for space character?


a) %50
b) %60
c) %20
d) %10
View Answer
Answer: c
Explanation: %50 represent a capital letter P. %60 specifies “`” symbol. %20 represents
space character.
<a href=mailto:enquiry@sanfoundry.com?
Cc=name1@sanfoundry.com&bcc=name2@sanfoundry.com&amp;
subject=The%20subject%20is&amp;body=The%20body%20is”>
mail with cc, bcc, subject and body</a>
. A data link escape is shown by %10.

8. What will add line break in the body of mail?


a) %20
b) %0D%0A
c) %0h%0A
d) %10
View Answer
Answer: b

1. which extension flash file is to be saved?


a) .fla
b) .swf
c) .jpg
d) .gif
View Answer
Answer: a
Explanation: The flash file created in flash authoring environment, it is saved with .fla
extension. If we want to use this file on a web page it has to be saved in a different format
known as SWF. Its extension is .swf

2. For exporting movie into SWF format which element is used?


a) <object>
b) <video>
c) <datalist>
d) <dd>
View Answer
Answer: a
Explanation: We use <object> and <embed> elements for exporting movie into SWF format.
A code is created by flash that can be used to embed Flash movie into the page.
Traditionally these elements were used but now JavaScript has taken their place.

3. Which plugin is used to view Flash?


a) Firebug
b) Flash Player
c) Widget
d) Zotero
View Answer
Answer: b
Explanation: For viewing Flash the browser needs to use a plugin. A plugin is an extra piece
of software that can be run in a browser. Here the plugin which is used is Flash Player. It is
very common that 98% of the browsers have already Flash plugin installed inside.
advertisement

4. Which one of the following does not support flash?


a) iPhone
b) android
c) windows
d) linux
View Answer
Answer: a
Explanation: Apple launched the iPhone in 2007 and launched an iPad in 2010, they
decided not to support Flash. Flash content has been criticized because Flash content is
not always accessible. In 2008 <video> and <audio> tags are supported by the browsers in
HTML5.

5. Which one of the following is used for adding Flash in the web page?
a) CSS
b) jQuery
c) PHP
d) JavaScript
View Answer
Answer: d
Explanation: One of the most popular for adding Flash to the web page is using JavaScript.
There is no need to understand this language in depth because there are many scripts
already available that are available to do this.

6. Which one of the following is not used inside the <script> tag in Flash videos?
a) replace
b) location
c) version
d) id
View Answer
Answer: d
Explanation: There are five attributes that can be used inside the <script> tag in Flash
videos namely width, height, version, location and replace. The minimum version of the
Flash player needed to view the movie is specified by version. Width and Height of Flash
movie are specified by width, height. The location of .swf file is specified by location.

7. Which one of the following is not the online video format available?
a) Ogg Theora
b) VHS
c) WebM
d) H264
View Answer
Answer: b
Explanation: Online there are movies available in many formats like Ogg Theora, WebM,
QuickTime, AVI, Flash Video, MPEG, Windows Media etc. There are also some of the
offline formats like DVD, VHS, BlueRay etc.

8. For playing Flash Video you need to convert video into the ___________ format.
a) FLV
b) BlueRay
c) WebM
d) MPEG
View Answer
Answer: a
Explanation: For playing Flash video one must convert the video into FLV format. Flash 6,
the Flash authoring environment comes with Flash Video Encoder to convert the videos into
FLV formats. It also supports H264 format.

9. Which one of the following site will provide FLV player?


a) www.longtailvideo.com
b) www.fotolia.com
c) www.sxc.com
d) www.pixlr.com
View Answer
Answer: a
Explanation: We need a player written in Flash for playing FLV files. The main purpose of it
is to hold FLV movie and add controls like pause/play. There are two sites that offer FLV
players www.longtailvideo.com and www.osflv.com

10. WebM format is not supported by _______


a) Opera
b) Android
c) Safari
d) Firefox
View Answer
Answer: c
Explanation: Not all the browsers support the same video formats. WebM is supported by
Chrome, Opera, Android and Firefox. Internet Explorer and Safari support H264 format very
easily. Some Flash player also supports H264 format and WebM.

11. Which attribute allows to show an image while downloading a video?


a) controls
b) poster
c) preload
d) none
View Answer
Answer: b
Explanation: The poster attribute allows us to specify an image to show at the time of
downloading of video or until the user tells the video to play. Controls attributes indicate that
browser should supply its own controls for playback the video.

12. codecs is used with _______


a) type
b) src
c) auto
d) loop
View Answer
Answer: a
Explanation: In multiple video sources we use codec which is used to encode the video. It is
supplied within type attribute.
E.g. <video> <source src=”video/tommy.mp4” type= ‘video/mp4;codecs=
“fyty.42E01E. mp4a.40.2”’ /> </video>
13. What can’t be the value of a quality attribute?
a) autolow
b) low
c) high
d) automedium
View Answer
Answer: d
Explanation: The quality parameter can have values including “low”, “medium”, “best”,
“high”, “autohigh”, “autolow”. When it is set to “low” videopalyer will favor playback speed of
video clip and anti aliasing will not be used.

14. Which is the best format to use in Firefox?


a) .MP4
b) .FLV
c) .OGG
d) .SWF
View Answer
Answer: c
Explanation: .OGG format is the best for the use in Firefox. We can use VLC to convert the
video into this format. .FLV and .SWF is not supported by all the browsers. .MP4 is
supported by Safari and Chrome at its best.

15. Full screen support will not work in ____________


a) Safari
b) Firefox
c) Internet Explorer
d) Opera
View Answer
Answer: a

1. Which of the following works as a sidebar?


a) <aside>
b) <footer>
c) <details>
d) <section>
View Answer
Answer: a
Explanation: <aside> defines content aside from the content like a sidebar, <footer> defines
a footer for a document or a section, <details> defines additional details, <section> defines
a section in a document.

2. Which of the following can’t be the value of float property?


a) left
b) right
c) center
d) inherit
View Answer
Answer: c
Explanation: float property can have the property left, right, none, inherit. When set to inherit
value the element inherits the float value of its parent, when set to none property the
element does not float, it is the default value.

3. Which of the following can’t be the value of a clear property?


a) left
b) inherit
c) right
d) center
View Answer
Answer: d
Explanation: clear property specifies what elements can float beside cleared element and
on which side. It can hold the values none, left, right, both and inherit. The inherit property
inherits the clear value of its parent when setting to both no floating elements allowed on
either the left and right side.
advertisement

4. Which of the following specifies what happens if content overflow an element’s box?
a) overflow
b) overflow-x
c) overflow-y
d) float
View Answer
Answer: a
Explanation: overflow property specifies what happens if content overflows an element’s
box, overflow-x specifies what to do with left/right edges of the content if it overflows the
element’s content area, overflow-y specifies what to do with top/bottom edges of the content
if it overflows the element’s content area.

5. Which of the following was not previous layout mode?


a) Block
b) Flexbox layout
c) Inline
d) Positioned
View Answer
Answer: b
Explanation: Before Flexbox layout module there were four layout modes. Block, Inline,
Table, Positioned. Block is for sections in a webpage, inline is for text, table is for two
dimensional table data, positioned is for explicit position of an element.

6. Which property defines in which direction the container wants to stack flex items?
a) flex-flow
b) flex-wrap
c) flex-direction
d) align-content
View Answer
Answer: c
Explanation: flex-direction property defines in which direction the container wants to stack
the flex items, the flex-flow property is shorthand property for setting both flex-direction and
flex-wrap properties. For deciding whether the flexible items should wrap or not, flex-wrap
property is used.

7. Which property is used to align flex items?


a) align-items
b) justify-content
c) align-content
d) flex-grow
View Answer
Answer: b
Explanation: justify-content property is used to align flex items, the align-items property is
used to align flex items vertically, the align-content property is used to align flex lines, flex-
grow specifies how much a flex item will grow relative to rest of flex items.

8. Which of the following specifies initial length of flex item?


a) flex-flow
b) flex-grow
c) flex-shrink
d) flex-basis
View Answer
Answer: d
Explanation: flex-basis property specifies the initial length of the flex item, flex-shrink
property specifies how much a flex item will shrink relative to rest of flex items, the value
must be a number and a default value is 1. The flexible-grow property is a relative
comparison between the items. It decides how much item will grow relative to the rest of
flexible items inside the same container.

9. Which of the following overrides container’s align-items property?


a) order
b) align-self
c) align-items
d) flex
View Answer
Answer: b
Explanation

1. Which one of the following contains information about the author?


a) <footer>
b) <header>
c) <head>
d) <body>
View Answer
Answer: a
Explanation: Footer for its nearest sectioning content or sectioning root element is
represented by <footer> element. It typically contains information about author of the
section, links to related documents or copyright data. An introductory content lies in
<header>. <head> is container for all head elements. A document’s body is defined by
<body> tag.
2. Header element does not contain ___________
a) logo
b) <address>
c) heading elements
d) authorship information
View Answer
Answer: b
Explanation: <header> element contains one or more than one heading elements,
authorship information, logo or icon. <header> tag can’t be placed inside <address> or
<footer> or inside another <header> element.

3. Which element contains major navigational block?


a) <nav>
b) <address>
c) <footer>
d) <header>
View Answer
Answer: a
Explanation: The major navigational blocks on site like primary site navigation is contained
by <nav> element.
advertisement

E.g.
<nav>
<ul>
<li><a href="https://www.sanfoundry.com/" class= “dream”>HTML</a> </li>
<li><a href="https://www.sanfoundry.com/">CSS</a> </li>
<li><a href="https://www.sanfoundry.com/">PHP</a> </li>
</ul>
</nav>

Footer typically contains information about author of the section, links to related documents
or copyright data. An introductory content lies in <header>. Contact information of
author/owner of a document can be provided by <address> tag.

4. Which element represents self-contained composition in document?


a) <nav>
b) <header>
c) <footer>
d) <article>
View Answer
Answer: d
Explanation: A self-contained composition in document, application, page or site that is
intended to be independently distributable is represented by <article> element. Some of the
examples are a magazine or newspaper article or a forum post, or a blog entry. <nav>
element contains all the nevigation links. Footer typically contains information about author
of the section, links to related documents or copyright data. An introductory content lies in
<header>.

5. Which of the following element is used as a container for content?


a) <aside>
b) <article>
c) <address>
d) <footer>
View Answer
Answer: a
Explanation: <aside> element can be used inside <article> or outside it also. When it is
used inside <aticle> it contains information that is related to article. When <aside> is used
outside <article>, it acts as container for content that is related to the whole page. Contact
information of author/owner of a document can be provided by <address> tag. Footer
typically contains information about author of the section, links to related documents or
copyright data.

6. Which element groups related content together?


a) <aside>
b) <footer>
c) <section>
d) <div>
View Answer
Answer: c
Explanation: Grouping of related content together is done by <section> element. Each
section will have its own heading. This element should not be used as wrapper for entire
page. If we wish of containing a element for entire page, this will be best done by <div>
element. Footer typically contains information about author of the section, links to related
documents or copyright data. <aside> is a container of contetnt related to it’s surrounding.
For grouping together related elements we use <div> element.

7. For grouping together one or more <h1> to <h6> element what element is used?
a) <header>
b) <hgroup>
c) <div>
d) <section>
View Answer
Answer: b
Explanation: For grouping together set of one or more <h1> to <h6> element we use
<hgroup> element. We can group together the primary heading and the subheading. E.g.
<hgroup> <h2> Winter is coming!</h2> <h3>Its too cold</h3> </hgroup>. Grouping of
related content together is done by <section> element. For grouping together related
elements we use <div> element. An introductory content lies in <header>.

8. Which element is used for grouping together related elements?


a) <div>
b) <hgroup>
c) <section>
d) <header>
View Answer
Answer: a

1. Which browser was the first that allows CSS rules to be associated with new HTML5
layout elements?
a) Internet Explorer 9
b) Internet Explorer 7
c) Chrome
d) Firefox
View Answer
Answer: a
Explanation: Internet Explorer was the first version that allowed CSS rules to be associated
with new HTML5 layout elements. Older browsers that do not know new HTML5 elements
will by default treat them as inline elements.

2. Which element is used for or styling HTML5 layout?


a) PHP
b) JavaScript
c) CSS
d) jQuery
View Answer
Answer: c
Explanation: For styling HTML5, CSS i.e Cascading Style Sheet is used. It is style sheet
language and designed to describe presentation of its content including layouts, colors and
fonts. CSS can control the layout of multiple web pages.

3. Which syntax will cause IE to recognize section element?


a) getElementById(“section”)
b) createElement.document(“section”)
c) document.createElement(“section”)
d) document.createElement(“<section>”)
View Answer
Answer: c
Explanation: document.createElement(“section”) will cause Internet Explorer to recognize
section element all of a sudden. There is no any reason behind this working but it works.
We do not even need to use node that is returned by that function.
advertisement

4. Dirty Markup will not validate ___________


a) CSS
b) JavaScript
c) PHP
d) HTML
View Answer
Answer: c
Explanation: Linter application will point out the errors and can flag up the warning about
bad practices in CSS. There is so many online linter application. Dirty Markup is the best
one used for JavaScript, CSS, and HTML. CSS Lint is for CSS only. Dirty Markup also
provides to fix your markup using a clean button.

5. For handling CSS prefixes Chrome uses ___________


a) –ms-
b) –webkit-
c) –moz-
d) –chr-
View Answer
Answer: b
Explanation: Handling CSS prefixes is a mechanism originally used to allow browser
vendors to implement their own version of CSS. Mozilla uses –moz-, Microsoft uses –ms-,
Chrome, Safari, Opera uses –webkit-.

6. Which one of the following will add prefix automatically?


a) Gulp
b) PostCSS
c) Selectivizr
d) MooTools
View Answer
Answer: b
Explanation: We can add prefixes automatically during the time of development. This can
be done using tools like PostCSS and Autoprefixer. Autoprefixer has an online version that
allows to enter non-prefixed CSS on left, and gives prefix-added version on the right. Gulp
is an open source kit for js i.e. JavaScript. A javascript utility that emulates CSS3
pseudoclasses and attribute selectors are called selectivizr. Moo Tool is a javascript
framework which is object oriented.

7. The search that can’t be targeted by SEO is _______


a) video search
b) image search
c) academic search
d) audio search
View Answer
Answer: d
Explanation: SEO stands for Search Engine Optimization. SEO can target different kinds of
search including video search, image search, academic search, industry specific vertical
search, news search. It differs from local search engine optimization. Optimization of a
website includes editing its content, doing HTML, and associated coding to increase its
relevance to specific keywords.

8. Which of the following does not use a crawler to find pages for the search result?
a) Bing
b) Backrub
c) Yahoo
d) Google
View Answer
Answer: b
Explanation: Leading search engines like Bing, Google and Yahoo use crawlers for finding
pages for the algorithmic search results. Pages linked from other search engine indexed
pages do not need to be submitted because they are found by default.

9. For keeping blog comment spam down we use ___________


a) nofollow
b) meta
c) title
d) heading
View Answer
Answer: a
Explanation: nofollow attribute is used for comments in blogs to keep blog comment spam
down. This tag was created to keep spammy users away. This attribute tells Google and
other search engines to not follow the link to the next page. Heading contains tag starting
from h1 to h6. Title of the document is defined by title which is helpful for search engines.
Meta is something related to data i.e like information of data.

10. ‘Image Alt’ tags is not used for ____________


a) diagrams
b) screenshots
c) decorative images
d) infographics
View Answer
Answer: c
Explanation: ‘Image Alt’ tags should not be used for decorative images. It should be used
for diagrams, Infographics, Photos of team members, Website logo, Images of merchandise
and many other places where it’s an appropriate usage.

11. Which tag is used for stopping duplicate content?


a) canonical tag
b) image alt tag
c) nofollow
d) meta
View Answer
Answer: a
Explanation: When we have a lot of web pages having similar content, this is a good way to
stop duplicate content. This is also important to syndicate the content.
E.g. <link rel= “canonical” href= http://www.fggytyuyj.com/>

Meta elements like noindex and follow can also be used to stop duplicate content.

12. Which one of the following is used to identify an anchor link?


a) #
b) #!
c) #?
d) &
View Answer
Answer: a

1. Which of the following map type is not supported by mapTypeId?


a) Hybrid
b) Terrain
c) Roadmap
d) Climatic map
View Answer
Answer: d
Explanation: The map type that is to be displayed is specified by mapTypeId. The types that
are supported are Satellite, Roadmap, Terrain and hybrid. E.g. mapTypeId:
google.maps.MapTypeId.ROADMAP.

2. Which one of the following defines properties for the map?


a) mapOptions
b) zoom
c) center
d) mapTypeId
View Answer
Answer: a
Explanation: The variable mapOptions defines the properties of the map. Where to center
the map is defined by center property, it uses longitude and latitude properties. To specify
the zoom level for the map we use zoom property.

3. Which one of the following is not google map overlay?


a) Polygon
b) Polyline
c) Eclipse
d) Marker
View Answer
Answer: c
Explanation: The objects on the map that are bound to longitude/latitude coordinates are
overlays. Google Maps has many types of overlays. Marker, Polygon, Polyline, Circle,
Rectangle, Info Windows, Custom overlays etc.
advertisement

4. For single locations on a map, we use the overlay for _______


a) Marker
b) Polygon
c) Polyline
d) Circle
View Answer
Answer: a
Explanation: Marker specifies the single locations on the map. It can also display custom
icon images. A series of straight lines on a map can be specified by Polyline. A series of a
straight line with the “closed” shape is defined by Polygon.

5. Polyline will not support the property of _________


a) Path
b) StrokeOpacity
c) Editable
d) Fillcolor
View Answer
Answer: d
Explanation: Polyline supports various properties like strokeColor, strokeWeight, editable,
strokeOpacity, path. The several longitude or latitude coordinates for a line is specified by
path. An opacity of the line is specified by strokeOpacity.
6. The property that is not supported by Polyline but by Polygon is __________
a) strokeWeight
b) fillOpacity
c) path
d) editable
View Answer
Answer: b
Explanation: The properties supported by polygon are strokeColor, strokeWeight, editable,
fillOpacity, fillColor, path, strokeCapacity. The hexadecimal color for the area within an
enclosed region is specified by fillColor, the opacity to fill color is specified by fillOpacity.

7. The property which is not supported by the circle is _________


a) path
b) radius
c) center
d) fillColor
View Answer
Answer: a
Explanation: Circle supports the properties like radius, center, strokeOpacity,
strokeCapacity, fillColor, fillOpacity, stokeOpacity, editable, specify google.maps.LatLng of
center of circle, the radius of a circle is specified by radius. Opacity of stroke color is
specified by strokeOpacity.

8. The value of fillOpacity lies between __________


a) 0.0 and 2.0
b) 0.0 and 1.0
c) 2.0 and 3.0
d) 3.0 and 4.0
View Answer
Answer: b
Explanation: The value of fillOpacity lies between 0.0 and 1.0. The value of strokeOpacity
also lies between 0.0 and 1.0, E.g path: Trip, strokeOpacity: 0.7, strokeWeight: 3,
strokeColor: “#000FFF” .

9. Which one of the following is not the default control in google maps?
a) Pan
b) Street view
c) MapType
d) Climate map
View Answer
Answer: d
Explanation: Google map has a default control set namely Pan, Zoom, Street view,
MapType, Rotate, Overview map, scale. A slider or “+/-” buttons for controlling zoom level
of the map. For panning the map we use pan control.

10. Which control displays the current map viewport?


a) Scale
b) Overview Map
c) Street view
d) MapType
View Answer
Answer: b
Explanation: The control overview displays a thumbnail overview map which reflects the
current map viewport within the wider area. A map scale element is displayed by scale
control. Pegman icon that can be dragged to the map for enabling street view is displayed
by this control. When a user wants to toggle between the maps (roadmap and satellite),
Map Type is used.

11. MapTypeControlOptions field may not contain _______


a) google.maps.MapTypeControlStyle.HORZONTAL_BAR
b) google.maps.MapTypeControlStyle.DEFAULT
c) google.maps.MapTypeControlStyle.DROPDOWN_MENU
d) google.maps.MapTypeControlStyle.LARGE
View Answer
Answer: d
Explanation: For modifying control we use mapTypeControlOptions field.
google.maps.MapTypeControlStyle.HORZONTAL_BAR displays a single button for each
map type. google.maps.MapTypeControlStyle.DEFAULT displays default behavior.
google.maps.MapTypeControlStyle.DROPDOWN_MENU helps in selecting map type via
dropdown menu.

12. Photographic map lies under the map type ____________


a) satellite
b) roadmap
c) hybrid
d) terrain
View Answer
Answer: a
Explanation: Photographic map lies under the map type satellite. Default 2D map and
normal maps lie under the type roadmap. Photographic + city and roads names include
hybrid maps. Maps with rivers, mountains etc. lies under the category terrain.

13. Which of the following type will support 45 degree perspective view?
a) Terrain
b) Hybrid
c) Roadmap
d) Climate map
View Answer
Answer: b
Explanation: Satellite and hybrid type of map support 45 degree perspective imagery view
for specified locations. The map will add a compass wheel around Pan control, it allows to
rotate the image. There is a toggle control to display 45 degree perspective view.

14. Which of the following method will return DOM object that contains map?
a) getCenter()
b) getProjection()
c) getDiv()
d) gettilt()
View Answer
Answer: c
Explanation: getDiv() method will return DOM object that contains map. Its return type is
node. getCenter() will return lng/lat of center of the map. getTilt() method will return angle of
incidence for aerial imagery in degrees. Current position is returned when getProjection()
event is fired up.

15. Which one of the following will set the viewport to contain given bounds?
a) fitBounds()
b) getBounds()
c) getHeading()
d) panTo()
View Answer
Answer: a

1. Which of the following is not the property of Map()?


a) mapTypes
b) controls
c) overlayMapTypes
d) zoom
View Answer
Answer: d
Explanation: There are three properties of map namely mapTypes, controls,
overlayMapTypes. MapTypes is a registry of MapType which instances by string ID.
Additional controls to attach to map is provided by controls.

2. Which of the following event does not take a MouseEvent argument in Map()?
a) dbclick
b) drag
c) click
d) mouseover
View Answer
Answer: b
Explanation: There are various events of Map() that takes MouseEvent as an argument.
Some of them are dbclick, click, mouseout, mousemove, mouseover, rightclick. When a
user clicks the map click event is fired and on double clicking on the map dbclick event is
fired.

3. Which of the following event will be fired when a user drags the map?
a) dragend
b) drag
c) dragstart
d) idle
View Answer
Answer: b
Explanation: The drag event will be fired repeatedly while the user drags the map. When the
user stops dragging the map dragend event will be fired, dragstart event will be fired when a
user starts dragging the map.
advertisement

4. Which of the following event will be called when user’s mouse exits map container?
a) mouseout
b) mouseover
c) mousemove
d) resize
View Answer
Answer: a
Explanation: mouseout event will be called when user’s mouse exits mouse container,
mouseover event will be called when the user’s mouse enters map container, mousemove
event will be called when user’s mouse moves over the map.

5. Which event will be fired when the map changes size?


a) tilesloaded
b) zoom_changed
c) tilt_changed
d) resize
View Answer
Answer: d
Explanation: resize event will be fired when the map changes the size, zoom_changed
event will be fired when map zoom property is changed, tilt_changed event will be fired
when map tilt property changes, tilesloaded event will be fired when visible tiles have
finished loading.

6. Which object will represent a Marker icon?


a) Marker
b) MarkerShape
c) MarkerImage
d) Marker
View Answer
Answer: c
Explanation: MarkerImage will represent a structure of a Marker icon or shadow image. The
shape of the marker is defined by MarkerShape. Options for rendering the marker are
shown by MarkerOptions. Marker object simply creates a Marker.

7. Which object shows options for rendering of scale control?


a) ScaleControlOptions
b) ScaleControlStyle
c) RotateControlOptions
d) ControlPosition
View Answer
Answer: a
Explanation: ScaleControlOptions provide options for rendering of scale control,
ScaleControlStyle specifies kind of the scale control to display, RotateControlOptions shows
options for rendering of rotate control, ControlPosition specifies placement of controls of
map.

8. Which of the following will provide options for rendering overview map control?
a) MapTypeControlStyle
b) OverviewMapControlOptions
c) MapTypeControlOptions
d) PanControlOptions
View Answer
Answer: b
Explanation: OverviewMapControlOptions will provide options for rendering of overview
map control, MapTypeControlStyle will specify kind of map control to display.
MapTypeControlOptions holds options to modify a control. Options for rendering pan control
is given by PanControlOptions.

9. Which will specify placement of controls on map?


a) ControlPosition
b) StreetViewControlOptions
c) ScaleControlStyle
d) ScaleControlOptions
View Answer
Answer: a

1. Which of the following plug-in can’t be embedded by <object> element?


a) Java applets
b) Flash players
c) PDF readers
d) Map
View Answer
Answer: d
Explanation: All the browsers support <object> element. It also defines an embedded object
within the HTML document. It is used for embedding plug-ins like PDF readers, Flash
Players, Java applets in the web page.

2. What is the prefix of all the browser-specific functions?


a) NPP
b) UPP
c) NPN
d) GPN
View Answer
Answer: c
Explanation: It is a convention that all of the browser specific functions have the prefix
‘”NPN” and all of the plug-in specific functions have the prefix “NPP”. Gecko calls plug-in
API function NP_Initialize at the time when plug-in code first loaded.

3. When is the instance created, which plug-in API function is called?


a) NPP_Destroy
b) NPP_New
c) NP_Shutdown
d) NP_Initialize
View Answer
Answer: b
Explanation: NPP_New function is called by the browser when an instance is created.
There can exist multiple instances of the same plug-in. There are two conditions for it first if
there are multiple embedded objects on a single page, second if several browser windows
are open.
advertisement

4. Which function will be called when the last instance of a plug-in is deleted?
a) NPP_Destroy
b) NP_Initialize
c) NPP_New
d) NP_Shutdown
View Answer
Answer: d
Explanation: When the last instance of a plug-in is deleted Gecko calls the function
NP_Shutdown. The plug-in code is unloaded from memory. Plug-ins consume no resources
when not loaded, it only consumes a little disk space.

5. When the user leaves instance’s page which function is called?


a) NPP_New
b) NPP_Destroy
c) NP_Shutdown
d) NP_Initialize
View Answer
Answer: b
Explanation: When the user leaves instance’s page or closes its window a plug-in instance
is deleted. Then Gecko calls the function NPP_Destroy to inform plug-in that the instance is
being deleted. Plug-in API calls and callbacks use main Navigator thread.

6. Which of the following is not the directory in Windows for plug-ins?


a) Profile directory/Library/Internet
b) MOZ_PLUGIN_PATH
c) HKEY_CURRENT_USER
d) ~/Library/Internet Plug-Ins
View Answer
Answer: d
Explanation: When Gecko based browser starts, it checks certain directories for plugins.
Windows have MOZ_PLUGIN_PATH, Profile directory\plugins, %APPDAT
%/Mozilla\plugins, Plug-ins with toolkit bundles,
HKEY_CURRENT_USER\Software\MozillaPlugins\*\Path are some of the directories in
windows.

7. Which of the following is not the directory in Mac OS X for plug-ins?


a) /Library/Internet
b) ~/Library/Internet
c) Profile directory
d) MOZ_PLUGIN_PATH
View Answer
Answer: d
Explanation: /Library/Internet Plug-Ins, ~/Library/Internet Plug-Ins, Plug-ins with the toolkit
bundles, /System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources,
Profile directory/plugins are some of the directories in Mac OS X for plug-ins.
8. Which of the following is not a directory in Linux for plug-ins?
a) ~/.mozilla/plugins
b) /usr/lib64/Mozilla/plugins
c) profile directory
d) /Library/Internet plug-ins
View Answer
Answer: d
Explanation: Profile directory/plugins, /usr/lib64/Mozilla/plugins, /usr/lib/Mozilla/plugins,
~/.mozilla/plugins are some of the directories in Linux for using plug-ins.
/usr/lib64/firefox/plugins is for 64-bit Firefox.

9. Which of the following plug-in file type is used in MS Windows?


a) .DLL
b) .SO
c) .DSO
d) PPC
View Answer
Answer: a
Explanation: The plug-in file type depends on the platform. The file type in MS Windows
is .DLL which is Dynamic Link Library files. Unix has .SO or .DSO files which are shared
objects. MAC OS X has file PPC/x86/Universal loadable Mach-O bundle.

10. The plug-in DLL can’t contain ______________


a) Language
b) ProductName
c) FileDescription
d) DirectoryName
View Answer
Answer: d

1. Which of the following is not a transmission mode that plug-in can select?
a) File mode
b) Random-access mode
c) Normal mode
d) Complex mode
View Answer
Answer: d
Explanation: There are three transmission modes that plug-in can select. In normal mode
browser sends stream data sequentially to plug-in, in Random-access mode browser allows
a plug-in to request specific ranges of bytes from anywhere in the stream. In File, mode
browser saves data to a local file in cache and passes the file path to plug-in.

2. Which method is used for sending data to URL from memory buffer?
a) NPN_PostURL
b) NPN_GetURLNotify
c) NPN_GetURL
d) NPN_PostURLNotify
View Answer
Answer: a
Explanation: For sending data to URL from file or a memory buffer we used NPN_PostURL.
The result obtains from a server can also be sent to a particular browser window or frame
for display, or delivered to a plug-in instance in the new stream.

3. Which of the following request is used for the browser to load a URL?
a) NPN_GetURL
b) NPN_PostURL
c) NPN_PostURLNotify
d) NPN_GetURLNotify
View Answer
Answer: a
Explanation: NPN_GetURL is a request for the browser to load a URL into a particular
frame for display or browser window, or for delivering data of that URL to the plug-in
instance in a new stream. NPN_PostURLNotify function notifies plug-in of a result when an
operation completes.
advertisement

4. Which function helps in identifying compatibility of plug-in and browser?


a) NPN_UserAgent
b) NPN_Version
c) NPN_Status
d) NPN_GetValue
View Answer
Answer: b
Explanation: For determining whether plug-in and browser versions are compatible or not
we use NPN_Version method It also provides alternative processing for different versions.
For checking changes in major and minor version numbers it can also be used.

5. Which method is used to display a message on the status line?


a) NPN_MemFree
b) NPN_HandleWindow
c) NPN_Status
d) NPN_GetValue
View Answer
Answer: c
Explanation: NPN_Status is used to display a message on the status line. It makes the user
feel that the plug-in is a part of the browser user interface, plug-in can emulate browser
behavior by providing status line message.

6. Which of the following is called after plug-in is initialized to get scripting interface?
a) NPP_GetValue
b) NP_GetValue
c) NP_GetMIMEDescription
d) NP_Initialize
View Answer
Answer: a
Explanation: After the plug-in is initialized to get scripting interface NPP_GetValue is called.
NP_GetValue is called during initialization to retrieve plug-in’s description and name, that
will appear in navigator.plugins DOM object and is used to populate about:plugins.

7. The plugin resource string 1 is associated with ________


a) MIME type
b) aiff
c) video
d) jpg
View Answer
Answer: c
Explanation: There are plugin resources. ‘STR#’ 1 is associated with video or quicktime,
MIME type is associated with str 128, aiff is associated with string 4, jpg is associated with
string 6, image or jpeg is associated with string 5.

8. Windowless plug-in will not call ____________


a) NPN_InvalidateRegion
b) NPN_ForceRedraw
c) NPN_InvalidateRect
d) NPP_GetValue
View Answer
Answer: d
Explanation: Windowless plugin can call Netscape methods like NPN_InvalidateRegion,
NPN_ForceRedraw, NPN_InvalidateRect. NPN_InvalidateRegion is used for invalidate an
area in windowless plug-in before refreshing or repeating.

9. The browser will not call the plug-in _________


a) NPN_InvalidateRect
b) NPP_Print
c) NPP_HandleEvent
d) NPP_SetValue
View Answer
Answer: a
Explanation: Browser calls various plug-in methods like NPP_Print, NPP_SetWindow,
NPP_SetValue, NPP_HandleEvent, NPP_GetValue. NPP_SetValue is for setting the
browser information, for delivering platform-specific event to instance browser calls
NPP_HandleEvent method.

10. Which of the following method is not associated to handling the memory
________________
a) NPN_MemFlush
b) NPN_MemAlloc
c) NPN_MemFree
d) NPP_HandleEvent
View Answer
Answer: d

1. Which of the following is not a semantic element?


a) <form>
b) <article>
c) <table>
d) <span>
View Answer
Answer: d
Explanation: Semantic element describes its meaning to both developer and browser. Some
of the semantic elements are <article>, <form>, <table>. Non-semantic elements are
<span> and <div> and they tell nothing about their content.

2. Footer element can’t contain ____________ information.


a) contact information
b) copyright information
c) the author of the document
d) blog post
View Answer
Answer: d
Explanation: A footer for a document or section is specified by <footer> element. It should
contain information about its containing element. This element typically contains the author
of the document, links to terms of use, copyright information, contact information.

3. Which element works as a sidebar?


a) header
b) footer
c) nav
d) aside
View Answer
Answer: d
Explanation: <aside> element works like a sidebar. It defines some content aside from the
content it is placed in. It should be related to the surrounding content. E.g. <aside> <h3>
Florida </h3>< <p> Florida is a very cold place. </p> </aside>. <footer> element contains
copyright information about author/owner of the document. All navigation links are
contained in <nav> element. <header> specifies heading for the document.
advertisement

4. Which of the following defines a visible heading for <details> element?


a) <summary>
b) <section>
c) <mark>
d) <main>
View Answer
Answer: a
Explanation: The <summary> tag is new in HTML5. <summary> element defines a visible
heading for <details> element. This heading can be clicked to hide/view the details. This
element is not supported by Internet Explorer. Sections in document is defined by <section>
element. <mark> element is used to highlight the context/paragraph/text. Main content of
document is specified by <menu> element.

5. Which of the following specifies the main content of the document?


a) <time>
b) <main>
c) <details>
d) <section>
View Answer
Answer: b
Explanation: Human readable date/time is shown by <time> element. The main content of a
document is specified by <main> element. The content written inside <main> element
should be unique to the document. It should not contain any content that is repeated across
documents such as navigation links, copyright information, site logos, search forms.
Sections in document is defined by <section> element. The additional details that the user
can view or hide on demand is specified by <details> tag.

6. Which element defines additional details?


a) <details>
b) <summary>
c) <main>
d) <aside>
View Answer
Answer: a
Explanation: The additional details that the user can view or hide on demand is specified by
<details> tag. The content of <details> element should not be visible unless open attribute
is set. This tag can be used for creating interactive widget that user can open and close.
Main content of document is specified by <menu> element. <aside> defines some content
aside from the content it is placed in.

7. Which of the following specifies relationship between current document and external
resource?
a) <meta>
b) <style>
c) <link>
d) <title>
View Answer
Answer: c
Explanation: Relationship between current document and external resource is specified by
<link> element. The possible uses for this element include defining relational framework for
navigation. It is mostly used to link to style sheets. <title> element specifies title of the
document. Metadata about HTML document is provided by <meta> element. <style>
element specifies style information about the HTML document.

8. Which element represents preformatted text?


a) <main>
b) <dir>
c) <dd>
d) <pre>
View Answer
Answer: d
Explanation: Main content of document is specified by <menu> element. <dir> element is
not supported in HTML5. It contains all directory titles. The <pre> element in HTML
represents preformatted text. The text written inside <pre> element is presented exactly as
written in HTML file. Text is typically rendered using non-proportional font. Whitespace
inside the element is displayed as written. <dd> is used to describe a name in description
list.

9. Which element is called bidirectional isolation?


a) <bdi>
b) <bdo>
c) <br>
d) <b>
View Answer
Answer: a
Explanation: <bdi> element is known as bidirectional isolation. It isolates a span of text that
might be formatted in different direction from other text outside it. This element is useful at
the time of embedding text with an unknown directionality from database like inside text with
a fixed directionality. <br> is used for giving a break-line in text. <b> is used for making the
text bold. To override the current text direction <bdo> element is used.

10. Which element is used for bringing attention?


a) <cite>
b) <br>
c) <b>
d) <code>
View Answer
Answer: c
Explanation: Title of work is defined by <cite> tag. <br> is used to give a vertical break in
text/paragraph. The <code> element displays its contents styles in a fashion intended to
indicate that text is a short fragment of computer code. <b> element is known as HTML
Bring Attention To element. It is used to draw reader’s attention to the element’s contents,
which are not granted special importance otherwise. Formally this was known as Boldface
element.

11. Which element denotes that the text is a short fragment of computer code?
a) <code>
b) <data>
c) <cite>
d) <dfn>
View Answer
Answer: a
Explanation: Title of work is defined by <cite> tag. The <code> element displays its contents
styles in a fashion intended to indicate that text is a short fragment of computer code. The
content text is displayed using user agent’s default monospace font by default. <data>
element links content with machine readable translation. Defining instance of a term in
HTML is represented by <dfn> element.

12. Which of the following is keyboard input element?


a) <mark>
b) <kbd>
c) <dfn>
d) <em>
View Answer
Answer: b
Explanation: <mark> element is for highlighting the text/paragraph. <kbd> element is HTML
Keyboard Input Element. It represents a span of inline text denoting textual user input from
voice input, a keyboard or any other text entry device. By convention user defaults to
rendering the contents of <kbd> element using its default monospace font. Defining
instance of a term in HTML is represented by <dfn> element. <em> is same like <i></i>. It is
emphasized text.

13. Which element prevents the text from automatically wrapping across multiple lines?
a) <em>
b) <kbd>
c) <mark>
d) <nobr>
View Answer
Answer: d
Explanation: <em> is same like <i></i>. It is emphasized text. <kbd> element is HTML
Keyboard Input Element. <mark> element is for highlighting the text/paragraph. <nobr> is
non-standard obsolete HTML element. This element prevents the text it contains from
automatically wrapping across multiple lines. Resulting in the user having to scroll
horizontally to see entire width of the text.

14. Which of the following element is known as ruby fallback parenthesis?


a) <rt>
b) <rp>
c) <rtc>
d) <q>
View Answer
Answer: b
Explanation: In ruby, <rt> defines explanation of characters. <rp> is Ruby Fallback
Parenthesis element in HTML. It is used to provide fall-back parentheses for browsers that
do not support display of ruby annotations when using <ruby< element. This element
include global attribute only. <q> element is used for short quotation.

15. Which element represents a ruby annotation?


a) <rt>
b) <rtc>
c) <ruby>
d) <rp>
View Answer
Answer: c

1. Which element is used to enclose inline text?


a) <samp>
b) <small>
c) <s>
d) <rtc>
View Answer
Answer: a
Explanation: Inline are used to define the meaning or style of text. <samp> is HTML Sample
Element. It is used to enclose inline text which represents sample output from a computer
program. Its content is typically rendered using browser’s default mono spaced font.
<small> makes text size small in appearance. <s> element specifies things which are no
longer right. <rtc> is a Ruby Text Container.

2. Which of the following is a generic inline container for phrasing content?


a) <strong>
b) <sub>
c) <span>
d) <sup>
View Answer
Answer: c
Explanation: <strong> element shows importance of text. <sub> element is for subscript.
<span> HTML element is a generic inline container for phrasing content, that does not
inherently represent anything. It is used to group elements for styling purposes with the help
of class or id attributes. <sup> is for superscript.

3. Which of the following element is known as Teletype Text element?


a) <time>
b) <tt>
c) <wbr>
d) <sup>
View Answer
Answer: b
Explanation: <time> element specifies time. <tt> element is known as HTML Teletype Text
element. It creates inline text which is presented using agent’s default monospace font face.
This element is obsolete. It was created for the purpose of rendering text as it would be
displayed on a fixed-width display like text-only screen, teletype or line printer. <sup>
element for superscript. <wbr> element describes a word break opportunity.
advertisement

4. Variable element is ________


a) <var>
b) <wbr>
c) <sup>
d) <time>
View Answer
Answer: a
Explanation: <sup> element for superscript. element describes a word break opportunity.
<time> element specifies time. <var> is known as HTML Variable element. It represents
name of a variable in mathematical expression or in a programming context. It is presented
using italicized version of current typeface.

5. Which element represents word break opportunity?


a) <var>
b) <sup>
c) <wbr>
d) <rtc>
View Answer
Answer: c
Explanation: <var> is known as HTML Variable element. <wbr> element represents word
break opportunity. A position within text where browser may optionally break a line. This
element only includes global attributes. It is supported by most of the browsers. <sup>
element is superscript. <rtc> is a Ruby Text Container.

6. Which of the following is known as child of media elements?


a) <area>
b) <img>
c) <map>
d) <track>
View Answer
Answer: d

Explanation: <area> element defines region on image.   element is used to insert


image in document. <track> element is used as a child of media elements <video> and
<audio>. It lets you specify text tracklike to automatically handle subtitles. The tracks are
formatted in WebVTT format like .vtt files. <map> with <area> element is used to define
image.

7. Which element embeds a Java applet into the document?


a) <applet>
b) <embed>
c) <noembed>
d) <object>
View Answer
Answer: a
Explanation: <applet> is known as HTML Applet Element. It embeds Java applet into the
document. But now a days use of Java applets on Web is deprecated. Most of the browsers
no longer support use of plug-ins. <embed> element embeds external content in document.
<noembed> is fallback content for browsers. <object> element describes an external
resource.

8. Which element defines parameters for <object> element?


a) <noembed>
b) <param>
c) <source>
d) <embed>
View Answer
Answer: b
Explanation: <noembed> is fallback content for browsers. <object> element describes an
external resource. <embed> element embeds external content in document. <param>
element defines parameters for <object> element. The element includes global attributes.
This element is supported by all the browsers. <source> element specifies multimedia
resources for pictures, audio etc.

9. Which element represents an external resource?


a) <object>
b) <source>
c) <param>
d) <picture>
View Answer
Answer: a
Explanation: An external resource is represented by <object> element that can be treated
as image, nested browsing context or a resource to be handled by plugin. It includes
various attributes like archive, border, classid, codebase, codetype etc. <source> element
specifies multimedia resources for pictures, audio etc. <param> element defines
parameters for <object> element. An element <picture> contains <source> element and
<image>.

10. Which element specifies multiple media resources?


a) <param>
b) <source>
c) <object>
d) <picture>
View Answer
Answer: b
Explanation: <param> element defines parameters for <object> element. An element
<picture> contains <source> element and <image>. <source> element in HTML specifies
multiple media resource for <audio>, <video> and <picture> element. It is an empty element
and is commonly used to serve same media content in multiple formats supported by
different browsers. An external resource is represented by <object> element that can be
treated as image, nested browsing context or a resource to be handled by plugin.

11. Which element is not a scripting element?


a) <noscript>
b) <canvas>
c) <script>
d) <picture>
View Answer
Answer: d
Explanation: For creating dynamic content and web applications HTML uses scripting
languages. <canvas>, <script>, <noscript> are certain elements that support this capability.
<picture> element is for embedding the content.

12. Which element shows completion progress of a task?


a) <progress>
b) <select>
c) <option>
d) <meter>
View Answer
Answer: a
Explanation: <progress> element in HTML shows an indicator indicating completion
progress of a task, which is typically displayed as a progress bar. It also includes all the
global attributes including max, value etc. <select> element specifies control over a menu of
options. <option> represent item contained in <select> element. <meter> gives a scalar
range of value.
13. Which element creates a grouping of options?
a) <progress>
b) <option>
c) <optgroup>
d) <select>
View Answer
Answer: c
Explanation: <progress> element in HTML shows an indicator indicating completion
progress of a task, which is typically displayed as a progress bar. <select> element
specifies control over a menu of options. <option> represent item contained in <select>
element. <optgroup> element in HTML creates a grouping of options within <select>
element. This element should not be nested. It includes global attributes like disabled, label
and many more.

14. Which element represents a scalar value within the given range?
a) <option>
b) <meter>
c) <label>
d) <input>
View Answer
Answer: b
Explanation: <option> represent item contained in <select> element. <meter> element in
HTML represents either a scalar value within a known range or a factorial value. It includes
global attributes like min, max, value, optimum, low, high, form etc. <label> specifies a
caption for item in user interface. <input> element is used to take user input from user.

15. Which element is used to draw graphics and animations?


a) <canvas>
b) <script>
c) <noscript>
d) <picture>
View Answer
Answer: a

1. Which element represents a dialog box?


a) <dialog>
b) <menuitem>
c) <menu>
d) <summary>
View Answer
Answer: a
Explanation: <dialog> element in HTML represents a dialog box or other interactive
component like window or an inspector. This element includes global attributes. The
tableindex attribute must not be used on <dialog> element. <menuitem> represents a
command which helps user to pop up through menu. <menu> is a group of commands
which is used to perform something. <summary> element provides summary of element.

2. Which element is known as Disclosure Summary element?


a) <dialog>
b) <summary>
c) <menu>
d) <menuitem>
View Answer
Answer: b
Explanation: <dialog> element in HTML represents a dialog box or other interactive
component like window or an inspector. <summary> element is known as Disclosure
Summary element. It specifies caption, summary or legend for <details> element’s
disclosure box. This element only includes global attribute. This element may only be used
as the first child of <details> element. <menuitem> represents a command which helps user
to pop up through menu. <menu> is a group of commands which is used to perform
something.

3. Which element represents group of commands that user can activate or perform?
a) <menuitem>
b) <menu>
c) <summary>
d) <details>
View Answer
Answer: b
Explanation: <menuitem> represents a command which helps user to pop up through
menu. <menu> element in HTML represents group of commands that user can perform or
activate. This include list menu as well as context menus. List menus appear across top of a
screen and context menus might appear underneath a button after it has been clicked.
<summary> element is known as Disclosure Summary element. <details> elment provides
information that user can view or hide as per own wish.
advertisement

4. Which of the following is not a web component element?


a) <shadow>
b) <element>
c) <content>
d) <menu>
View Answer
Answer: d
Explanation: There are web components in HTML related technology which makes it
possible to essentially create and use custom elements as if it were regular HTML. You can
also create custom versions of standard HTML elements. Some of the elements are
<shadow>, <content>, <element>, <template>, <slot>.

5. Which of the following element is for holding client-side content?


a) <template>
b) <slot>
c) <element>
d) <content>
View Answer
Answer: a
Explanation: <template> element in HTML is a mechanism for holding client-side content
that is not to be rendered when page is loaded but may subsequently be instantiated during
runtime using JavaScript. The element includes global attributes. <slot> is a placeholder
inside a web components. <element> is one of part of web components, used to custom
DOM elements. The obsolete part of web components is <content>.

6. Which element is a placeholder inside web component?


a) <shadow>
b) <content>
c) <slot>
d) <element>
View Answer
Answer: c
Explanation: <shadow> is obsolete part of web component used to shadow DOM. The
obsolete part of web components is <content>. <slot> element in HTML is a part of Web
Components technology suite. It is a placeholder inside web component that you can fill
with own markup that lets you create separate DOM trees and present them together.
<element> is one of part of web components, used to custom DOM elements.

7. Which element is used for defining a new custom DOM elements?


a) <element>
b) <shadow>
c) <slot>
d) <content>
View Answer
Answer: a
Explanation: <element> is HTML obsolete element. It was the part of Web Components
specification. It was intended to be used to define new custom DOM elements. It was
removed in favor of JavaScript-driven approach for creating new custom elements.
<shadow> is obsolete part of web component used to shadow DOM. <slot> element in
HTML is a part of Web Components technology suite. The obsolete part of web
components is <content>.

8. Which element is not a obsolete?


a) <dir>
b) <command>
c) <center>
d) <caption>
View Answer
Answer: d
Explanation: Obsolete elements are old HTML elements which are deprecated and should
not be used. They should never be used in new projects, and should replace them in old
projects as soon as we can. <acronym>, <basefont>, <applet>, <big>, <bgsound>,
<command>, <content>, <dir>, <center> are some of the obsolete elements.

9. Which element sets default font face, size and color for other elements?
a) <applet>
b) <basefont>
c) <big>
d) <acronym>
View Answer
Answer: b
Explanation: <applet> embeds java applet in web document. <basefont> is obsolete HTML
element. It sets default font face, size, and color for other elements which are descended
from its parent element. Instead of using this element we can use font, font-size, font-family
and color to change font configuration for an element. <acronym> element which has been
removed from HTML5 indicates sequence of characters. <big> element increase the font
size.

10. For background sound obsolete element was __________


a) <bgsound>
b) <audio>
c) <blink>
d) <acronym>
View Answer
Answer: a
Explanation: <bgsound> element only used by Internet Explorer is Background Sound
element. It sets up a sound file to play in background while the page is used. We use
<audio> instead of this element. <acronym> element which has been removed from HTML5
indicates sequence of characters. <blink> is a non-standard element which causes text to
flash slowly. <audio> element is used to play audio clip.

11. Which element is used to show the text slowly?


a) <big>
b) <blink>
c) <center>
d) <audio>
View Answer
Answer: b
Explanation: <big> element increase the font size. <blink> element is non standard element
in HTML. It causes enclosed text to flash slowly. But this element is unsupported and thus
implements HTMLUnknownElement interface. <audio> element is used to play audio clip.
<center> is block level element which centers element horizontally.

12. Which element is used as a container for a directory of files?


a) <dir>
b) <font>
c) <content>
d) <command>
View Answer
Answer: a
Explanation: <dir> element is used as a container for directory of files or folders, potentially
with styles and icons applied by user agent. It is recommended not to use this element you
can use <ul> element for lists including lists of files. Size, color or face for the content is
defined by <font> element. Those commands that user can invoke are represented by
<command>. <content> is an obsolete part of web components and is inside shadow DOM.

13. Which element puts a text field in a page for querying document?
a) <keygen>
b) <isiindex>
c) <dir>
d) <command>
View Answer
Answer: b
Explanation: An element which exists to facilitate generation of key material is <keygen>.
<isindex> is an obsolete HTML element. It puts a text field in a page for querying the
document. It is deprecated as of HTML 4.1, because same behavior can be achieved with
HTML form. All major browsers have now removed <isindex>. <dir> contains list of
directories. Those commands that user can invoke are represented by <command>.

14. Which element facilitate generation of key material?


a) <isindex>
b) <listing>
c) <keygen>
d) <marquee>
View Answer
Answer: c
Explanation: <isindex> is an obsolete HTML element. It puts a text field in a page for
querying the document. <keygen> element exists to facilitate generation of key material and
submission of public key as part of HTML form. It is designed to use with web-based
certificate management systems. It includes all the global attributes like autofocus,
challenge etc. The rendering of text between start tag and end tag is done by <listing>
element. A scrolling text can be displayed by <marquee> element.

15. Which element is used for inserting scrolling area of text?


a) <marquee>
b) <menu>
c) <menuitem>
d) <multicol>
View Answer
Answer: a

1. Which element is known as HTML plaintext element?


a) <plaintext>
b) <shadow>
c) <spacer>
d) <noembed>
View Answer
Answer: a
Explanation: <plaintext> element renders everything following start tag as raw text, without
interpreting any HTML. There is no need for closing tag since everything written after this
tag is considered as raw text. <shadow> element is an obsolete part of web component
which is used to shadow DOM objects. <spacer> element allows insertion of spaces in
documents. <noembed> is an obsolete non-standard which provides fallback to the content
of browser.

2. Which element allows insertion of empty spaces on pages?


a) <strike>
b) <spacer>
c) <shadow>
d) <plaintext>
View Answer
Answer: b
Explanation: HTML <strike> element places horizontal line through text. <spacer> is an
obsolete HTML element. It allows insertion of empty spaces on pages. It was devised by
Netscape to accomplish same effect as single-pixel layout image. <spacer> no longer
supported by any major browser and same effects can be achieved by using CSS.
<plaintext> element renders everything following start tag as raw text, without interpreting
any HTML. <shadow> element is an obsolete part of web component which is used to
shadow DOM objects.

3. Which element is known as HTML Example Element?


a) <spacer>
b) <strike>
c) <xmp>
d) <shadow>
View Answer
Answer: c
Explanation: HTML <strike> element places horizontal line through text. <spacer> is an
obsolete HTML element. It allows insertion of empty spaces on pages. HTML Example
Element <xmp> renders text between start and end tags without interpreting HTML in
between and using monospaced font. HTML2 specification recommended that it should be
rendered wide enough to allow 80 characters per line. <shadow> element is an obsolete
part of web component which is used to shadow DOM objects.
advertisement

4. Which attribute specify a column name from the data source object?
a) datafld
b) codebase
c) hspace
d) datasrc
View Answer
Answer: a
Explanation: datafld attribute is supported by Internet Explorer 4 and its higher versions. It
specifies column name from the data source object that supplies bound data. This attribute
may be used to specify various <param> elements passed to Java applet. Codebase gives
absolute or relative URL of directory. In applet, hspace provides horizontal space on both of
sides. HTML datasrc attribute used for data binding.

5. Which attribute is used for data binding?


a) name
b) datafld
c) datasrc
d) mayscript
View Answer
Answer: c
Explanation: The name attribute gives name to applet. Datafld attribute specify a column
name from the data source object. It is like datafld attribute. It is used for data binding under
Internet Explorer 4. It indicates id of data source object that supplies data that is bound to
<param> elements associated with an applet. Access to applet is given by mayscript
attribute.

6. Which attribute assigns a name to the applet?


a) name
b) vspace
c) src
d) object
View Answer
Answer: a
Explanation: name attribute assigns a name to the applet so that it can be identified by the
other resources especially for some particular scripts. Additional vertical space is specified
by vspace attribute in pixels. Additional vertival space above or below applet is given by
vspace attribute. Src attribute provides absolute URL for file or applet. Object attribute is
URL representation of applet.

7. Which value is there for autoplaying the YouTube video?


a) 0
b) 1
c) 2
d) infinite
View Answer
Answer: b
Explanation: We can play our video automatically when the user visits the page by adding a
simple parameter to a YouTube URL. When the value is set to be 0 the value will not play
automatically when the player loads. It is the default value. When the value is set to be 1 the
video will play automatically when the player loads.

8. Which element is used for YouTube videos?


a) <iframe>
b) <frame>
c) <small>
d) <samp>
View Answer
Answer: a
Explanation: We can host our videos through YouTube and can easily embed them into our
website. <iframe> tag will be used for YouTube videos.
E.g. <iframe width=”670” height=”612” src= “https://sanfoundry.com”> </iframe>

9. HTML object tag to embed multimedia will not embed in ___________


a) audio
b) video
c) Java applets
d) images
View Answer
Answer: d
Explanation: We can use HTML object tag to embed multimedia like video, audio, Java
applets, PDF, Flash, ActiveX in the web pages. For embedding video in HTML without
iframe tag we can use object tag.
10. video ID can be substituted by _____________
a) “videoseries?list=”
b) “videoseries.list=”
c) “videoseries/list=”
d) “videoseries$list=”
View Answer
Answer: a

1. Which navigator object property returns a geolocation object?


a) appVersion
b) geolocation
c) language
d) appCodeName
View Answer
Answer: b
Explanation: There are many navigator object properties, geolocation returns a geolocation
object that can be used to locate user’s position, appVersion returns the version information
of the browser, appCodeName returns the code name of the browser.

2. What returns the engine name of the browser?


a) product
b) userAgent
c) platform
d) onLine
View Answer
Answer: a
Explanation: Product property returns the engine name of the browser, userAgent returns
user-agent header sent by the browser to the server, platform returns for which platform the
browser is compiled. OnLine determines whether the browser is online or not.

3. Action box does not contains _______


a) tabs
b) geolocation buttons
c) search box
d) radio buttons
View Answer
Answer: d
Explanation: The action box contains tabs, a geolocation button, geoloaction options and
search box, by the use of tabs we can switch between different kind of maps and search
engines.
advertisement

4. Which button let us move the map to the current position of the device?
a) currentPositionBtn
b) enableHighAccuracy
c) timeout
d) maximumAge
View Answer
Answer: a
Explanation: The geolocation HTML includes a currentPositionBtn which is used to move
the map to the current position of the device, there are 3 inputs to let the user choose the
geolocation options enableHighAccuracy, timeout, and maximumAge.

5. Search box does not contain __________


a) currentPositionBtn
b) search button
c) dropdown list
d) input field
View Answer
Answer: a
Explanation: Search box contains an input field in which we can insert the name of the
place you are looking for, a search button or a dropdown list, depending on user experience
provided by the search tool.

6. How many kinds of map does Geo support?


a) 1
b) 2
c) 3
d) 4
View Answer
Answer: d
Explanation: Geo supports 3 different kinds of interactive map like OpenStreeMap, Google
Maps, a hybrid map that is Google Map with OpenStreetMap tiles placed on it, these maps
are loaded in 3 different HTML elements.

7. OpenStreetMap cannot extend map to implement __________


a) showMap
b) showPOIs
c) search
d) toProjection
View Answer
Answer: d
Explanation: The openStreetMap and GoogleMap objects extent Map to implement
showPOIs, showMap, search and showPosition methods, which make use of Google Maps
and OpenLayers library.

8. Which is not a kind of error?


a) PERMISSION_UNAVAILABLE
b) PERMISSION_DENIED
c) TIMEOUT
d) POSITION_UNAVAIALBLE
View Answer
Answer: a
Explanation: Examples of error are POSITION_UNAVAIALBLE, PERMISSION_DENIED
and TIMEOUT. PositionError is the object returned by Geolocation API in case of error.

9. getCurrentPosition does not take the argument?


a) successCallback
b) options
c) errorCallback
d) Timeout
View Answer
Answer: d
Explanation: getCurrentPosition method takes three arguments successCallbaack,
errorCallback, options. A successCallback set to GetMap.showMap by MapSwitcher or to
GeoMap.showPosition by GeolocationBox.

10. Which of the following cancels an ongoing watchPosition call?


a) clearWatch
b) watchPosition
c) getCurrentPosition
d) getPositionUsingMethodName
View Answer
Answer: a
Explanation: clearWatch cancels an ongoing watchPosition call, watchPosition method
retrieves periodic updates about a current geographic location of the device,
getCurrentPosition retrieves current geographic location.

11. Which of the following specifies the time when location information was retrieved?
a) timestamp
b) cords.speed
c) cords.heading
d) cords.altitudeAccuracy
View Answer
Answer: a
Explanation: timestamp specifies the time when location information was retrieved and the
position object created. cords. speed specifies device’s current ground speed in meters per
second, cords.heading specifies the device’s current direction of movement in degrees.

12. The code marker option does not create ______


a) title
b) map
c) position
d) zoom
View Answer
Answer: d
Explanation: map object when the marker should appear, position is latlng position at which
the marker should be displayed, title that should appear when we hover on the marker.

13. Which of the following is a global identifier for the item?


a) itemid
b) itemprop
c) itemref
d) itemtype
View Answer
Answer: a
Explanation: itemid attribute is a global identifier for the item, itemprop attribute defines a
property of the item, itemref gives a list of additional elements to crawl to find name-value
pairs of the item, itemtype is a valid URL that defines the item.

14. Which of the following is not a map display option?


a) zoom
b) center
c) mapTypeId
d) blur
View Answer
Answer: d
Explanation: zoom, center, mapTypeId are the three map display options. Zoom specifies
the zoom level, center specifies that the map should be centered at the user location,
mapTypeId can be satellite, roadmap or hybrid.

15. Which of the following specifies the expiry time for cached location information?
a) maximumAge
b) timeout
c) enableHighAccuracy
d) position_unavailable
View Answer
Answer: a

1. Which of the following is a server-side solution for implementing responsive images?


a) http://adaptive-images.com
b) http://github.com/scottjehl/picturefill
c) http://www.netmagazine.com
d) http://offroadcode.com
View Answer
Answer: a
Explanation: Instead of implementing ideal responsive image with <picture> element, we
can use a server-side solution with Adaptive image i.e. http://adaptive-images.com/. It was
created by Matt Wilcox (http://mattwilcox.net/).

2. Which of the following is not included in the framework?


a) font sizes
b) css reset
c) button styles
d) forms
View Answer
Answer: d
Explanation: If we use the framework it can save a lot of time. Framework generally
includes a width of the grid, button styles, CSS reset and many more other aspects to build
a website.

3. How many columns are there in the basic grid of a skeleton?


a) 17
b) 12
c) 16
d) 10
View Answer
Answer: b
Explanation: Skeleton is a minimal responsive framework. It is 960 pixels wide with 12
columns in its basic grid. The grid is responsive by integrating CSS3 media queries. It is
also called the 960.gs framework. It is a good place for starting with the Grid System.
advertisement

4. Bootstrap was first introduced in ______


a) google
b) twitter
c) instagram
d) snapchat
View Answer
Answer: b
Explanation: Bootstrap was built by Mark Otto and for internal use in Twitter. It was
launched as a free software for the public. Bootstrap is packed with styled user interface
components such as button navigation, forms, custom jQuery plugins like popover, model
box and carousal.

5. Which is not a tool to build responsive websites?


a) skeleton
b) bookmarklets
c) code editors
d) web browsers
View Answer
Answer: a
Explanation: We need several tools to build our website. To build a responsive website we
need web browsers, responsive bookmarklets, code editors for responsive design testing.

6. Linux does not have code editor ___________


a) Geany
b) Gedit
c) BlueFish
d) WebMatrix
View Answer
Answer: d
Explanation: Code editor is equipment for developing a website. There are many editors
available in Windows, Linux and OS X. Linux has Geany, Gedit, BlueFish. Windows have
WebMatrix, TextPad, Notepad++. OS X has MacVim, Brackets, TextWrangler.

7. Which is not bookmarklet?


a) Screen Fly
b) Resizer
c) Screenqueri.es
d) Brackets
View Answer
Answer: d
Explanation: Bookmarklet is a sort of emulator tool for testing responsive design. It resizes
the dimension of viewable area in the browser. There are various bookmarklets available
like Screenqueri.es, Resizer, Adobe Edge Inspect, Screen Fly, RWD demonstration,
ResponsivePX, Responsinator.

8. Which of the following is not a CSS preprocessor?


a) LESS
b) Sass
c) Stylus
d) Screen Fly
View Answer
Answer: d
Explanation: CSS capabilities can be extended by CSS preprocessors. By using it we can
compose CSS in more dynamic ways. They allow us to use variables and functions in
programming languages like JavaScript, PHP. There are several CSS preprocessors
available such as LESS, Stylus, Sass.

9. For style foundation Bootstrap uses ____________


a) LESS
b) Sass
c) Resizer
d) Stylus
View Answer
Answer: a
Explanation: These are some CSS preprocessors that have been adopted in responsive
frameworks. Bootstrap utilizes LESS as its style foundation. Foundation uses Sass in
styling.

10. Which of the following is not a CSS preprocessor compiler?


a) LESS.app
b) Screenqueri.es
c) ScoutApp
d) Simpless
View Answer
Answer: b
Explanation: LESS and Sass are written in a language that browsers do not recognize. So
there are compilers available to compile CSS preprocessors. Some of them are Less.js,
WinLESS, LESS.app, Simpless, ScoutApp, ChrunchApp, Terminal or Command Prompt,
Codekit, CompassApp.

11. Which compiler does not support LESS language?


a) Simpless
b) ScoutApp
c) LESS.app
d) WinLESS
View Answer
Answer: b
Explanation: LESS can be compiled on Less.js, WinLESS, LESS.app, ChrunchApp,
Simpless, Codekit. These compilers are free of cost. LESS.app can only be supported on
OS X and WinLESS only on Windows.
12. Which of the following is not a feature associated with LESS?
a) Variable
b) PHP
c) Opertaion
d) Parametric mixins
View Answer
Answer: b
Explanation: LESS is based on JavaScript. It was created by Alexis Sellier. LESS allows
composing styles with some programming features. Some of them are Variables,
Parametric mixins, Nesting rules, Operation, Mixins.

13. Sass is based on ___________


a) Ruby
b) jQuery
c) JavaScript
d) PHP
View Answer
Answer: a
Explanation: Sass is Ruby-bases CSS preprocessor. It was created by Hampton Catlin,
Nathan Weizenbaum and Chris Eppstein. It is like LESS, it can add variables, mixins and
nesting rules, with a little difference.

14. Which font is default in Skeleton sets?


a) Helvetica Neue
b) Ariel
c) sans-serif
d) Calibri
View Answer
Answer: a
Explanation: Skeleton sets Helvetica Neue and Helvetica as the default font in body
document. If these fonts are not available, it will apply Ariel or default sans-serif fonts to the
user’s machine.

15. Adjacent sibling selector is defined with the notation _____________


a) #
b) $
c) %
d) +
View Answer
Answer: d

1. General sibling selector is declared with the notation:


a) +
b) ~
c) &
d) #
View Answer
Answer: b
Explanation: CSS general sibling selector is new type of selector that is just been added in
CSS3. This selector is declared with ~ notation E.g. div ~y { background-color: blue; },
general sibling will target every selected element that follows previous element.

2. translate() function is not supported by __________


a) safari 3.1
b) firefox 3.5
c) chrome 4
d) firefox 4
View Answer
Answer: d
Explanation: translate() function is supported in Google Chrome 4, Firefox 3.5, Internet
Explorer 10, Safari 3.1, Opera 10.5. Vendor prefixes are still required to make
transformations work on these browsers.

3. CSS3 transition is not supported by _________


a) Internet Explorer 9
b) Internet Explorer 10
c) Safari 3.1
d) Firefox 4
View Answer
Answer: a
Explanation: the CSS3 transition is supported by Firefox 4, Safari 3.1, Chrome 4, Opera
10.5, Internet Explorer 10 browsers. Internet Explorer 9 does not support CSS3 transition,
that is why we can’t see –ms- prefix in the preceding syntax. But Internet Explorer 10 will
support CSS3 transition.
advertisement

4. Which is not the value for CSS transition?


a) transition-duration
b) delay
c) property
d) translate
View Answer
Answer: d
Explanation: CSS3 transition allows to change one CSS rule to another CSS rule gradually
rather than instantaneously within a specific duration. There are four values specified in the
syntax namely property, timing-function, transition-duration and delay.

5. Which value specifies a length of the transition effect?


a) property
b) transition-duration
c) delay
d) timing-function
View Answer
Answer: b
Explanation: Property value specifies name for CSS transition effect. The value of
transition-duration specifies a length of the transition effect. The value is specified in
milliseconds (ms) and seconds (s). E.g. 190ms and 0.8s. The delay in transition effect is
give by delay value. Speed curve of transition effect is provided by timing function.
6. Which value specifies transition acceleration?
a) timing-function
b) property
c) transition-duration
d) delay
View Answer
Answer: a
Explanation: The value of transition-function specifies transition acceleration. There are five
predefined acceleration types that we can use. They are ease-in, ease, ease-out, ease-in-
out and linear. property value specifies name for CSS transition effect. The value of
transition-duration specifies a length of the transition effect. The delay in transition effect is
give by delay value.

7. Whose value targets CSS property?


a) transition-duration
b) delay
c) property
d) timing-function
View Answer
Answer: c
Explanation: The value of transition-duration specifies a length of the transition effect. The
delay in transition effect is give by delay value. The value of transition-function specifies
transition acceleration. The value of property targets the CSS property to which transition
effect should be applied. The property should be height, color, width, background etc. But if
the value is not explicitly specified, it will take all as the default value, and will be applied to
all the properties.

8. The font format compatible for iOS is:


a) .svg
b) .ttf
c) .eot
d) .otf
View Answer
Answer: a
Explanation: Browsers set their own rules that outline which font format to use for web
embedding. .ttf format is developed by Apple and microsoft and is mostly used as
compatible font format in ios.

9. Which font format is not supported by Firefox?


a) .ttf
b) .svg
c) .woff
d) .otf
View Answer
Answer: b
Explanation: The compatible font format for Firefox is .ttf and .otf. In Firefox 3.6 .woff format
is also supported. The compatible font format for Internet Explorer are .eot and .woff, Opera
gives support to .ttf, .otf and .svg formats.
10. How many columns are used for grid system by bootstrap?
a) 14
b) 11
c) 16
d) 12
View Answer
Answer: d
Explanation: Bootstrap uses 12 columns of the grid system. Every column is defined with
classes ranging from span1 to span12. After adding several columns, the sum of our span
classes should be equal to 12. Columns should be wrapped within <div> element.

11. Which is not a color function?


a) lighten()
b) fade()
c) darken()
d) opaque()
View Answer
Answer: d
Explanation: LESS provides few functions for adjusting colors. Some of the functions are
darken(@color, n%), lighten(@color, n%), fade(@color, n%). Lighten makes the color
lighter than its initial value, fade lowers the color density, darken makes the color darker
than its initial value.

12. Which property specifies the path to the project when running in web server?
a) http_path
b) images_dir
c) css_dir
d) sass_dir
View Answer
Answer: a
Explanation: http_path specifies a path to the project when running on a web server. It is set
to/by default., so the path output will begin with /. E.g. background-image:
url(“/image/hj.png”). Folder name for all the images to be stored is specified by images_dir.
css_dir specifies folder name for CSS style sheets. sass_dir gives folder name for the sass
or SCSS style sheet to be stored.

13. Which property specifies the folder name where CSS style sheets should be saved?
a) relative_assets
b) sass_dir
c) css_dir
d) javascript_dir
View Answer
Answer: c
Explanation: sass_dir gives folder name for the sass or SCSS style sheet to be stored.
css_dir property specifies the folder name where CSS style sheets should be saved. We
can change css_dir value to something like css or styles, but we should also change the
folder name in the working directory to the one that matches the change. A folder name
where javascript file are stored is given by javascript_dir. The output path in compiled CSS
is given by relative_assets.
14. Which of the following specifies compiles CSS output?
a) relative_assets
b) output_style
c) line_comments
d) sass_dir
View Answer
Answer: b
Explanation: The output path in compiled CSS is given by relative_assets. The output_style
property specifies compiled CSS output. The accepted values for this property are
:nested, :expanded, :compressed or :compact. line_comments specifies whether compass
should generate line number where style sheets rule are defined. sass_dir gives folder
name for the sass or SCSS style sheet to be stored.

15. Which property specifies the output path in compiled CSS?


a) sass_dir
b) output_style
c) relative_assets
d) line_comments
View Answer
Answer: c

1. To enable slideshow, what we should not be included?


a) jquery.js
b) button
c) foundation.js
d) foundation.orbit.js
View Answer
Answer: b
Explanation: To construct HTML for slideshow simply wrap the content or the images within
unordered list element with data-orbit. For enabling slideshow we will need to include
jquery.js, foundation.js, foundation.orbit.js or zepto.js within HTML.

2. Which tag is used to let control over the viewport?


a) <meta>
b) <acronym>
c) <em>
d) <address>
View Answer
Answer: a
Explanation: HTML5 introduced a method to let web designers take control over the
viewport by using <meta> tag. We should include <meta> viewport element in all the web
pages. <meta> viewport element gives the browser instructions on how to control page’s
dimensions and scaling.

3. What should be the set value of the background-size property such that image will fit in
the content area?
a) 100%100%
b) contain
c) cover
d) 100%
View Answer
Answer: a
Explanation: If the background-size property is set to “contain”, the background image will
scale and will try to fit in the content area. Still, the image will keep its aspect ratio i.e. the
proportional relationship between the image’s width and height.
advertisement

4. What should be the set value of background-size property such that image will stretch to
cover entire content area?
a) 100%100%
b) cover
c) contain
d) 100%
View Answer
Answer: a
Explanation: If background-size property is set to “100%100% “ the background image will
stretch to cover the entire content area. E.g. div { width: 100%; height: 300px; background-
image: url(‘img_khj.jpg’); }

5. What should be the set value of background-size property such that image will cover the
entire content area?
a) 100%
b) contain
c) cover
d) 100%100%
View Answer
Answer: c
Explanation: If background-size property is set to “cover”, background image will scale to
cover entire content area. “cover” value keeps the aspect ratio and some part of
background image may be clipped. E.g. div {width: 100%; height: 390px; background-
image: url(‘img_tyu.jpg’); background-size: cover;}

6. Bootstrap does not use _________


a) HTML
b) jQuery
c) PHP
d) CSS
View Answer
Answer: c
Explanation: Bootstrap is a popular framework. It uses HTML, CSS and jQuery to make
responsive web pages. Bootstrap helps us to develop sites that look nice at any size i.e.
screen. Tablet, laptop or phone.

7. Which plugin allows the element to become locked or sticky?


a) .active
b) .alert
c) .affix
d) .alert-link
View Answer
Answer: c
Explanation: .alert simply creates an alert message. Affix plugin allows an element to
become affixed i.e. sticky or locked to an area on the page. It toggles position:fixed on and
off, .alert-link is used on links inside alerts to add matching colored links.

8. Which of the following will display red alert box?


a) .alert
b) .alert-danger
c) .alert-info
d) .alert-link
View Answer
Answer: b
Explanation: .alert-danger displays red alert box. It indicates a dangerous or potentially
negative action, .alert simply creates an alert message, .alert-info displays a light-blue alert
box which indicates some information, .alert-link used on links inside alerts to add matching
colored links.

9. Which of the following indicates blue background color representing something


important?
a) .bg-success
b) .bg-info
c) .bg-primary
d) .bg-danger
View Answer
Answer: c
Explanation: .bg-primary adds blue background color to an element. It represents
something important. .bg-danger adds red background color to an element representing
danger or a negative action, .bg-info adds light-blue color to an element representing some
information. A successful or positive action is given by .bg-success.

10. Which of the following indicates current page’s location within the navigational
hierarchy?
a) .breadcrumb
b) .btn
c) .active
d) .bg-warning
View Answer
Answer: a
Explanation: .breadcrumb is a pagination. It indicates the current page’s location within a
navigational hierarchy, .btn creates a basic button i.e. gray background and rounded
corners, .bg-warnong adds the yellow background color to an element.

11. Which of the following groups button together on a single line?


a) .btn-group-lg
b) .btn-group-justified
c) .btn-default
d) .btn-group
View Answer
Answer: d
Explanation: .btn-group groups buttons together on a single line, .btn-group-lg is for large
button group, it makes all button group larger-increased font-size and padding, .button-
group-justified makes a group of buttons span the entire width of the screen.

12. Which of the following makes a button group appear vertically?


a) .btn-group-vertical
b) .btn-group-xs
c) .btn-group-sm
d) .btn-info
View Answer
Answer: a
Explanation: .btn-group-vertical makes a button group appear vertically stacked, .btn-group-
sm is for small button group which makes all buttons in a button group smaller, .btn-group-
xs is for extra small button group, .btn-info is light-blue button representing information.

13. What creates a carat arrow icon?


a) .carousel
b) .caret
c) .carousel-caption
d) .caption
View Answer
Answer: b
Explanation: .caret creates arrow icon, which indicates that the button is a dropdown,
.carousel creates a carousel (slideshow), .carousel-caption creates caption text for each
slide in carousel, .caption adds caption text inside a .thumbnail.

14. Which is a container for slide items?


a) .carousel-control
b) .caousel-indicators
c) .carousel-inner
d) .carousel-caption
View Answer
Answer: c
Explanation: .carousel-inner is a container for slide items, .carousel-caption creates a
caption text for each slide in the carousel, .carousel-control is container for next and
previous links, .carousel-indicators adds little dots at the bottom of each slide.

15. What clears floats?


a) .close
b) .clearfix
c) .checkbox
d) .col-*-*
View Answer
Answer: b

1. Which of the following changes order of the grid columns?


a) .col-*-pull-*
b) .col-*-offset-*
c) .col-*-push-*
d) .collapse
View Answer
Answer: a
Explanation: .col-*-pull-* changes order of the grid column, .col-*-offset-* moves columns to
the right, these classes increase left margin of a column by * columns, .col-*-push-*
changes order of the grid columns, .collapse indicates collapsible content.

2. Which of the following spans full width of screen?


a) .container
b) .control-label
c) .container-fluid
d) .collapse-in
View Answer
Answer: c
Explanation: .containerfluid is a container that spans the full width of the screen, .container
is a fixed width container with widths determined by screen sites, .control-labels allows a
label to be used for form validation.

3. Which class is used to separate links in dropdown menu?


a) .divider
b) .dl-horizontal
c) .disabled
d) .dropdown
View Answer
Answer: a
Explanation: .divider class is there to separate links in dropdown menu with thin horizontal
border, .dl-horizontal lines up the terms <dt> and descriptions <dd> in <dl> elements side-
by-side, .dropdown creates a toggleable menu that allows user to choose one value from
predefined list.
advertisement

4. Which of the following adds default styles for dropdown menu container?
a) .dropdown-menu
b) .dropdown-toggle
c) .dropdown-menu-right
d) .dropdown
View Answer
Answer: a
Explanation: .dropdown-menu adds default styles for dropdown menu container, .dropdown-
header is used to add headers inside dropdown menu, .dropdown-right right-aligns a
dropdown menu, .dropdown-toggle is used on the button that should hide and show the
dropdown menu.

5. Which class adds a rounded border around an element?


a) .well-sm
b) .well-lg
c) .well
d) .divider
View Answer
Answer: c
Explanation: .well adds a rounded border around an element with gray background color
and some padding, .well-lg is a large well i.e. for more padding, .well-sm is a small well with
less padding.

6. Which of the following will show popup-box?


a) .well
b) .visible-*
c) .thumbnail
d) .tooltip
View Answer
Answer: d
Explanation: .tooltip is for the popup-box that appears when a user moves the mouse
pointer over an element, .thumbnail adds a border around an element often used for images
or videos to make it look like a thumbnail. .well adds a rounded border around an element
with gray background color and some padding. .visible-* is used to show the content by
device.

7. Which of the following class will show blue text?


a) .text-primary
b) .text-success
c) .text-muted
d) .text-warning
View Answer
Answer: a
Explanation: .text-primary shows blue text color, .text-success shows green text color which
indicates success, .text-warning shows yellow or orange text color which indicates
warning, .text-muted shows grey color text, .text-danger shows red color text.

8. Which of the following makes a table more compact?


a) .table-responsive
b) .table-hover
c) .table-condensed
d) .table-bordered
View Answer
Answer: c
Explanation: .table-condensed makes a table more compact by cutting cell padding in
half, .table-hover creates a hoverable table by adding grey background color on table rows
on hover, .table-responsive makes table responsive by adding the horizontal scrollbar when
needed.

9. Which of the following creates toggleable tabs?


a) .tab-pane
b) .table-responsive
c) .table-condensed
d) .table
View Answer
Answer: a
Explanation: .tab-pane is used together with .tab-content to create toggleable or dynamic
tabs or dynamic pills. .table adds basic styling to a table like bottom borders, padding etc.
Cutting cell padding in half to make table more compact, .table-condensed is used. A
responsive table is created by .table-responsive.

10. Which class is a container for responsive columns?


a) .sr-only
b) .small
c) .show
d) .row
View Answer
Answer: d
Explanation: .row class is for container for responsive columns, .small creates a lighter,
secondary text in any heading, .sr-only hides an element on all devices except for screen
readers, .show class shows an element.

11. Which of the following creates yellow progress bar?


a) .progress-bar-success
b) .progress-bar-warning
c) .progress-bar-info
d) .progress-bar-danger
View Answer
Answer: b
Explanation: .progress-bar-warning will create a yellow progress bar indicating warning,
.progress-bar-success will show green progress bar indicating success, .progress-bar-
danger will show red progress bar indicating danger, .progress-bar-info will show light-blue
progress bar indicating information.

12. Which class is a container for progress bars?


a) .progress
b) .progress-bar
c) .progress-bar-info
d) .progress-bar-success
View Answer
Answer: a
Explanation: .progress class is a container for progress bars, .progress-bar creates a
progress bar, .progress-bar-success creates a green progress bar and indicates success,
.progress-bar-info shows light-blue progress bar indicating information.

13. Which of the following is used to align pager buttons to the left side of the page?
a) .previous
b) .prev
c) .pre-scrollable
d) .popover
View Answer
Answer: a
Explanation: .previous class is used to align pager buttons to the left side of the page, .prev
is used in carousels to indicate a “previous” link, .pre-scrollable makes a <pre> element
scrollable, .popover shows popup-box that appears when a user clicks on an element.

14. Which of the following is a container for content inside the panel?
a) .panel-body
b) .panel-collapse
c) .panel-success
d) .panel-footer
View Answer
Answer: a
Explanation: .panel-body is a container for content inside the panel, .panel-collapse is for
the collapsible panel which toggles between hiding and showing panel, .panel-success
shows green panel indicating success, .panel-footer creates a panel footer.

15. Which of the following creates a pagination?


a) .pager
b) .pagination
c) .pagination-lg
d) .pagination-sm
View Answer
Answer: b

1. Which of the following centers tabs/pills?


a) .nav-justified
b) .nav nav-pills
c) .nav-stacked
d) .nav.navbar-nav
View Answer
Answer: a
Explanation: .nav-justified centers tabs/pills, on screens smaller than 786px the items are
stacked and the content will remained centered, .nav nav-pills indicates a pill menu,
.nav.navbar-nav contains list items with links inside navigation bar, .nav-stacked is for
vertically stack tabs or pills.

2. Which of the following is for title of the modal?


a) .modal-sm
b) .modal-title
c) .modal-open
d) .modal-lg
View Answer
Answer: b
Explanation: .modal-title is for the title of the modal, .modal-sm is for small modal, .modal-lg
specifies large modal, .modal-open is used on <body> element to prevent page scrolling,
.model-header shows header of the modal often contains a title and a close button.

3. Which defines style for body of the modal?


a) .modal
b) .modal-content
c) .modal-body
d) .modal-dialog
View Answer
Answer: c
Explanation: .modal-body defines style for the body of the modal, we can add HTML
markup here, .modal-content styles modal we can add modal’s header, body and footer,
.modal-dialog sets the proper width and margin of the modal.
advertisement

4. Which of the following aligns media objects?


a) .media-body
b) .media
c) .media-list
d) .media-object
View Answer
Answer: b
Explanation: .media aligns media objects like images or videos often used for comments in
a blog post, .media-body specifies the text that should appear next to media object, .media-
list creates nested media lists, .media-object indicates a media object.

5. Which of the following will provide additional information about something?


a) .item
b) .jumbotron
c) .label
d) .label-danger
View Answer
Answer: c
Explanation: .label adds a grey rounded box to the element, it provides additional
information about something e.g. “New”, .jumbortron creates padded grey box with rounded
corners that enlarge font sizes of text inside it, .item class added to each carousel item, it
may be text or images.

6. Which of the following is a container to enhance input by adding an icon?


a) .input-group-btn
b) .input-group-addon
c) .input-group
d) .input-group-lg
View Answer
Answer: c
Explanation: .input-group is a container to enhance an input by adding an icon, text or
button in front or behind it as a “help text”, .input-group-lg is for large input group, .input-
group-addon is used together with .input-group class, this makes it possible to add an icon
or help text next to input field.

7. Which of the following are the fades in a tab?


a) .in
b) .info
c) .initialism
d) .icon-prev
View Answer
Answer: a
Explanation: .in fades in tabs, .info adds a light-blue background to table row, it indicates
neutral informative change or action, .initialism displays the text inside <abbr> element in a
slightly smaller font size, .icon-prev specifies unicode icon used in corousels.

8. Which of the following will add feedback icons for inputs?


a) .has-warning
b) .has-danger
c) .has-success
d) .has-feedback
View Answer
Answer: d
Explanation: .has-feedback adds feedback icons for inputs like checkmark, warning and
error signs, .has-danger adds red color to label and red border to the input, as well as an
error icon inside the input, .has-success adds green color to label and green border to input,
as well as checkmark icon inside input.

9. Which of the following will create hamburger menu?


a) .icon-next
b) .icon-bar
c) .icon-prev
d) .img-circle
View Answer
Answer: b
Explanation: .icon-bar is used in the navbar to create hamburger menu i.e. three horizontal
bars, .icon-next creates Unicode icon, used in carousels, this is often replaced by glyphicon,
.icon-prev is Unicode icon used in carousels, .img-circle shapes an image to a circle.

10. Which of the following displays text inside <abbr> in slightly smaller font size:
a) .info
b) .input-group
c) .initialism
d) .in
View Answer
Answer: c
Explanation: .initialism displays text inside <abbr> element in slightly smaller font size,
.input-group is a container to enhance input by adding an icon, text or button in front or
behind it as a “help text”, .info adds light-blue background to table row, indicating a neutral
informative change or action.

11. Which of the following adds checkmark icon inside input?


a) .has-warning
b) .help-block
c) .has-success
d) .has-feedback
View Answer
Answer: a
Explanation: .has-warning adds yellow or orange color to label and a yellow or orange
border to the input, as well as checkmark icon inside the input, it is used together with .has-
feedback, .help-block in a block of help text that breaks onto the new line and may extend
beyond one line.

12. Which shapes an image to a thumbnail?


a) .img-circle
b) .img-responsive
c) .img-rounded
d) .img-thumbnail
View Answer
Answer: d
Explanation: .img-thumbnail shapes image to a thumbnail (borders), .img-rounded adds
rounded crners to an image, .img-responsive makes an image responsive, .img-circle
shapes an image to a circle, it is not supported in IE8 and earlier versions.

13. Which of the following forces an element to be hidden?


a) .hidden
b) .hidden-*
c) .hide
d) .icon-bar
View Answer
Answer: a
Explanation: .hidden forces an element to be hidden (display:none), .hidden-* hides content
depending on screen size, .hide is deprecates, .icon-bar is used in the navbar to create
hamburger menu.

14. Which of the following adds plain text next to form label?
a) .form-control-static
b) .form-group
c) .form-inline
d) .form-control
View Answer
Answer: a
Explanation: .form-control-static adds plain text next to form label within a horizontal form,
.form-group is a container for form input and label, .form-inline makes a <form> left-aligned
with inline-block controls, .form-control is used on input, textarea, and select elements to
span the entire width of the page and make them responsive.

15. Which is not a container for embedded content?


a) .embed-responsive
b) .embed-responsive-16by9
c) .embed-responsive-4by3
d) .embed-responsive-item
View Answer
Answer: d

1. Which of the following removes the default list-style and left margin on list items?
a) .list-unstyled
b) .blockquote-reverse
c) .list-inline
d) .initialism
View Answer
Answer: a
Explanation: .list-unstyled removes default list-style and left margin on list items, it works on
both <ul> and <ol>, this class only applies to immediate children list items to remove the
default list-style from any nested lists, can be applied to any listed lists as well. .initialism
displays text inside <abbr> tag. All items in a single line is displayed by .list-inline.

2. What lines up the terms and descriptions in <dl> element side by side?
a) .list-inline
b) .dl-horizontal
c) .list-unstyled
d) .initialism
View Answer
Answer: b
Explanation: .dl-horizontal lines up the terms and descriptions in <dl> element side-by-side,
it starts off like default <dl>s, but when browser window expands it will line up side-by-
side. .list-unstyled removes default list-style and left margin on list items. .initialism displays
text inside <abbr> tag.

3. Which class makes a text stand out?


a) .text-left
b) .small
c) .lead
d) .text-center
View Answer
Answer: c
Explanation: .lead makes a text stand out, .small indicates smaller text, set to 85% of the
size of the parent, .text-left indicates left-aligned text, .text-center indicates center-aligned
text.
advertisement

4. Which of the following indicates dropdown functionality?


a) .caret
b) .close
c) .sr-only
d) .text-hide
View Answer
Answer: a
Explanation: .caret indicates dropdown functionality, it will reverse automatically in dropup
menus, .close indicates a close icon, .sr-only hides an element to all devices except screen
readers. .text-hide hides the text present in document.

5. Which class separates items inside dropdown menu?


a) .divider
b) .disabled
c) .collapse
d) .dropdown-header
View Answer
Answer: a
Explanation: .divider separates items inside dropdown menu with horizontal line, .disabled
disables an item in dropdown menu, .collapse indicates collapsible content which can be
hidden or shown on demand. .dropdown-header class add header inside dropdown menu.

6. Which of the following shown collapsible content by default?


a) .dropdown-header
b) .collapse
c) .collapse.in
d) .panel-collapse
View Answer
Answer: c
Explanation: .collapse.in shows collapsible content by default, .panel-collapse shows
collapsible panel, toggle between hiding and showing panel, .collapse indicates collapsible
content which can be hidden or shown on demand. .dropdown-header class add header
inside dropdown menu.

7. Which style button that should open navbar on small screens?


a) .navbar-toggle
b) .navbar-text
c) .navbar-static-top
d) .navbar-right
View Answer
Answer: a
Explanation: .navbar-toggle styles button that should open navbar on small screens, often
used together with three .icon-bar classes to indicate a toggleable menu icon, .navbar-text
vertical align any elements inside navbar that are not links. Left, top and right borders from
the nav bar can be removed by .navbar-static-top. Alignment of nav links, text and buttons
in the nav bar to the right can be done by .navbar-right.

8. Which is used on a <ul> container?


a) .navbar-static-top
b) .navbar-nav
c) .navbar-toggle
d) .navbar-right
View Answer
Answer: b
Explanation: .navbar-nav is used on <ul> container that contains list items with links inside a
navigation bar, .navbar-right aligns nav links, forms, buttons or text in navbar to the right.
Left, top and right borders from the nav bar can be removed by .navbar-static-top. .navbar-
toggle styles button that should open navbar on small screens.

9. Which of the following removes left, top and right borders from navbar?
a) .navbar-toggle
b) .navbar-right
c) .navbar-static-top
d) .navabr-nav
View Answer
Answer: c
Explanation: .navbar-nav is used on <ul> container that contains list items with links inside a
navigation bar. .navbar-right aligns nav links, forms, buttons or text in navbar to the right.
.navbar-static-top removes left, top and right borders (rounded corners) from navbar, default
navbar has a grey border and 4px border-radius by default, .navbar-toggle styles button that
should open navbar on small screens.

10. Which of the following aligns .pager previous button to left?


a) .disabled
b) .pager
c) .next
d) .previous
View Answer
Answer: d
Explanation: .previous aligns .pager previous button to the left, .next aligns .pager next
button to the right, .disabled indicates unclickable link, .pager provides simple pagination
links (next/previous).

11. Which class indicates new or unread items?


a) .jumbortron
b) .badge
c) .label label-success
d) .pager
View Answer
Answer: b
Explanation: .badge class indicates unread or new items, .jumbotron indicates a big box for
calling extra attention to featured content or information, .label label-success indicates a
green label of type “success”. .pager provides simple pagination links (next/previous).

12. Which of the following will display a grey label?


a) .label label-info
b) .label label-primary
c) .label label-success
d) .label label-default
View Answer
Answer: d
Explanation: .label label-default indicates a default grey label, .label label-primary indicates
blue label of type “primary”, .label label-success indicates green label of type “success”,
.label label-info indicates light blue label of type “info”.

13. Which class indicates the current page?


a) .active
b) .disables
c) .pagination-sm
d) .pagiantion-lg
View Answer
Answer: a
Explanation: .active indicates the current page, .disabled indicates unclickable link,
.pagination-lg is used with .pagination to provide larger pagination, .pagination-sm is used
to provide smaller pagination.

14. Which of the following is added to link or header element?


a) .navbar-default
b) .navbar
c) .navbar-btn
d) .navbar-brand
View Answer
Answer: d
Explanation: .navbar creates navigation bar. .navbar-brand added to link or header element
inside navbar to represent a logo or header, .navbar-btn vertically aligns button inside
navbar, .nabar-default creates default navigation bar.

15. What creates black navigation bar?


a) .navbar-inverse
b) .navbar-header
c) .navbar-form
d) .navbar-link
View Answer
Answer: a

1. How many glyphs does bootstrap include?


a) 369
b) 360
c) 260
d) 100
View Answer
Answer: c
Explanation: Bootstrap includes 260 glyphs from Glyphicon Halflings set. They are normally
not available for free, but their creator has made them available for Bootstrap free of cost.

2. Which of the following allows an element to lock to an area on the page?


a) affix
b) alert
c) popover
d) tooltip
View Answer
Answer: a
Explanation: The affix plugin allows an element to become affixed (locked) to an area on the
page. It is often used with navigation menus or social icon buttons, to make them “stick” to
the specific area while scrolling up and down the page. An alert message box is created on
window by alert element. popover box displays when user clicks on that element. Tootlip is
popoup box which appears when user hovers the mouse pointer on it.

3. Which of the following occurs after fixed positioned is added to the element?
a) affix.bs.affix
b) affixed.bs.affix
c) affix-top.bs.affix
d) affixed-top.bs.affix
View Answer
Answer: b
Explanation: affixed.bs.affix occurs after fixed positioning is added to the element e.g.
after .affix-top class is replaced with .affix class, affix-bs.affix occurs before fixed positioning
is added to the element e.g. when .affix-top class is to be replaced with .affix class. Affix-
top-bs.affix occurs before top ekement return to its original place. Affixed-top-bs.affix occurs
before top ekement return to its original place.
advertisement

4. What indicates a closable alert box?


a) .alert-danger
b) .alert-dismissible
c) .alert-link
d) .alert-success
View Answer
Answer: b
Explanation: .alert-dismissible indicates a closable alert box, together with .close class, this
class is used to close the alert, adds extra padding, .alert-danger creates the red alert,
indicates dangerous or potentially negative action. .alert-link is used on links inside alerts to
give matching coloured links. .alert-success displays a green alert.

5. Which of the following makes the button appear pressed?


a) .btn-link
b) .disabled
c) .active
d) .btn-block
View Answer
Answer: c
Explanation: .active makes the button appear pressed, .disabled makes button disabled,
.btn-link makes the button look like a link, .btn-block makes a block-level button, spans the
full width of the parent element.

6. What changes button text to the original text?


a) .button(“loading”)
b) .button(“string”)
c) .button(“reset”)
d) .button(“toggle”)
View Answer
Answer: c
Explanation: .button(“reset”) changes button text to original text if changed, .button(“toggle”)
makes button look pressed, .button(“loading”) disables the button and changes the button
text to “loading…” .button(“string”) specifies a new button.

7. What adds slides to carousel?


a) .carousel
b) .carousel-inner
c) .item
d) .carousel-indicators
View Answer
Answer: b
Explanation: .carousel creates a slideshow. .carousel-inner is a container for slide items.
.carousel-inner adds slides to the carousel, .item specifies the content of each slide,
.carousel-indicators adds indicators for the carousel, these are little dots at bottom of each
slide which indicates how many slides are there in the carousel and the slide which the user
is currently viewing.

8. The default value for an interval is __________


a) 4000
b) 5000
c) 1000
d) 2390
View Answer
Answer: b
Explanation: interval specifies the delay in milliseconds between each slide, we can set the
interval to false to stop items from automatically sliding, its default value is 5000. The set
value should be number or Boolean false.

9. What activates the collapsible element with an option?


a) .collapse(“options”)
b) .collapse(“show”)
c) .collapse(“”toggle)
d) .collapse(“hide”)
View Answer
Answer: a
Explanation: .collapse(“options”) activates collapsible element with an option,
.collapse(“toggle”) toggles collapsible element, .collapse(“show”) shows collapsible element,
.collapse(“hide”) hides collapsible element.

10. Which event occurs when collapsible element is fully shown?


a) show.bs.collapse
b) shown.bs.collapse
c) hidden.bs.collapse
d) hide.bs.collapse
View Answer
Answer: b
Explanation: shown.bs.collapse occurs when collapsible element is fully shown after CSS
transitions have completed, show..bs.collapse occurs when collapsible element is about to
be shown. hidden.bs.collapse occurs when collapsible element is fully hidden.
.hide.bs.collapse occurs when collapsible element is about to be hidden.

11. Which of the following fades the model in and out?


a) .modal-content
b) .moal-lg
c) .fade
d) .modal-sm
View Answer
Answer: c
Explanation: .fade adds an animation or transition effect which fades modal in and out,
.modal-sm specifies a small modal, .modal-lg specifies a large modal, .modal-content style
modal properly with border, background-color etc.

12. What appends the popover to specific elements?


a) container
b) content
c) delay
d) placement
View Answer
Answer: a
Explanation: container appends the popover to specific element, e.g. container: ‘body’,
content specifies the text inside popover’s body, delay specifies the number of milliseconds
it will take to open and close popover. The popover position is specified by placement.

13. Which of the following specifies header text of popover?


a) title
b) trigger
c) selector
d) placement
View Answer
Answer: a
Explanation: title specifies the header text of popover, its default value is “”, trigger specifies
how popover is triggered, placement specifies popover position. A popover can be added to
specified selector by selector.

14. What is the default value of offset?


a) 20
b) 10
c) 30
d) 50
View Answer
Answer: b
Explanation: The default value of offset is 10, it specifies number of pixels to offset from top
when calculating the position of scroll.

15. Which of the following method will hide and destroy tooltip?
a) .tooltip(“hide”)
b) .tooltip(“toggle”)
c) .tooltip(“destroy”)
d) .tooltip(options)
View Answer
Answer: c

1. How many classes does bootstrap grid system has?


a) 3
b) 2
c) 1
d) 4
View Answer
Answer: d
Explanation: Bootstrap grid system has four classes. Xs, sm, md, lg. as is for phones having
screens less than 786px wide, sm is for tablets. Screens equal to or greater than 768px, md
is for small laptops, screen equal to or greater than 992px wide, lg is for laptops and
desktops, Screens equal to or greater than 1200px wide.

2. What is bootstrap’s global default font-size?


a) 12px
b) 14px
c) 10px
d) 9px
View Answer
Answer: b
Explanation: Bootstrap’s global default font-size is 14px, with line-height of 1.428. This is
applied to element and all paragraphs. In addition all <p> elements have bottom margins.

3. Progress bars are not supported in ______________


a) Internet Explorer 10
b) Internet Explorer 9
c) Opera
d) Chrome
View Answer
Answer: b
Explanation: Progress bars are not supported in Internet Explorer 9 and earlier versions,
because they use CSS3 transitions and animations to achieve some of the effects. For
improving accessibility for people using screen readers, we should include aria-* attributes.
advertisement

4. Which of the following clears bottom-margin of each panel?


a) .panel-group
b) .panel-footer
c) .panel-heading
d) .panel-body
View Answer
Answer: a
Explanation: .panel-group class clears bottom-margin of each panel. It also group many
panels together, we can wrap <div> with class .panel-group around them. Footer to the
panel is added by .panel-footer. Heading to the panel is given by .panel-heading class. The
content inside the panel is in .panel-body.

5. For inserting plain text we use __________


a) .form-control-static
b) .input-group
c) .input-group-addon
d) .input-group-btn
View Answer
Answer: a
Explanation: If we need to insert plain text next to a form label within horizontal form we can
use .form-control-static class on <p> element. The .input-group class is a container to
enhance input by adding an icon, text or button in front or behind it. An icon or help text next
to the input field and button next to input is attached by .input-group-addon and .input-
group-btn respectively.

6. Which attribute is used to input to prevent user input?


a) readonly
b) .sr-only
c) disabled
d) .has-feedback
View Answer
Answer: a
Explanation: A button is disabled by .disabled class. We can add readonly attribute to an
input to prevent user input. .sr-only class is applied on non-visible labels, disabled attribute
is added to disabled an input field.

7. What is the range of dimension for small devices?


a) 450px to 700px
b) 768px to 991px
c) 992px to 1199px
d) 120px to 500px
View Answer
Answer: b
Explanation: Small devices are defined as a screen width from 768px to 991px. For small
devices we use the class .col-sm-*, for medium devices the screen width from 992px to
1199px.

8. Which will change the order of a grid columns?


a) .col-md-push-*
b) .col-md-offset-*
c) .clearfix
d) .col-sm-*
View Answer
Answer: a

1. Which of the following map type is not supported by mapTypeId?


a) Hybrid
b) Terrain
c) Roadmap
d) Climatic map
View Answer
Answer: d
Explanation: The map type that is to be displayed is specified by mapTypeId. The types that
are supported are Satellite, Roadmap, Terrain and hybrid. E.g. mapTypeId:
google.maps.MapTypeId.ROADMAP.

2. Which one of the following defines properties for the map?


a) mapOptions
b) zoom
c) center
d) mapTypeId
View Answer
Answer: a
Explanation: The variable mapOptions defines the properties of the map. Where to center
the map is defined by center property, it uses longitude and latitude properties. To specify
the zoom level for the map we use zoom property.

3. Which one of the following is not google map overlay?


a) Polygon
b) Polyline
c) Eclipse
d) Marker
View Answer
Answer: c
Explanation: The objects on the map that are bound to longitude/latitude coordinates are
overlays. Google Maps has many types of overlays. Marker, Polygon, Polyline, Circle,
Rectangle, Info Windows, Custom overlays etc.
advertisement

4. For single locations on a map, we use the overlay for _______


a) Marker
b) Polygon
c) Polyline
d) Circle
View Answer
Answer: a
Explanation: Marker specifies the single locations on the map. It can also display custom
icon images. A series of straight lines on a map can be specified by Polyline. A series of a
straight line with the “closed” shape is defined by Polygon.

5. Polyline will not support the property of _________


a) Path
b) StrokeOpacity
c) Editable
d) Fillcolor
View Answer
Answer: d
Explanation: Polyline supports various properties like strokeColor, strokeWeight, editable,
strokeOpacity, path. The several longitude or latitude coordinates for a line is specified by
path. An opacity of the line is specified by strokeOpacity.

6. The property that is not supported by Polyline but by Polygon is __________


a) strokeWeight
b) fillOpacity
c) path
d) editable
View Answer
Answer: b
Explanation: The properties supported by polygon are strokeColor, strokeWeight, editable,
fillOpacity, fillColor, path, strokeCapacity. The hexadecimal color for the area within an
enclosed region is specified by fillColor, the opacity to fill color is specified by fillOpacity.

7. The property which is not supported by the circle is _________


a) path
b) radius
c) center
d) fillColor
View Answer
Answer: a
Explanation: Circle supports the properties like radius, center, strokeOpacity,
strokeCapacity, fillColor, fillOpacity, stokeOpacity, editable, specify google.maps.LatLng of
center of circle, the radius of a circle is specified by radius. Opacity of stroke color is
specified by strokeOpacity.

8. The value of fillOpacity lies between __________


a) 0.0 and 2.0
b) 0.0 and 1.0
c) 2.0 and 3.0
d) 3.0 and 4.0
View Answer
Answer: b
Explanation: The value of fillOpacity lies between 0.0 and 1.0. The value of strokeOpacity
also lies between 0.0 and 1.0, E.g path: Trip, strokeOpacity: 0.7, strokeWeight: 3,
strokeColor: “#000FFF” .

9. Which one of the following is not the default control in google maps?
a) Pan
b) Street view
c) MapType
d) Climate map
View Answer
Answer: d
Explanation: Google map has a default control set namely Pan, Zoom, Street view,
MapType, Rotate, Overview map, scale. A slider or “+/-” buttons for controlling zoom level
of the map. For panning the map we use pan control.

10. Which control displays the current map viewport?


a) Scale
b) Overview Map
c) Street view
d) MapType
View Answer
Answer: b
Explanation: The control overview displays a thumbnail overview map which reflects the
current map viewport within the wider area. A map scale element is displayed by scale
control. Pegman icon that can be dragged to the map for enabling street view is displayed
by this control. When a user wants to toggle between the maps (roadmap and satellite),
Map Type is used.

11. MapTypeControlOptions field may not contain _______


a) google.maps.MapTypeControlStyle.HORZONTAL_BAR
b) google.maps.MapTypeControlStyle.DEFAULT
c) google.maps.MapTypeControlStyle.DROPDOWN_MENU
d) google.maps.MapTypeControlStyle.LARGE
View Answer
Answer: d
Explanation: For modifying control we use mapTypeControlOptions field.
google.maps.MapTypeControlStyle.HORZONTAL_BAR displays a single button for each
map type. google.maps.MapTypeControlStyle.DEFAULT displays default behavior.
google.maps.MapTypeControlStyle.DROPDOWN_MENU helps in selecting map type via
dropdown menu.

12. Photographic map lies under the map type ____________


a) satellite
b) roadmap
c) hybrid
d) terrain
View Answer
Answer: a
Explanation: Photographic map lies under the map type satellite. Default 2D map and
normal maps lie under the type roadmap. Photographic + city and roads names include
hybrid maps. Maps with rivers, mountains etc. lies under the category terrain.

13. Which of the following type will support 45 degree perspective view?
a) Terrain
b) Hybrid
c) Roadmap
d) Climate map
View Answer
Answer: b
Explanation: Satellite and hybrid type of map support 45 degree perspective imagery view
for specified locations. The map will add a compass wheel around Pan control, it allows to
rotate the image. There is a toggle control to display 45 degree perspective view.

14. Which of the following method will return DOM object that contains map?
a) getCenter()
b) getProjection()
c) getDiv()
d) gettilt()
View Answer
Answer: c
Explanation: getDiv() method will return DOM object that contains map. Its return type is
node. getCenter() will return lng/lat of center of the map. getTilt() method will return angle of
incidence for aerial imagery in degrees. Current position is returned when getProjection()
event is fired up.
15. Which one of the following will set the viewport to contain given bounds?
a) fitBounds()
b) getBounds()
c) getHeading()
d) panTo()
View Answer
Answer: a

1. CSS stands for __________


a) Color Style Sheets
b) Cascade Sheets Style
c) Cascade Style Sheet
d) Cascading Style Sheets
View Answer
Answer: d
Explanation: CSS is a style sheet language which stands for Cascading Style Sheet.

2. In CSS, h1 can be called as _______


a) Selector
b) Attribute
c) Value
d) Tag
View Answer
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.

3. In css, “color:red” can be called as _____________


a) Selector
b) Rule
c) Declaration
d) Value
View Answer
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.
advertisement

4. Which of the following attributes is used to specify elements to bind style rules to?
a) id
b) class
c) tag
d) all of the mentioned
View Answer
Answer: d
Explanation: In CSS, styling elements can be done by id, class and tag attribute.
5. 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
View Answer
Answer: a
Explanation: For binding a particular unique element, id selectors are used. While for group
of elements, class selector can be used.

6. In CSS, “font-size” can be called as ________


a) Selector
b) Rule
c) Property
d) Property-Name
View Answer
Answer: d
Explanation: In CSS, font-size is a property-name which increases/decreases the font of
text.

7. _________ selectors are used to specify a group of elements.


a) id
b) class
c) tag
d) both class and tag
View Answer
Answer: b
Explanation: Class selectors are used to specify a group of elements. Id selector specifies a
particular unique element.

8. Which of the following tag is used to embed css in html page?


a) <script>
b) <style>
c) <css>
d) <!DOCTYPE html>
View Answer
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.

9. __________ has introduced text, list, box, margin, border, color, and background
properties.
a) css
b) html
c) ajax
d) php
View Answer
Answer: a
Explanation: CSS is a style sheet language which stands for Cascading Style Sheet. CSS
has introduced text, list, box, margin, border, color, and background properties.

10. Is it the best way to include H1 heading only one time on the web page.
a) True
b) False
View Answer
Answer: a

1. Which of the following element is used by the filter property to blur the images?
a) opaque()
b) scatter()
c) blur()
d) all of the mentioned
View Answer
Answer: c
Explanation: Blurs an element, for use by the filter property. Accepts a distance
measurement within which pixels are randomly scattered. A value of 0 leaves the image as
is.

2. Which of the following function adjust the brightness of an element’s color, for use by the
filter property?
a) contrast()
b) dark()
c) light()
d) brightness()
View Answer
Answer: d
Explanation: A value of 100% or decimal value of 1 leaves the image as is, while 0
produces black. Increasing the value from 1 or 100% brightens pixels from their original
values.

3. Which of the following function adjusts the difference between light and dark values, for
use by the filter property?
a) contrast()
b) dark()
c) light()
d) brightness()
View Answer
Answer: a
Explanation: A value of 100% or a decimal value of 1 leaves the image as is, while 0 results
in black. Increasing the value past 1 or 100% produces more dramatically stratified areas of
light and dark.
advertisement

4. Which of the following function with filter property to create your own sophisticated effects
on DOM elements?
a) create()
b) DOM()
c) custom()
d) none of the mentioned
View Answer
Answer: c
Explanation: None.

5. Which of the following function converts an element’s color to a shade of gray, for use by
the filter property?
a) shade()
b) grayscale()
c) black()
d) brightness()
View Answer
Answer: b
Explanation: A decimal value between 0 and 1 or percentage up to 100% controls the
extent of the gray effect.

6. Which of the following function flips an element’s colors, for use by the filter property?
a) image()
b) flip()
c) invert()
d) contrast()
View Answer
Answer: c
Explanation: A decimal value between 0 and 1 or percentage up to 100% controls the
extent of the color-negative effect, with 0.5 or 50% producing gray.

7. Which of the following function applies a saturation effect to an element’s color, making it
appear more or less vivid, for use by the filter property?
a) color()
b) saturation()
c) saturate()
d) none of the mentioned
View Answer
Answer: b
Explanation: A decimal value of 1 or percentage of 100% keeps the image as is, while
increasing the amount produces more dramatically stratified hues.

8. Which of the following function defines a linear gradient as a CSS image?


a) grayscale()
b) gradient()
c) image()
d) linear-gradient()
View Answer
Answer: d
Explanation: None.

9. Which of the following function two dimensional transformation in matrix format?


a) matrix()
b) matrix2d()
c) matrix3d()
d) perspective
View Answer
Answer: a
Explanation: None.

10. Which of the following function apply a sepia tinge to an element’s color, typical of old
photographs, for use by the filter property?
a) grayscale()
b) sepia()
c) contrast()
d) brightness()
View Answer
Answer: b

1. 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
View Answer
Answer: d
Explanation: Self-explainatory.

2. 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
View Answer
Answer: c
Explanation: Self-explainatory.

3. Which of the following is not a value for font-style property?


a) normal
b) italic
c) oblique
d) none of the above
View Answer
Answer: d
Explanation: Self-explainatory.
advertisement

4. 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
View Answer
Answer: b
Explanation: Self-explainatory.

5. 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
View Answer
Answer: d
Explanation: Self-explainatory.

6. Which of the following is not a appropriate value for font-variant property?


a) inherit
b) default
c) large-caps
d) small-caps
View Answer
Answer: c
Explanation: Self-explainatory.

7. Which of the following property adjusts the font-size of the fallback fonts defined with
font-family, so that the x-height is the same no matter what font is used?
a) default
b) font-size-fallback
c) font-adjust
d) font-size-adjust
View Answer
Answer: d
Explanation: Self-explainatory.

8. 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
View Answer
Answer: d
Explanation: Self-explainatory.

9. Which of the following font-size-adjust is value used in calculating the size of the fallback
fonts?
a) auto
b) number
c) count
d) none
View Answer
Answer: b
Explanation: Self-explainatory.

10. “font-style comes first than font-weight in font attribute”.State true or false.
a) True
b) False
View Answer
Answer: b

1. Which of the following is the CSS Extension Prefixes for Webkit?


a) -webkit
b) -o-
c) -web
d) -chrome
View Answer
Answer: a
Explanation: Browser sometimes adds prefixes to non-standard CSS properties. CSS
Extension prefix for Webkit is -webkit which is supported by almost all ios browsers. -o is
used by opera where as -moz is used by firefox browser.

2. Which CSS property is equivalent for the attribute <center>?


a) color
b) margin
c) align
d) font
View Answer
Answer: c
Explanation: The attribute <center> in html aligns the text in center. In CSS, this is
equivalent to align property which can align text to right, left or center as per the value.
Margin property sets the margin for an element. Color property is used to set/assign colour
to element. Font property is for increasing/decreasing the font of text.

3. Which CSS property is Equivalent for the align attribute?


a) float
b) text-align
c) centre
d) float & text-align
View Answer
Answer: a
Explanation: In the case of some elements such as <img>, the CSS float property is more
appropriate than text-align. text-align. Center attribute can only align text to center. Now-a-
days it is not supported.
advertisement

4. Which is the latest version of CSS available?


a) CSS2
b) CSS3
c) CSS3.1
d) CSS4
View Answer
Answer: b
Explanation: There are three different kinds of versions of CSS i.e CSS1, CSS2 and CSS3.
Out of them CSS3 is the latest version to be used.

5. Which CSS property is equivalent for the attribute <font>?


a) font-family
b) font-style
c) color
d) all of the mentioned
View Answer
Answer: b
Explanation: Both font-style and font-family are for styling the text. They show text in
different kinds of styles. Color is for setting/assigning colour to text or element. The font-size
property in CSS is equivalent to attribute <font>. Both of them either increase/decrease the
font of text.

6. Which of the following CSS property is used to give a line over the text?
a) text-decoration: underline
b) text-decoration: overline
c) text-decoration: line-through
d) text-decoration: none
View Answer
Answer: b
Explanation: Text-decoration is a CSS property used to decorate the text. The text-
decoration property takes many values such as overline, underline, line-through, none,
inherit, etc. Overline gives a line over the text. Underline value is used to add line under the
text. None value defines a normal text. When one wants to give a line through the text, line-
through value for text-property can be used.

7. The first CSS specification to become an official W3C Recommendation is ___________


a) (X)HTML CSS
b) CSS level 2
c) CSS level 2.1
d) CSS level 1
View Answer
Answer: d
Explanation: The first CSS specification to become an official W3C Recommendation is
CSS level 1, published on December 17, 1996. Håkon Wium Lie and Bert Bos are credited
as the original developers.

8. _________ first became a Candidate Recommendation on February 25, 2004, but it was
reverted to a Working Draft on June 13, 2005 for further review.
a) CSS level 1
b) CSS level 2
c) CSS level 3
d) CSS level 2.1
View Answer
Answer: d
Explanation: CSS level 2 revision 1, often referred to as “CSS 2.1”, fixes errors in CSS 2,
removes poorly supported or not fully interoperable features and adds already implemented
browser extensions to the specification. To comply with the W3C Process for standardizing
technical specifications, CSS 2.1 went back and forth between Working Draft status and
Candidate Recommendation status for many years. CSS 2.1 first became a Candidate
Recommendation on February 25, 2004, but it was reverted to a Working Draft on June 13,
2005 for further review.

9. There is no single, integrated ____________________ because it is split into separate


modules.
a) CSS1 specification
b) CSS2 specification
c) CSS3 specification
d) CSS4 specification
View Answer
Answer: d
Explanation: Here is no single, integrated CSS4 specification,[42] because it is split into
separate modules. However, there are “level 4” modules.

10. Unlike CSS 2, which is a large single specification defining various features?
a) CSS level 1
b) CSS level 2
c) CSS level 3
d) CSS level 2.1
View Answer
Answer: c

1. ___________ describes CSS properties to manipulate the position of “ruby”, which are
small annotations on top of or next to words, especially common in Chinese and Japanese.
a) align
b) ruby
c) lang
d) text-align
View Answer
Answer: b
Explanation: Align is used to align the content either left, right or center. Ruby describes
CSS properties to manipulate the position of “ruby”, which are small annotations on top of or
next to words, especially common in Chinese and Japanese. They are often used to give
the pronunciation or meaning of difficult ideograms. Text-align is for aligning the text either
left, right or in center.

2. ___________ has a grammar but unlike traditional (X)HTML it is not defined with a
document type definition.
a) CSS 1
b) CSS 2
c) CSS 2.1
d) CSS 3
View Answer
Answer: c
Explanation: CSS 2.1 has a grammar (www.w3.org/TR/CSS21/grammar.html) but unlike
traditional (X)HTML it is not defined with a document type definition. Instead the CSS
specification is a combination of prose and a grammar that could be used to build a simple
parser.

3. What will be the output of following code snippet?

advertisement

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

4. 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
View Answer
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.

5. Which of the following is the correct way to applying style to a document?


a) Use an external style sheet, either by importing it or by linking to it
b) Directly embed a document-wide style in the head element of the document
c) Set an inline style rule using the style attribute directly on an element
d) All of the mentioned
View Answer
Answer: d
Explanation: We can style the document using CSS in three different ways i.e embed, inline
and external. In any way as mentioned, we can apply CSS. An inline CSS means applying
styles rules directly to the element. In embed, we declare or write all the needed style in
<style></style> tag in the head element of the document. Expect these two ways we can
also use another way in which we can create an external style sheet and provide its link to
the document.

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

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

 
 
7. What does screen media type is used for?
a) For use with all devices
b) For use with handheld devices
c) For use with computer screens
d) For use with television-type devices
View Answer
Answer: c
Explanation: In CSS, media types are used for the compatibility of devices. There are four
types of nedia types i.e all, print, screen and speech. Out of which screen media type is
used for computer screens, tablets, smart-phones, etc.

8. For Inline Style, we don’t need to reapply style information throughout the document and
outside documents.
a) True
b) False
View Answer
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.

9. Inline style has the lowest priority


a) True
b) False
View Answer
Answer: b
Explanation: Among inline, embed and external style ways, inline has the highest priority
and it overrides the other.
10. 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
View Answer
Answer: a

1. Which of the following tag is used to linked information should be placed inside?
a) <head>
b) <html>
c) <div>
d) <body>
View Answer
Answer: a
Explanation: Linked information regarding CSS like external CSS document information is
always placed in <head> tag. <body> tag contains the body of the document.

2. Which of the following tag can be used to embed a Document-wide styles in a


document’s head element?
a) <head>
b) <style>
c) <script>
d) <html>
View Answer
Answer: b
Explanation: Document-wide styles can be embedded in a document’s head element using
the <style> tag. <script> </script> tag is used for Javascript.

3. The ________________ directive allows style sheets to be grouped and joined together,
though some might wonder what the value of this function is given what linked styles
provide.
a) <head>
b) <style>
c) <script>
d) @import
View Answer
Answer: d
Explanation: Within embedded <style> blocks, properties can be imported from an external
file and expanded in place, similar to a macro. Importing can be used to include multiple
style sheets. An imported style is defined within a <style> tag using @import followed
optionally by a type value and a URL for the style sheet. <style> & <script> tag conatins
CSS and Javascript content respectively. The metadata content is present in <head> tag.
advertisement

4. Which of the following measurement defines a measurement relative to a font’s x-height?


a) ex
b) em
c) pt
d) px
View Answer
Answer: a
Explanation: Defines a measurement relative to the height of a font in em spaces. Because
an em unit is equivalent to the size of a given font, if you assign a font to 12pt, each em unit
would be 12pt, thus 2em would be 24pt.

5. Which of the following measurement defines measurement as a percentage?


a) %
b) cm
c) em
d) in
View Answer
Answer: a
Explanation: Defines a measurement as a percentage. Percentages are denoted by a
number followed by the % symbol and are always relative to another value such as length.
Quite often they are used to specify some value relative to an inherited value from a parent
element.

6. Which of the following property sets the font size of text?


a) text-size
b) font-size
c) size
d) text
View Answer
Answer: b
Explanation: Syntax:
font-size: length | percentage | larger | smaller | xx-small | x-small |
small | medium | large | x-large | xx-larger | inherit

7. Which of the following property sets a variation of the specified or default font family?
a) height
b) font-weight
c) default
d) font-variant
View Answer
Answer: d
Explanation: Syntax:
font-variant: normal | small-caps | inherit

The small-caps value sets text in smaller-size all capitals. The normal value would be used
to override any inherited font-variant value. Font-weight is for increasing/decreasing weight
of font. It takes values like normal, bold, lighter, and bolder.

8. Which of the following property defines labels for a list of items?


a) list-style-type
b) list-style-image
c) list-style
d) list
View Answer
Answer: a
Explanation: Syntax:
list-style-type: disc | circle | square | decimal | decimal-leading-zero

list-style-image add graphical image to a list item. List-style sets all the properties for a list.

9. Which of the following property assigns a graphic image to a list item?


a) list-style-type
b) list-style-image
c) list-style
d) list
View Answer
Answer: b
Explanation: list-style-type defines labels for a list of item. List-style property set all the
properties for a list. List-style-image assign image to a list item.
Syntax:
list-style-image: url(url of image) | none

10. Which of the following property sets the amount of spacing between letters?
a) space
b) line-height
c) letter-spacing
d) letter-space
View Answer
Answer: c

1. Which of the following CSS3 Color Feature can be used as a macro for whatever the
current color is?
a) CurrentColor keyword
b) HSLa Color
c) HSL Color
d) RGB Color
View Answer
Answer: a
Explanation: This is useful if you want to dynamically change one color and have other
related colors change.

2. Which of the following CSS3 Color Feature like RGB color but adds an alpha channel
value to specify the opacity of the color?
a) RGB
b) RGBa
c) RGBaplha
d) AlphaRGB
View Answer
Answer: b
Explanation: An RGBa is specified via a function style rgba(r,g,b,a) value, where colors r, g,
and b are specified as a decimal value from 0 to 255 or a percentage from 0 to 100%, and
the alpha channel value for defining opacity is a number between 0 (fully transparent) and 1
(fully opaque). Values outside this range will be rounded up or down to fit the closest value.
3. Which of the following Color Format is a CSS’s six-digit hexadecimal format is the same
as color defined in (X)HTML?
a) 6-Hex Color
b) 3-Hex Color
c) RGBS
d) RGBa
View Answer
Answer: a
Explanation: The format specifies color as #rrggbb, where rr is the amount of red, gg the
amount of green, and bb the amount of blue, all specified in a hexadecimal value ranging
from 00 to FF.
advertisement

4. Which of the following Color Format is a CSS2 introduced named color keywords which
allows Web page colors to be matched to an operating system’s color use?
a) HSLa Color
b) Commonly defined named colors
c) System Color Names
d) Specificationdefined named colors
View Answer
Answer: c
Explanation: None.

5. Which of the following Color Format are a 17 defined colors under CSS 2.1?
a) HSLa Color
b) Commonly defined named colors
c) System Color Names
d) Specificationdefined named colors
View Answer
Answer: d
Explanation:
maroon (#800000) red (#ff0000)
orange (#ffA500) yellow (#ffff00)
olive (#808000) purple (#800080)
fuchsia (#ff00ff ) white (#ffffff)
lime (#00ff00) green (#008000)
navy (#000080) blue (#0000ff)
aqua (#00ffff) teal (#008080)
black (#000000) silver (#c0c0c0)
gray (#808080)
Other color keywords may be commonly used but are ad hoc in their definition.

6. Which of the following Color Format is a CSS colors can also be defined using the
keyword rgb, followed by three numbers between 0 and 255, contained in parentheses and
separated by commas, with no spaces between them?
a) RGB Color
b) RGBa Color
c) HSL Color
d) HSLa Color
View Answer
Answer: a
Explanation: RGB color values can also be defined using percentages. The format is the
same, except that the numbers are replaced by percentage values between 0% and 100%.

7. Which of the following Color Format is a CSS3 HSL value with a fourth value to set the
alpha channel value for the color to define the opacity of the element?
a) RGB Color
b) RGBa Color
c) HSL Color
d) HSLa Color
View Answer
Answer: d
Explanation: None.

8. Which of the following Selector selects an element if it’s the only child of its parent with its
type?

a) @media
b) :target
c) ::selection
d) :only-of-type

View Answer
Answer: d
Explanation: None.

 
 
9. Which of the following Selector same as :firstline; changed under CSS3 to make
pseudoelements obvious?

a) :first-letter
b) :last-child
c) :first-line
d) ::first-line

View Answer
Answer: d
Explanation: None.

 
 
10. What does HSL stands for?
a) Hue Specified Lightness
b) Hue Spot Lightness
c) Hue Saturation Lightness
d) None of the mentioned
View Answer
Answer: c
1. Which of the following is not an Absolute Unit?
a) px
b) em
c) pt
d) mm
View Answer
Answer: b
Explanation: em is a Relative Unit

2. Which of the following unit represent the viewport’s width?


a) vh
b) vmin
c) vw
d) ch
View Answer
Answer: c
Explanation: Self-explainatory.

3. Which of the following property sets in a shorthand form any or all background
properties?
a) color
b) wrap
c) background
d) all of the mentioned
View Answer
Answer:
Explanation:
advertisement

Syntax: background: background-color

4. Which of the following Color Format can also be defined using the keyword rgb, followed
by three numbers between 0 and 255, contained in parentheses and separated by commas,
with no spaces between them?
a) RGB Color
b) RGBa Color
c) HSL Color
d) HSLa Color
View Answer
Answer: a
Explanation:
Example: p {color:rgb(0%,10%,50%);}

5. Which of the following is not a attribute of the audio element?


a) controls
b) src
c) check
d) loop
View Answer
Answer: c
Explanation: Self-explainatory.

6. Which of the following element is used to specify multiple media resources for media
elements like audio and video?

a) <source>
b) <link>
c) <script>
d) <src>

View Answer
Answer: a
Explanation: Self-explainatory.

 
 
7. Which of the following Protocol enables a hyperlink to access a file on the local file
system?
a) https
b) ftp
c) file
d) telnet
View Answer
Answer: c
Explanation: Self-explainatory.

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

View Answer
Answer: c
Explanation: Self-explainatory.

 
 
9. Which of the following attribute specifies the URL of the linked resource?
a) src
b) link
c) rel
d) href
View Answer
Answer: d
Explanation: href attribute specifies the URL of the linked resource. A URL might be
absolute or relative.
10. Which of the following color has this value #ff0000?
a) blue
b) green
c) red
d) yellow
View Answer
Answer: c

1. Which of the following CSS property defines the different properties of all four sides of an
element’s border in a single declaration?
a) border
b) padding
c) border-collapse
d) border-width
View Answer
Answer: d
Explanation: The border-width property sets the width of an element’s four borders. This
property can have from one to four values.

2. Identify the CSS property defining bottom-left corner shape of the border?
a) border-radius
b) border-corner-radius
c) border-bottom-left-radius
d) border-left-radius
View Answer
Answer: c
Explanation: CSS3 border-radius property allows you can give any element “rounded
corners”.

3. Select the CSS property that sets the width of an element’s bottom border?
a) border-width
b) border-bottom
c) border-width-down
d) border-bottom-width
View Answer
Answer: d
Explanation: The border-bottom-width CSS property sets the width of the bottom border of a
box.
advertisement

4. Which of the following CSS property border-color property sets the color of an element’s
four borders?
a) border-background
b) border-background-color
c) border-color
d) all of the mentioned
View Answer
Answer: c
Explanation: The border-color property sets the color of an element’s four borders. This
property can have from one to four values.

5. Choose the CSS property that can be used for collapsing the borders between table
cells?
a) border
b) collapse-border
c) border-collapse
d) border-cell
View Answer
Answer: c
Explanation: The border-collapse property sets whether the table borders are collapsed into
a single border or detached as in standard HTML.

6. Which CSS property can be used to set the image as border instead of the border style?
a) background-image
b) border-image
c) background-image-source
d) border-image-source
View Answer
Answer: d
Explanation: The border-image-source property specifies the path to the image to be used
as a border (instead of the normal border around an element).

7. In how many way border-image-width CSS property can be defined?


a) 4
b) 6
c) 8
d) 9
View Answer
Answer: d
Explanation: The border-image-width CSS property defines the offset to use for dividing the
border image in nine parts, the top-left corner, central top edge, top-right-corner, central
right edge, bottom-right corner, central bottom edge, bottom-left corner, and central right
edge.

8. Which of the following is not an appropriate value for border-collapse?


a) all
b) collapse
c) inherit
d) separate
View Answer
Answer: a
Explanation: Except option a, all other values can be set to border collapse CSS property.

9. Which of the following specifies the distance between the borders of adjacent cells?
a) border-spacing-cell
b) border-width-spacing
c) border-spacing
d) cell-spacing
View Answer
Answer: c
Explanation: The border-spacing property sets the distance between the borders of
adjacent cells (only for the “separated borders” model).

10. Which of the following property defines the border-width, border-style and border-color
of an element’s top border in a single declaration?
a) border
b) border-top
c) border-top-corner
d) border-top-style
View Answer
Answer: b

1. Which of the following CSS property is used to set the text formatting?
a) font
b) font-style
c) text-decoration
d) all of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

2. Which of the following sets the color of any text decoration, such as underlines, overlines,
and strike throughs?
a) text-font
b) text-format
c) text-color
d) text-decoration-color
View Answer
Answer: d
Explanation: Self-explainatory.

3. Which of the following sets what kind of line decorations are added to an element, such
as underlines, overlines, etc?
a) text-style
b) text-decoration
c) text-line
d) text-decoration-line
View Answer
Answer: a
Explanation: Self-explainatory.
advertisement

4. Which of the following text-decoration value specifies each line of text has a line above
it?
a) line
b) underline
c) overline
d) blink
View Answer
Answer: c
Explanation: Self-explainatory.

5. Which of the following


a) text-overline
b) text-overline-decoration
c) text-overline-width
d) text-decoration-overline-width
View Answer
Answer: c
Explanation: Self-explainatory.

6. Which of the following CSS property determines how overflowed content that is not
displayed is signaled to the users?
a) text-flow
b) text-underflow
c) text-overflow
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

7. Which of the following sets the mode for the overline text decoration, determining
whether the text decoration affects the space characters or not?
a) text-decoration
b) text-mode-overflow
c) text-mode
d) text-overline-mode
View Answer
Answer: b
Explanation: Self-explainatory.

8. Which of the following specifies what parts of an element’s content are skipped over
when applying any text decoration?
a) @font-text
b) font-style
c) text-skip
d) text-decoration-skip
View Answer
Answer: d
Explanation: Self-explainatory.

9. Which of the following is not a appropriate value for text-overline-width?


a) thin
b) medium
c) <number>
d) none of the mentioned
View Answer
Answer: d
Explanation: Self-explainatory.

10. Which of the following property applies one or more drop shadows to the text?
a) text-shadow
b) text-effect
c) text-format
d) text-decoration-shadow
View Answer
Answer: a

1. Which of the following property sets the apparent position (in stereo sound) of the
synthesized voice for spoken media?
a) voice-balance
b) media-balance
c) balance
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.

2. Which of the following property allows the author to explicitly set the amount of time it
should take a speech synthesizer to read an element’s content?
a) @media
b) voice
c) voice-duration
d) all of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

3. Which of the following property sets the speaker’s voice used by a speech media agent
to read an element?
a) voice-family
b) voice-check
c) voice-control
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.
advertisement

4. Which of the following property determines how much variation in pitch or tone will be
created by the speech synthesize when reading an element?
a) voice-pitch
b) voice-range
c) voice-stress
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

5. Which of the following property sets the speed at which the voice synthesized by a
speech media agent will read content?
a) voice-volume
b) voice-pitch
c) voice-stress
d) voice-rate
View Answer
Answer: d
Explanation: Self-explainatory.

6. Which of the following property sets pitch or tone (high or low) for the synthesized speech
when reading an element; the pitch may be specified absolutely or relative to the normal
pitch for the voice-family used to read the text?
a) voice-check
b) voice-format
c) voice-pitch
d) voice-volume
View Answer
Answer: c
Explanation: Self-explainatory.

7. Which of the following property sets the volume for spoken content in speech media. It
replaces the deprecated volume property?
a) voice-volume
b) volume
c) !important
d) @media
View Answer
Answer: a
Explanation: Self-explainatory.

8. Which of the following is not a appropriate value for voice-volume?


a) silent
b) soft
c) hard
d) <number>
View Answer
Answer: c
Explanation: Self-explainatory.

9. Which of the following is not a appropriate value for voice-balance?


a) left
b) leftwards
c) up
d) centre
View Answer
Answer: c
Explanation: Self-explainatory.

10. Which of the following is not a appropriate value for voice-rate?


a) slow
b) fast
c) medium
d) none of the mentioned
View Answer
Answer: d

1. Which of the following property is used to draw a line around elements outside the
borders?
a) line
b) padding
c) outline
d) border
View Answer
Answer: c
Explanation: Outlines do not take up space, they are drawn above the content.

2. Choose the option that correctly specifies the output of the following CSS.

span {
border: 1px solid red;
outline: green dotted thick;
}

a) All span elements will have a red border and a green dotted outline
b) All span elements will have a green thick border and a red outline
c) All span elements will have an outer red border and inner green dotted border
d) All span elements will have a outer green dotted border and an inner red border
View Answer
Answer: d
Explanation: The border property creates the inner border, while the outline sets the outer
border.
advertisement

3. Which of the following property specifies the color of an outline?


a) color-outline
b) outline-color
c) outline-style-color
d) none of the mentioned
View Answer
Answer: b
Explanation: As the property name specifies, it sets the color of the outline to the provided
value.
4. Identify the outline property that specifies the amount of area extended beyond the
border box.
a) outset3d
b) inset
c) outset
d) inset3d
View Answer
Answer: c
Explanation: It specifies a 3D outset border. The effect depends on the border-color value.

5. Which of the following value specifies a dashed outline?


a) dash
b) dashed
c) double-dash
d) all of the mentioned
View Answer
Answer: b
Explanation: The property defines a dashed border.

6. Which of the following property specifies the look and design of an outline?
a) outline-font
b) outline-style
c) outline-format
d) none of the mentioned
View Answer
Answer: b
Explanation: The outline-style CSS property is used to set the style of the outline of an
element. An outline is a line that is drawn around elements, outside the border edge, to
make the element stand out.

7. Which of the following values specifies a 3D grooved outline?


a) initial
b) ridge
c) groove
d) groove3d
View Answer
Answer: c
Explanation: groove specifies a 3D grooved border. The effect depends on the border-color
value.

8. Select the output of the following CSS.

div {
border-width:5px;
border-style:dotted solid double dashed;
}

a) Box having dotted top outline, solid right outline, double bottom outline and dashed left
outline
b) Box having dotted top outline, solid left outline, double bottom outline and dashed right
outline
c) Box having dotted bottom outline, solid right outline, double top outline and dashed left
outline
d) Box having dotted bottom outline, solid left outline, double top outline and dashed left
outline
View Answer
Answer: a
Explanation: The shorthand run in clockwise direction.

9. Which of the following specifies the width of an outline?


a) outline-size
b) outline-width
c) outline-height
d) both outline-size and outline-width
View Answer
Answer: b
Explanation: The outline-width CSS property is used to set the width of the outline of an
element.

10. Which of the following value specifies a solid outline?


a) bold
b) rock
c) solid
d) dashed
View Answer
Answer: c

1. What does all media type is used for?


a) For use with all devices
b) For use with speech synthesizers
c) For use with handheld devices
d) For use with tactile Braille devices
View Answer
Answer: a
Explanation: None.

2. What does projection media type is used for?


a) For use with projected media (direct computer-to-projector presentations), or printing
transparencies for projection.
b) For use with color computer screens
c) For use with handheld devices
d) For use with television-type devices
View Answer
Answer: a
Explanation: None.

3. What does tty media type is used for ?


a) For use with low-resolution teletypes, terminals, or other devices with limited display
capabilities.
b) For use with Braille printers.
c) For use with speech synthesizers.
d) For use with projected media (direct computer-to-projector presentations), or printing
transparencies for projection.
View Answer
Answer: a
Explanation: None.
advertisement

4. What does aural media type is used for ?


a) For use with low-resolution teletypes, terminals, or other devices with limited display
capabilities
b) For use with Braille printers
c) For use with speech synthesizers
d) For use with projected media (direct computer-to-projector presentations), or printing
transparencies for projection
View Answer
Answer: c
Explanation: None.

5. What does braille media type is used for?


a) For use with all devices
b) For use with speech synthesizers
c) For use with handheld devices
d) For use with tactile Braille devices
View Answer
Answer: b
Explanation: None.

6. The __________ rule makes it possible to define different style rules for different media
types in the same stylesheet.
a) audio/video
b) sink
c) @media
d) @canvas
View Answer
Answer: c
Explanation:
Example:
@media screen {
p {
font-family: verdana, sans-serif;
font-size: 17px;
}
}

7. What is the way to specify media dependencies for style sheets ?


a) Specify the target medium from a style sheet with the @media or @import at-rules
b) Specify the target medium within the document language
c) both Specify the target medium from a style sheet with the @media or @import at-rules
and Specify the target medium within the document language
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

8. ____________ types are mutually exclusive in the sense that a user agent can only
support one media type when rendering a document.
a) tv
b) tty
c) media
d) audio
View Answer
Answer: c
Explanation: Media types are mutually exclusive in the sense that a user agent can only
support one media type when rendering a document. However, user agents may use
different media types on different canvases. For example, a document may (simultaneously)
be shown in ‘screen’ mode on one canvas and ‘print’ mode on another canvas.

9. If an @media/@import rule contains a malformed media type (not an identifier) then the
statement is valid. State true or false.
a) True
b) False
View Answer
Answer: b
Explanation: @media and @import rules with unknown media types (that are nonetheless
valid identifiers) are treated as if the unknown media types are not present. If an
@media/@import rule contains a malformed media type (not an identifier) then the
statement is invalid.

10. Media type names are case-insensitive. State true or false.


a) True
b) False
View Answer
Answer: a

1. Which of the following property defines in a shorthand form the width, style, and
color for the bottom border of an element?
a) border-bottom
b) border-bottom-color
c) border-bottom-all
d) none of the mentioned
View Answer
Answer: a
Explanation:
Syntax: border-bottom: border-width border-style border-color;

2. Which of the following property sets the width of an element’s bottom border?
a) border
b) border-collapse
c) border-bottom-width
d) none of the mentioned
View Answer
Answer: c
Explanation:
advertisement

Syntax: border-bottom-width: non-negative length | medium | thick | thin |


inherit

3. Which of the following property defines whether table cell borders are connected or
separate?
a) border-table
b) border
c) border-collapse
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: border-collapse: collapse | separate | inherit

4. Which of the following property defines the style for the right border of an element?
a) border-spacing
b) border-spacing
c) border-right
d) border-right-style
View Answer
Answer: c
Explanation:
Syntax: border-right-style: dashed | dotted | double

5. Which of the following property defines the color of an element’s top border?
a) border-color
b) border-top
c) border-top-color-webkit
d) border-top-color
View Answer
Answer: d
Explanation:
Syntax: border-top-color: color | transparent | inherit

6. Which of the following property sets the width of an element’s complete border?
a) border-width
b) width
c) border-depth
d) none of the mentioned
View Answer
Answer: a
Explanation:
Syntax: border-width: width
7. Which of the following property defines the visual style of up to four different sides of a
border?
a) border-style
b) border
c) border-top
d) none of the mentioned
View Answer
Answer: a
Explanation: Syntax:
border-style: style

8. Which of the following defines in a shorthand form the width, style, and color for the top
border of an element?
a) border-up
b) border-bottom
c) border-style
d) none of the mentioned
View Answer
Answer: d
Explanation:
Syntax: border-top: border-width border-style border-color;

9. Which of the following property defines the y (vertical) coordinate for a positioned
element, relative to the bottom of the enclosing object or browser window?
a) border
b) bottom
c) position
d) none of the mentioned
View Answer
Answer: b
Explanation:
Syntax: bottom: length | percentage | auto | inherit

10. Which of the following property specifies the placement of an element in relation to
floating objects?
a) clear
b) color
c) space
d) none of the mentioned
View Answer
Answer: a

1. Which of the following property specifies the transparency of an element?


a) alpha
b) opacity
c) opac
d) none of the mentioned
View Answer
Answer: b
Explanation:
Syntax: opacity: alphavalue | inherit

advertisement

2. Which of the following property defines the offset from an element’s border and its
outline?
a) outline-border
b) outline-offset
c) outline-radius
d) none of the mentioned
View Answer
Answer: b
Explanation:
Syntax: outline-offset: length | inherit

3. Which of the following property allows a marquee to be used in the case of a text
overflow?
a) overflow-style
b) overflow-text
c) overflow-marquee
d) none of the mentioned
View Answer
Answer: a
Explanation:
Syntax: overflow-style: auto | marquee-block

4. Which of the following property defines how content should behave when it exceeds the
width of its enclosing element?
a) overflow-y
b) overflow-x
c) overflow-z
d) overflow-width
View Answer
Answer: b
Explanation:
Syntax: overflow-x: auto | hidden

5. Which of the following property is used to give a 3-D sense of depth to an element?
a) animation
b) perspec
c) sense
d) perspective
View Answer
Answer: d
Explanation:
Syntax: perspective: none

6. Which of the following property is used to define whether an element should be resized
and, if so, upon what axis?
a) axis
b) resize
c) set-origin
d) set-axis
View Answer
Answer: b
Explanation:
Syntax: resize: both | horizontal | none

7. Which of the following property defines the alignment of Ruby text as defined by a <rt>
tag, in relation to base text defined by a <ruby> tag?
a) ruby-align
b) ruby-text
c) ruby
d) none of the mentioned
View Answer
Answer: a
Explanation:
Syntax: ruby-align: auto | center

8. Which of the following property sets the base color for a scroll bar, which will include the
scroll box, track, and scroll arrows?
a) scrollbar-base
b) scrollbar-base-color
c) scrollbar-background
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: scrollbar-base-color: color

9. Which of the following property defines a color for the face of a scroll bar, including arrow
regions and the scroll box?
a) scrollbar-face
b) scrollbar-face-color
c) scrollbar-face-background
d) scrollbar-background
View Answer
Answer: c
Explanation:
Syntax: scrollbar-face-color: color

10. Which of the following property defines a highlight color for a scroll bar and scroll
arrows?
a) scrollbar-color
b) scrollbar-highlight
c) scrollbar-highlight-color
d) scrollbar-highlight-background
View Answer
Answer: c
1. Which of the following property sets the size of the font?
a) font-size
b) font-variant
c) font-style
d) font-weight
View Answer
Answer: a
Explanation: Self-explainatory.

2. Which of the following Property controls the display of small caps?


a) font-size
b) font-variant
c) font-style
d) font-weight
View Answer
Answer: b
Explanation: Self-explainatory.

3. Which of the following font-weight property make the text lighter in relation to its parent?
a) unfocus
b) normal
c) lighter
d) normal
View Answer
Answer: c
Explanation: Self-explainatory.
advertisement

4. Which of the following property converts text to initial capitals, all uppercase, or all
lowercase?
a) text-transform
b) text
c) text-decoration
d) text-uppercase
View Answer
Answer: a
Explanation: Self-explainatory.

5. Which of the following font-variant property render text using the same letter case as in
the underlying code?
a) bold
b) small-caps
c) normal
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.
6. Which of the following property sets the alignment of the last line of a text block?
a) overflow-wrap
b) text-align-last
c) text-transform
d) text-indent
View Answer
Answer: b
Explanation: Self-explainatory.

7. Which of the following property controls how spaces and word wrapping are handled?
a) spacing
b) text-space
c) white-space
d) word-spacing
View Answer
Answer: c
Explanation: Self-explainatory.

8. Which of the following property specifies what line decorations, if any, are added to the
text?
a) text-decoration-line
b) text-line-decoration
c) text-decoration-style
d) text-style-decoration
View Answer
Answer: a
Explanation: Self-explainatory.

9. Which of the following property applies one or more shadows to text?


a) text-shadow
b) shadowed
c) shadow
d) word-shadow
View Answer
Answer: a
Explanation: Self-explainatory.

10. Which of the following property allows long text, such as a URL, to be broken if it would
otherwise over?
a) text-transform
b) word-wrap
c) text-overflow
d) text-indent
View Answer
Answer: b

1. Which of the following is used to associate a font name to be used in a style sheet with
some downloadable font?
a) @font-face
b) @charset
c) @media
d) !important
View Answer
Answer: a
Explanation: None.

2. Which of the following is not value for the font-stretch(Font descriptor)?


a) normal
b) 50%
c) expanded
d) ultra-expanded
View Answer
Answer: b
Explanation: None.

3. Which of the following font format is supported by all the latest browser?
a) EOT
b) WOFF2
c) SVG
d) WOFF
View Answer
Answer: d
Explanation: None.
advertisement

4. Which of the following media query describe output style portrait if height is greater than
or equal to width, landscape if the opposite?
a) grid
b) monochrome
c) resolution
d) orientation
View Answer
Answer: d
Explanation: None.

5. Which of the following media query describe the ratio of the width to the height of the
media?
a) ratio
b) aspect-ratio
c) deviceaspect-ratio
d) resolution
View Answer
Answer: b
Explanation: None.

6. Which of the following media query describe describes the height of the screen or full
height of the output page?
a) height
b) aspect-ratio
c) device-height
d) resolution
View Answer
Answer: c
Explanation: None.

7. Which of the following property sets the style of a font?


a) font
b) style
c) font-style
d) @font-face
View Answer
Answer: c
Explanation: Syntax:
font-style: italic | normal | oblique | inherit.

8. Which of the following property specifies whether an element is an accelerator indicator


or not?
a) push
b) accelerator
c) jump-start
d) animation
View Answer
Answer: b
Explanation: Syntax:
accelerator: true | false.

9. Which of the following property sets a variation of the specified or default font family?
a) fonts
b) font-style
c) font-variant
d) font-weight
View Answer
Answer: c
Explanation: Syntax:
font-variant: normal | small-caps.

10. The @font-face rules assign different names to the regular and bold versions of the
font.State true or false.
a) True
b) False
View Answer
Answer: a

1. Which of the following property adds padding to the top of an element?


a) height
b) padding-height
c) top
d) padding-top
View Answer
Answer: d
Explanation: Self-explainatory.

2. Which of the following display property value is described by treats the element as inline?
a) inline-block
b) list-item
c) block
d) inline
View Answer
Answer: d
Explanation: Self-explainatory.

3. Which of the following property defines the style for the bottom border of an element?
a) border-bottom-style
b) border-collapse
c) border-style-bottom
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.
advertisement

4. Which of the following property defines the style for the left border of an element?
a) border-style
b) border-left-style
c) border-left-width
d) border-right
View Answer
Answer: b
Explanation: Self-explainatory.

5. Which of the following visibility property value is described by The element is not visible,
but the layout of surrounding elements is not affected?
a) visible
b) hidden
c) collapse
d) none of the mentioned
View Answer
Answer: b
Explanation: None.

6. Which of the following display property value is described by used internally by browsers
to create list items. Of no practical value to web designers?
a) inline-block
b) list-item
c) group
d) none
View Answer
Answer: b
Explanation: Self-explainatory.

7. Which of the following property controls the horizontal overflow of a block or inline block?
a) overflow-x
b) overflow
c) overflow-y
d) overflow-k
View Answer
Answer: a
Explanation: Self-explainatory.

8. Which of the following Overflow property value is described by scrollbars should be


provided if the content is too big, but actual implementation is left up to the browser?
a) visible
b) scroll
c) auto
d) hidden
View Answer
Answer: c
Explanation: Self-explainatory.

9. Which of the following property sets a consistent margin on all four sides of the affected
element?
a) boder
b) margin
c) padding
d) none fof the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

10. Which of the following box-sizing property value is described by width and height
include content, padding, and borders?
a) border-box
b) content-box
c) content-box
d) none fof the mentioned
View Answer
Answer: a

1. Which of the following property sets the background image to scroll or not to scroll with its
associated element’s content?
a) background-scroll
b) background-attach
c) background-attachment
d) background-allowance
View Answer
Answer: c
Explanation:
Syntax: background-attachment: scroll | fixed | inherit

advertisement

2. Which of the following property sets an element’s background color?


a) background-image
b) background-color
c) background-colors
d) background-position
View Answer
Answer: b
Explanation:
Syntax: background-color: color | transparent

3. Which of the following property defines the color of an element’s right border?
a) border-right-colors
b) border-right-color
c) border-right
d) border-color
View Answer
Answer: b
Explanation:
Syntax: border-right-color: color | transparent

4. Which of the following property defines the space between cells in a table?
a) auto
b) border
c) spacing
d) border-spacing
View Answer
Answer: d
Explanation:
Syntax: border-spacing: non-negative length(s) | inherit

5. Which of the following property defines the visual style of up to four different sides of a
border?
a) border-color
b) border-img
c) border-visual
d) border-style
View Answer
Answer: b
Explanation:
Syntax: border-style: style

6. Which of the following property defines in a shorthand form the width, style, and color for
the top border of an element?
a) border-style
b) border-height
c) border-width
d) border-top
View Answer
Answer: d
Explanation:
Syntax: border-top: border-width border-style border-color;

7. Which of the following property sets the shadow for a box element?
a) shadow
b) set-shadow
c) canvas-shadow
d) box-shadow
View Answer
Answer: b
Explanation:
Syntax:box-shadow: none | inherit

8. Which of the following property defines a shadow effect for text?


a) box-shadow
b) img-shadow
c) text-shadow
d) none of the mentioned
View Answer
Answer: d
Explanation: The shadow effects are applied in the order specified and may overlay each
other, but they will never overlay the text itself. Each shadow effect must specify a shadow
offset horizontally and vertically and may optionally specify a blur radius and a shadow
color.

9. Which of the following property defines a shadow color for the right and bottom edges of
a scroll bar?
a) scrollbar-darkshadow
b) scrollbar-shadow-color
c) scrollbar-darkshadow-color
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: scrollbar-darkshadow-color: color

10. Which of the following property defines a color for the right and bottom edges of a scroll
bar.
a) scrollbar-color
b) scrollbar-darkshadow-color
c) scrollbar-shadow
d) scrollbar-shadow-color
View Answer
Answer: d

1. Which of the following property sets list-style-type, list-style-position, and liststyle-image?


a) style
b) list-style
c) menu-style
d) img-style
View Answer
Answer: b
Explanation:
Syntax: list-style: list-style-type | list-style-position | list-style-image

advertisement

2. Which of the following property assigns a graphic image to a list item?


a) list-image-style
b) list-style-image
c) list-image
d) none of the mentioned
View Answer
Answer: b
Explanation:
Syntax: list-style-image: url(url of image) | none

3. Which of the following property specifies whether the labels for an element’s list items are
positioned inside or outside the “box” defined by the listed item?
a) list-style
b) list-position
c) list-style-position
d) list-position-style
View Answer
Answer: c
Explanation:
Syntax: list-style-position: inside | outside | inherit

4. Which of the following property defines labels for a list of items?


a) list-shape
b) list-style
c) list-type
d) list-style-type
View Answer
Answer: d
Explanation:
Syntax: list-style-type: disc | circle | square | decimal

5. Which of the following property defines in a shorthand form the width, style, and color for
all four sides of an element’s border?
a) border
b) border-style
c) border-color
d) border-all
View Answer
Answer: a
Explanation:
Example: div {border: 2px double red;}

6. Which of the following property defines in a shorthand form the width, style, and color for
the left border of an element?
a) border
b) border-style
c) border-left
d) none of the mentioned
View Answer
Answer: b
Explanation:
Syntax: border-left: border-width border-style border-color;

7. Which of the following property is used to round border corners?


a) border-corner
b) border-round
c) border-radius
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: border-radius: horizontal-radius vertical-radius

8. Which of the following property influences the horizontal alignment of an element, making
it “float” toward the left or right margin of its containing element?
a) float
b) float-left
c) float-right
d) float-align
View Answer
Answer: d
Explanation:
Syntax: float: left | right | none | inherit;

9. Which of the following property sets the font face to be used for text?
a) font
b) font-text
c) font-family
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: font-family: font 1

10. Which of the following property sets the font size of text?
a) font
b) font-text
c) font-size
d) none of the mentioned
View Answer
Answer: c

1. Which of the following CSS Gradient Functions sets the direction and colors of a gradient
that fades from one color to the next in a straight line?
a) gradient()
b) line-gradient()
c) linear-gradient()
d) none of the mentioned
View Answer
Answer: d
Explanation: Self-explainatory.

2. Which of the following CSS Gradient Functions creates a circular or elliptical gradient,
and optionally sets its shape, size, and position?
a) radial-gradient()
b) circular-gradient()
c) elliptical-gradient()
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

3. Which of the following CSS Gradient Functions Creates a radial gradient that repeats
infinitely?
a) repeat-radial-gradient()
b) repeating-radial-gradient()
c) infinite-radial-gradient()
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.
advertisement

4. Which of the following is not a browser-specific versions of linear-gradient()?


a) -moz-linear-gradient()
b) -o-linear-gradient()
c) -mac-linear-gradient()
d) -webkit-linear-gradient()
View Answer
Answer: c
Explanation: Self-explainatory.

5. Which of the following argument is not accepted by radial-gradient() function?


a) Shape
b) Time
c) Color stops
d) Position
View Answer
Answer: b
Explanation: Self-explainatory.

6. Which of the following function creates a CSS gradient image that can be used anywhere
an image URL is required, including background-image, border-image, and list-style
properties?
a) canvas
b) gradient
c) animation
d) color
View Answer
Answer: b
Explanation: Self-explainatory.

7. Which of the following option best explain this code “background-image: repeating-radial-
gradient(circle at 50% 100%, #FFEB79, #D9CC3C 5%);”?
a) Creating Infinte circular Gradients
b) Creating Repeating Circular Gradients
c) Creating Repeating Radial Gradients
d) Creating Infinite Radial Gradients
View Answer
Answer: c
Explanation: Self-explainatory.

8. Which of the following option best explain this code “background-image: repeating-linear-
gradient(-45deg, #426A77, #FFF 6px);”?
a) Creating Straight Stripes
b) Creating Cubic Stripes
c) Creating Spiral Stripes
d) Creating Diagonal Stripes
View Answer
Answer: d
Explanation: Self-explainatory.

9. Which of the following option best explain this code “background-image: repeating-linear-
gradient(to right, #D9CC3C, #FFEB79 5%, #D9CC3C 10%);”?
a) Creating a Repeating Gradient
b) Creating a Mix Repeating Gradient
c) Creating a Shadow Repeating Gradient
d) Creating a Smooth Repeating Gradient
View Answer
Answer: d

1. Which of the following media feature describes the number of entries in the color lookup
table of the output device
a) color
b) color-index
c) color-value
d) color-@media
View Answer
Answer: b
Explanation: The ‘color-index’ media feature describes the number of entries in the color
lookup table of the output device. If the device does not use a color lookup table, the value
is zero

2. Which of the following Viewport Property sets the initial scaling factor?
a) scale
b) initial-scale
c) minimum-scale
d) user-scale
View Answer
Answer: b
Explanation: Self-explainatory.

3. Which of the following Viewport Property determines whether the display can be zoomed
in
and out?
a) scale
b) set-scale
c) adjust-scale
d) user-scalable
View Answer
Answer: d
Explanation: Self-explainatory.
advertisement

4. Which of the following @viewport Property sets the viewport height in the same way as
width?
a) height
b) width
c) viewpor-width
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.

5. Which of the following @viewport Property locks the document in the specified
orientation, portrait or landscape?
a) orientation
b) resolution
c) landscape
d) portrait
View Answer
Answer: a
Explanation: Self-explainatory.

6. Which of the following Media Query describe the ratio of the device width to the device
height of the media?
a) device-aspect
b) device-aspect-ratio
c) device-aspect-query
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

7. Which of the following Media Query determines if output is grid, like a simple terminal or
phone, or bitmap, like a standard monitor or printer?
a) monochrome
b) grid
c) resolution
d) device-height
View Answer
Answer: b
Explanation: Self-explainatory.

8. Which of the following Media Query describes the scanning method of a TV?
a) orientation
b) scan
c) resolution
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

9. Which of the following Media Query determines if output is monochrome and how many
bits are used for gray display?
a) gray
b) chrome
c) monochrome
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

10. A media query consists of a media type and zero or more expressions that check for the
conditions of particular media features. State true or false.
a) True
b) False
View Answer
Answer: a

1. Which of the following is the correct way to applying style to a document?


a) Use an external style sheet, either by importing it or by linking to it
b) Directly embed a document-wide style in the head element of the document
c) Set an inline style rule using the style attribute directly on an element
d) All of the mentioned
View Answer
Answer: d
Explanation: None.

2. What will be the output of following code snippet?

<style h1 {color: green;}>


<h1>Hello</h1>

a) h1 heading becomes green


b) error
c) h1 heading disappears
d) nothing happens
View Answer
Answer: c
Explanation: None.
advertisement

3. What will be the output of below mentioned code snippet?

<p style="color: red">text</p>

a) make that specific paragraph red.


b) error
c) nothing happens
d) none of the mentioned
View Answer
Answer: a
Explanation: NOne.

4. The _______property is used to set the color of the text.


a) pallet
b) colour
c) color
d) text-decoration
View Answer
Answer: c
Explanation: None

5. Which of the following is the correct way to apply Styles?


a) inside an HTML element
b) inside the section of an HTML page
c) in an external CSS file
d) all of the mentioned
View Answer
Answer: d
Explanation: None.

6. Which of the following CSS list properties is/are correct?


a) Set different list item markers for ordered lists
b) Set different list item markers for unordered lists
c) Set an image as the list item marker
d) All of the mentioned
View Answer
Answer: d
Explanation: None.

7. A ___________ is used to define a special state of an element.


a) pseudo-tag
b) pseudo-element
c) pseudo-id
d) pseudo-class
View Answer
Answer: d
Explanation: None.

8. The __________ property specifies the type of positioning method used for an element.
a) align
b) float
c) position
d) padding
View Answer
Answer: c
Explanation: None.

9. Which style is this?

<body style="background-color: lightcyan">

a) Inline Styles
b) External Style Sheet
c) External Style Sheettyle Sheet
d) None of the mentioned
View Answer
Answer: a
Explanation: None.

10. Is this correct way to apply css.State true or false.

<link rel="stylesheet" type="text/css" href="mystyle.css">

a) True
b) False
View Answer
Answer: a

This set of CSS Multiple Choice Questions & Answers focuses on “Using Advanced
Selectors”.

1. Which of the following selector selects all elements of E that have the attribute attr that
end with the given value?
a) E[attr^=value]
b) E[attr$=value]
c) E[attr*=value]
d) none of the mentioned

View Answer
Answer: b
Explanation:
Example: p[title$="!"] {color: red;}

 
 
advertisement

2. Which of the following selector selects the elements that are checked?

a) E ~ F
b) ::after
c) :checked
d) none of the mentioned

View Answer
Answer: c
Explanation:
Example: :checked {color: blue;}

 
 
3. Which of the following selector selects the elements that are the default among a set of
similar elements?
a) :default
b) :%
c) :disabled
d) none of the mentioned

View Answer
Answer: a
Explanation:
Example: :default {background-color: red;}

 
 
4. Which of the following selector selects an element that has no children?
a) :empty
b) :nochild
c) :inheritance
d) :no-child

View Answer
Answer: a
Explanation: None.
 
 
5. Which of the following selector selects the elements that are currently enabled?
a) :element
b) :empty
c) :enabled
d) none of the mentioned

View Answer
Answer: c
Explanation:
Example: input:enabled {background-color:white;}

 
 
6. Which of the following selector selects the element that is the first child of its parent that
is of its type?
a) :first-of-type
b) :last-child
c) ::first-line
d) ::first-letter

View Answer
Answer: a
Explanation:
Example: strong:first-of-type {font-size:bigger;}

 
 
7. Which of the following selector selects elements that do not match the selector s?
a) :!(s)
b) :nth-child(s)
c) :not(s)
d) none of the mentioned

View Answer
Answer: c
Explanation:
Example: *:not(h1) {color: black;}

 
 
8. Which of the following selector selects an element if it’s the only child of its parent?
a) :root
b) :nth-oftype(n)
c) :only-child
d) none of the mentioned

View Answer
Answer: c
Explanation:
Example: h1:only-child {color: blue;}
 
 
9. Which of the following selector selects the element that is the target of a referring URI?
a) :target
b) :selection
c) ::selection
d) :URI

View Answer
Answer: a
Explanation:
Example: :target{color:red;}

 
 
10. Which of the following selector applies styles to elements that are valid per HTML5
validations set either with the pattern or type
attributes?
a) :valid
b) :required
c) :optional
d) :invalid

View Answer
Answer: a

1. 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
View Answer
Answer: b
Explanation: These selectors are called element selectors and are simply used
as follows:
element-name { /* properties */ }

2. 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
View Answer
Answer: c
Explanation: By applying an id rule, a style can be applied to just a single tag. For example,
if we name a tag with a unique id attribute as follows
advertisement

<tag id="id-value">Affected Text</tag>


3. The _____________ attribute is used to define the name(s) of the class(es) to which a
particular tag belongs.
a) class
b) element
c) id
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.

4. What will be the output of below mentioned code snippet?

p strong {background-color: yellow;}

a) Strong have yellow background


b) Strong element within a p element have a yellow background
c) Both p and strong have yellow background
d) None of the mentioned
View Answer
Answer: b
Explanation: All occurrences of the strong element within a p element have a yellow
background.

5. A similar rule called the ____________ is specified using the plus sign (+) and is used to
select elements that would be siblings of each other.
a) class selectors
b) attribute selectors
c) adjacent-sibling selector
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

6. Which of the following selectors selects any tag with an id attribute set?

a) E#id
b) .class
c) #id
d) *

View Answer
Answer: c
Explanation: Example:#test {color: green;}
/* makes a tag with id=’test’ green */

 
 
7. Which of the following selectors selects direct descendents?

a) E &gt; F
b) E F
c) E + F
d) E ~ F

View Answer
Answer: a
Explanation: Example:
body > p {background-color: yellow;}
/* makes all p tags that have the
body tag as their immediate parent
have the background color yellow */

 
 
8. Which of the following selectors selects siblings?
a) E.class
b) E ~ F
c) *
d) E, F, G

View Answer
Answer: b
Explanation: Example:
p ~ strong {font-style: italic;}
/* sets the font style to italic on
all strong tags that have a p tag
as a preceding sibling */

 
 
9. Which of the following selectors selects the specified elements of type E with a particular
class value?
a) E.class
b) E ~ F
c) *
d) E, F, G

View Answer
Answer: a
Explanation: Example:
h1.note {text-decoration: underline;}
/* underlines all h1 tags with
class='note' */

 
 
10. Which of the following selectors selects adjacent siblings?
a) E &gt; F
b) E F
c) E + F
d) E ~ F

View Answer
Answer: c
1) count 1 if the declaration is from is a ‘style’ attribute rather than a rule with a selector, 0
otherwise (= a) (In HTML, values of an element’s “style” attribute are style sheet rules.
These rules have no selectors, so a=1, b=0, c=0, and d=0.)
2) count the number of ID attributes in the selector (= b)
3) count the number of other attributes and pseudo-classes in the selector (= c)
4) count the number of element names and pseudo-elements in the selector (= d)

1. Find the specificity of this “*”.


a) specificity = 0,0,0,0
b) specificity = 0,0,0,1
c) specificity = 0,0,1,0
d) specificity = 1,0,0,0
View Answer
Answer: a
Explanation: Self-explainatory.

2. Find the specificity of this “li”.


a) specificity = 0,0,0,1
b) specificity = 0,0,1,1
c) specificity = 0,1,1,1
d) specificity = 1,1,1,1
View Answer
Answer: a
Explanation: Self-explainatory.
advertisement

3. Find the specificity of this ” ul li”.


a) specificity = 0,0,0,0
b) specificity = 0,0,1,2
c) specificity = 0,0,0,2
d) specificity = 2,0,0,0
View Answer
Answer: c
Explanation: Self-explainatory.

4. Find the specificity of this “li:first-line”.


a) specificity = 0,0,1,1
b) specificity = 0,0,0,2
c) specificity = 0,1,0,1
d) specificity = 1,0,0,1
View Answer
Answer: b
Explanation: Self-explainatory.

5. Find the specificity of this “ul ol+li”.


a) specificity = 0,0,2,1
b) specificity = 0,2,1,1
c) specificity = 0,1,1,1
d) specificity = 0,0,0,3
View Answer
Answer: d
Explanation: Self-explainatory.

6. Find the specificity of this “ul ol li.red”.


a) specificity = 0,0,3,1
b) specificity = 0,0,1,3
c) specificity = 1,1,1,1
d) specificity = 1,2,2,1
View Answer
Answer: b
Explanation: Self-explainatory.

7. Find the specificity of this “ul ol li.red”.


a) specificity = 0,0,1,3
b) specificity = 0,0,0,4
c) specificity = 0,1,2,1
d) specificity = 1,1,1,1
View Answer
Answer: a
Explanation: Self-explainatory.

8. Find the specificity of this “li.red.leve”.


a) specificity = 2,0,0,1
b) specificity = 0,0,1,1
c) specificity = 0,2,0,1
d) specificity = 0,0,2,1
View Answer
Answer: d
Explanation: Self-explainatory.

9. Find the specificity of this “#x34y”.


a) specificity = 0,0,0,1
b) specificity = 0,0,1,0
c) specificity = 0,1,0,0
d) specificity = 1,0,0,0
View Answer
Answer: c
Explanation: Self-explainatory.

10. Find the specificity of this ” style=”” “.


a) specificity = 0,0,0,1
b) specificity = 0,0,1,0
c) specificity = 0,1,0,0
d) specificity = 1,0,0,0
View Answer
Answer: d
1. Which of the following elements are block and inline elements, respectively, that have no
particular rendering?
a) div
b) span
c) box-model
d) both div and span
View Answer
Answer: d
Explanation: The div element and span element are block and inline elements, respectively,
that have no particular rendering. You might call them generic tags. Because these tags
don’t have any predefined meaning or rendering, they are very useful for arbitrary style
duties.

2. The _____________ property specifies the background color of an element.


a) background-color
b) border
c) color
d) display
View Answer
Answer: a
Explanation: Example:
body {
background-image: url("img_tree.png");
background-repeat: no-repeat;
}

3. The ___________ property specifies if/how an element is displayed.


a) background-color
b) border
c) color
d) display
View Answer
Answer: d
Explanation: Example:
advertisement

h1.hidden {
display: none;
}

4. The _____________ property allows us to include the padding and border in an


element’s total width and height.
a) margin
b) box-sizing
c) padding
d) none of the mentioned
View Answer
Answer: b
Explanation: Example:
.div1 {
box-sizing: border-box;
}

5. ____________ property sets the coordinates of the clipping shape that exposes or hides
the content of absolutely positioned elements
a) clammper
b) clip
c) clear
d) none of the mentioned
View Answer
Answer: b
Explanation:
clip: rect(coordinates) | auto | inherit

6. _____________ property defines the space between cells in a table.


a) border
b) border-spacing
c) border-style
d) none of the mentioned
View Answer
Answer: b
Explanation:
border-spacing: non-negative length(s) | inherit

7. ____________ property defines whether table cell borders are connected or separate.
a) border-color
b) border
c) border-style
d) none of the mentioned
View Answer
Answer: d
Explanation: border-collapse roperty defines whether table cell borders are connected or
separate.

8. ________________ property sets the background image to scroll or not to scroll with its
associated element’s content
a) background
b) background-position
c) background-attachment
d) none of the mentioned
View Answer
Answer: c
Explanation: Example:
background-attachment: scroll | fixed | inherit

9. ____________ property associates a background image with an element.


a) image
b) background-image
c) float
d) none of the mentioned
View Answer
Answer: b
Explanation: Example:
background-image: url(image-file) | none | inherit

10. ______________ property defines whether table cell borders are connected or
separate.
a) pre
b) border-color
c) border-collapse
d) table
View Answer
Answer: c

1. Which of the following CSS property sets the opacity level for an element?
a) opacity
b) transparency
c) transparent
d) all of the mentioned
View Answer
Answer: a
Explanation: The opacity property defines the transparency-level, where 1 is opaque, 0.5 is
translucent, and 0 is completely transparent.

2. Which of the following property specifies the order of a flexible item relative to the rest of
the flexible items inside the same container?
a) sort
b) layout
c) order
d) asort
View Answer
Answer: c
Explanation: The CSS order property specifies the order used to lay out flex items in their
flex container. Elements are laid out in the ascending order of the order value.

3. Which of the following is an appropriate value for overflow element?


a) hidden
b) auto
c) scroll
d) all of the mentioned
View Answer
Answer: d
Explanation: Overflow of a div or a container can have the following values: visible|hidden|
scroll|auto|initial|inherit.
advertisement

4. Identify the CSS property that specifies the length of the space used for the tab
character.
a) size
b) tab-size
c) tab-space
d) all of the mentioned
View Answer
Answer: b
Explanation: The tab-size CSS property is used to customize the width of a tab.

5. Which of the following property specifies the stack order of an element?


a) order
b) z-index
c) p-index
d) auto
View Answer
Answer: b
Explanation: The correct option is z-index. It can only be applied on positioned values.

6. Which of the following property allows long words to be able to be broken and wrap onto
the next line?
a) line-wrap
b) break-word
c) word-wrap
d) word-break
View Answer
Answer: c
Explanation: This property helps you break the words and wrap onto the next line to prevent
overflow of div.

7. Which of the following CSS property can be used to provide the flex-direction and flex-
wrap properties?
a) flex
b) flex-flow
c) flex-wrap
d) all of the mentioned
View Answer
Answer: b
Explanation: It is a shorthand for both flex-direction and flex-wrap.

8. Which of the following specifies how much the item will grow relative to the rest of the
flexible items inside the same container?
a) flex-scale
b) flex-size
c) flex-grow
d) flex-flow
View Answer
Answer: c
Explanation: Self-explainatory.

9. Which of the following property aligns the flexible container’s items when the items do not
use all available space on the main-axis?
a) wrap-content
b) fix-content
c) adjust-content
d) justify-content
View Answer
Answer: d
Explanation: The CSS justify-content property defines how the browser distributes space
between and around flex items along the main-axis of their container.

10. Choose the CSS property which specifies the placement of a table caption.
a) table-caption
b) cell-caption
c) caption-side
d) caption-adjust
View Answer
Answer: c

1. If a particular rule should never be overridden by another rule, the ____________


indication should be used.

a) @important
b) !important!
c) !important
d) important!

View Answer
Answer: c
Explanation: If a particular rule should never be overridden by another rule, the !important
indication should be used. For a rule never to be ignored, insert the indication !important
just before the semicolon of the rule.

 
 
2. Which of the following option a rule consists of?
a) Tag
b) Selector
c) Declaration
d) Both Selector and Declaration
View Answer
Answer: d
Explanation: Self-explainatory.
advertisement

3. Which of the following option a declaration consist of?


a) Tag
b) Property
c) Selector
d) Class
View Answer
Answer: b
Explanation: A declaration has two parts separated by a colon:
Property – that part before the colon
Value – that part after the colon.

4. The ______________ is the link between the HTML document and the style. It specifies
what elements are affected by the declaration.
a) Tag
b) Selector
c) Declaration
d) Class
View Answer
Answer: b
Explanation: The selector is the link between the HTML document and the style. It specifies
what elements are affected by the declaration. The declaration is that part of the rule that
sets forth what the effect will be.

5. How a style sheet can be glued to the HTML document?


a) Import a style sheet using the CSS @import notation.
b) Apply the basic, document-wide style sheet for the document by using the style element
c) Link an external style sheet to the document using the link elemen
d) All of the mentioned
View Answer
Answer: d
Explanation: Self-explainatory.

6. As a general rule, properties in CSS inherit from ___________ elements


a) child to parent
b) parent to child
c) grandparents to parents
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

7. CSS3 ___________ let you display smooth transitions between two or more specified
colors
a) Float
b) Align
c) Gradients
d) Color
View Answer
Answer: b
Explanation: Earlier, you had to use images for these effects. However, by using CSS3
gradients you can reduce download time and bandwidth usage. In addition, elements with
gradients look better when zoomed, because the gradient is generated by the browser.

8. The ___________________ property specifies whether or not an element should be


resizable by the user.
a) Outline Offset
b) Resize
c) Unit
d) None of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

9. The __________ specifies style sheets for a source document according to the
conventions of the document language. For instance, in HTML, style sheets may be
included in the document or linked externally.
a) author
b) user
c) user-agent
d) none of the mentioned
View Answer
Answer: a
Explanation: Author. The author specifies style sheets for a source document according to
the conventions of the document language. For instance, in HTML, style sheets may be
included in the document or linked externally.

10.The __________ may be able to specify style information for a particular document. For
example, the user may specify a file that contains a style sheet or the user agent may
provide an interface that generates a user style sheet.
a) author
b) user
c) user-agent
d) none of the mentioned
View Answer
Answer: b
Explanation: User: The user may be able to specify style information for a particular
document. For example, the user may specify a file that contains a style sheet or the user
agent may provide an interface that generates a user style sheet (or behaves as if it did) .

11. Each property may also have a cascaded value of ___________ which means that, for
a given element, the property takes the same specified value as the property for the
element’s parent.
a) !important
b) delay
c) inherit
d) important
View Answer
Answer: c

1. Which of the following represents a comment?


a) /!– comments –!/
b) /! comments !/
c) /* comments */
d) None of the mentioned
View Answer
Answer: c
Explanation: Comments can be placed within style sheets. Style sheets use the comment
syntax used in C programming

2. A single _____________ rule can be used in an external sheet to define character set
encoding of the style rules and values.
a) @media
b) @charset
c) @font-face
d) None of the mentioned
View Answer
Answer: b
Explanation: None.

3. An ___________ rule can be used to define style rules for multiple media types in a
single embedded style sheet
a) @media
b) @charset
c) @font-face
d) None of the mentioned
View Answer
Answer: a
Explanation: None.
advertisement

4. An ___________ rule is used to define a page block for printed styles.


a) @important
b) @page
c) @css
d) @html
View Answer
Answer: b
Explanation: An @page rule is used to define a page block for printed styles. Generally,
within this construct we see various CSS properties like size, page, and margin to control
the dimensions of the page.

5. Which of the following construct specifies that a style takes precedence over any
different, conflicting styles?

a) !important
b) <style>
c) #id
d) @media

View Answer
Answer: a
Explanation: None.

 
 
6. Which of the following property specifies the size of the mask?
a) box-sizing
b) box-shadow
c) box-reflect
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: -webkit-box-reflect: direction offset mask-box-image

7. Which of the following property is used to control column element breaks after an
associated element when flowing multicolumn text?
a) column-break
b) column-break-after
c) column-count
d) column-break-before
View Answer
Answer: b
Explanation:
Syntax: column-break-after: always | auto | avoid

8. Which of the following property defines the gap between columns in a multicolumn text
flow?
a) column-float
b) column-flow
c) column-gap
d) column-width
View Answer
Answer: c
Explanation:
Syntax: column-gap: length | normal

9. Which of the following property defines the style, width, and color of the rule divider
between
columns in a multicolumn text flow?
a) column
b) column-rule
c) column-change
d) column-check
View Answer
Answer: b
Explanation:
Syntax: column-rule: rule-width rule-style color

10. Which of the following property defines the width of a rule between columns in a
multicolumn text flow?
a) column-width
b) column-rule
c) column-float
d) column-rule-width
View Answer
Answer: d

1. Which of the following property sets in a shorthand form any or all background
properties?
a) font
b) background
c) background-color
d) background-position
View Answer
Answer: b
Explanation: Syntax:
background: background-color background-image background-repeat background-
attachment background- position;

2. Which of the following property defines whether table cell borders are connected or
separate?
a) border-style
b) border-collapse
c) border-color
d) border-bottom-width
View Answer
Answer: b
Explanation:
Syntax: border-collapse: collapse | separate | inherit

3. Which of the following property defines the style for the right border of an element?
a) border-left
b) border-right
c) border-right-style
d) border-style
View Answer
Answer: c
Explanation:
advertisement

Syntax:border-right-style: dashed | dotted | double | groove | hidden | inset


| inherit | none | outset | ridge | solid

4. Which of the following property defines the visual style of up to four different sides of a
border?
a) border-width
b) border-top
c) border
d) border-style
View Answer
Answer: d
Explanation:
Syntax: border-style: style [ style style style ]
5. Which of the following property sets the coordinates of the clipping shape that exposes or
hides the content of absolutely positioned elements?
a) clip
b) clamp
c) clip-wekit
d) clamp-webkit
View Answer
Answer: b
Explanation:
Syntax: clip: rect(coordinates) | auto | inherit

6. Which of the following property generates content in a document and is used with the
:before and :after pseudo-elements?
a) text
b) content
c) contents
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: content: normal | none | string

7. Which of the following property controls CSS counter values?


a) counter
b) counter-increment
c) counter-decrement
d) none of the mentioned
View Answer
Answer: b
Explanation:
Syntax: counter-increment: counter-name1 [integer] ... counter-nameN [integer]
| none | inherit

8. Which of the following property determines how the cursor displays when passed over
the affected element?
a) mouse
b) cursor
c) click
d) focus
View Answer
Answer: d
Explanation:
Syntax: cursor: url(address of cursor file)

9. Which of the following property is used to control the text direction, much like the dir
attribute for (X)HTML tags?
a) left
b) right
c) direction
d) direct
View Answer
Answer: c
Explanation:
Syntax: direction: ltr | rtl | inherit

10. Which of the following property specifies an element’s display type and can override an
element’s defined presentation?
a) content
b) display
c) visibility
d) none of the mentioned
View Answer
Answer: d

1. Which of the following property specifies whether an element is an accelerator indicator


or not.
a) move
b) @keyframes
c) accelerator
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: accelerator: true | false

2. Which of the following property is used to define the animations that should be run?
a) animation-delay
b) animation-iteration-count
c) animation-duration
d) animation-name
View Answer
Answer: d
Explanation: None.
advertisement

3. Which of the following property is used to define the number of times an animation should
play?
a) animation-direction
b) animation-iteration-count
c) animation
d) animation-timing-function
View Answer
Answer: b
Explanation: None

4. Which of the following property is used to indicate whether the backside of an element is
visible if the element is rotated to display the back?
a) background-clip
b) backface-visibility
c) behavior
d) background-origin
View Answer
Answer: b
Explanation:
Syntax: backface-visibility: hidden | visible

5. Which of the following property defines a relationship between bound elements(s) and
some code or content?
a) behavior
b) anim
c) binding
d) none of the mentioned
View Answer
Answer: c
Explanation: None.

6. Which of the following property defines the width of each column in a multicolumn text
flow?
a) width
b) columns
c) filter
d) column-width
View Answer
Answer: d
Explanation: Implemented CSS3 and Browser-Specific Syntax: column-width: length | auto

7. Which of the following property is used to apply visual effects to associated elements?
a) filter
b) effect
c) adjust
d) none of the mentioned
View Answer
Answer: a
Explanation:
Syntax: filter: filtername(filtervalues) ... filtername(filtervalues)

8. Which of the following property defines the resampling method to use when stretching
images?
a) layout
b) ime-mode
c) image-rendering
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: image-rendering: auto | inherit | optimizeSpeed
9. Which of the following property specifies the direction in which a marquee should move?
a) marquee
b) marquee-play
c) marquee-direction
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: marquee-direction: forward | reverse

10. Which of the following property defines a mask to be used as a box’s overlay in order to
clip the box to a complex shape?
a) shadder
b) mask
c) mask-attachment
d) mask-image
View Answer
Answer: b

1. Which of the following element is used within the table element to define a caption?

a) <tablecaption>
b) <caption>
c) <table-cap>
d) <table-caption>

View Answer
Answer: b
Explanation: None.

 
 
2. Which of the following property is used to specify table borders in CSS?
a) table
b) border
c) table:border
d) none of the mentioned
View Answer
Answer: b
Explanation:
advertisement

Example: table{border: 7px solid black;}

3. Which of the following property sets whether the table borders are collapsed into a single
border or separated:?
a) border
b) border-collapse
c) collapse
d) table-border
View Answer
Answer: b
Explanation:
Example: table{ border-collapse: collapse;}

4. Which of the following property is used to change the width of table?


a) width
b) table
c) table-width
d) resize
View Answer
Answer: a
Explanation:
Example: table{width: 23px;}

5. Which of the following property sets the vertical alignment?


a) align
b) vertical
c) vertical-align
d) vertical-alignment
View Answer
Answer: b
Explanation:
Example: table{vertical-align: top;}

6. Which of the following property is used to control the space between the border and
content in a table?
a) border
b) margin
c) padding
d) resize
View Answer
Answer: c
Explanation:
Example: table{border: 4px solid black;}

7. Which of the following property is used to change the background in a table?


a) table-background
b) background
c) color
d) none of the mentioned
View Answer
Answer: b
Explanation: None.

8. Which of the following property is used to change the height of a table?


a) height
b) table-height
c) resize
d) position-y
View Answer
Answer: a
Explanation:
Example: table{height: 45%;}

9. Which of the following property is used to align the text in a table?


a) align
b) text
c) text-align
d) none of the mentioned
View Answer
Answer: c
Explanation:
Example: table{text-align: left;}

10. Which of the following property is used to set order in a table?


a) border
b) padding
c) dotted
d) text
View Answer
Answer: a

1. Which of the following selector same as :after; changed under CSS3 to make pseudo-
elements obvious?

a) ::after
b) :after
c) #after
d) none of the mentioned

View Answer
Answer: a
Explanation:
Example: div::after {content: url(sectionend.gif);}

 
 
advertisement

2. Which of the following property controls CSS counter values?


a) counter-increment
b) counter-decrement
c) counter
d) none of the mentioned
View Answer
Answer: a
Explanation:
Syntax: counter-increment: counter-name1 [integer] ... counter-nameN [integer]
| none | inherit
3. Which of the following property contains a list of one or more counter names to be
cleared or set to a particular value?
a) counter
b) counter-origin
c) counter-reset
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: counter-reset: counter-name1 [integer] ... counter-nameN [integer] |
none |inherit

4. Which of the following property is used in conjunction with the :before or :after pseudo-
elements?
a) text
b) generated-content
c) content
d) none of the mentioned
View Answer
Answer: c
Explanation:
Syntax: content: { { string | uri | counter}}

5. Which of the following property defines the text selection policy for various portions of a
document?
a) user-origin
b) user-select
c) user
d) all of the mentioned
View Answer
Answer: b
Explanation:
Syntax: user-select: all | none | text

where the default value all allows for selection.

6. Which of the following CSS3 property can be used to allow line breaks within words?
a) word-wrap
b) word-break
c) line-wrap
d) line-break
View Answer
Answer: b
Explanation:
Syntax: word-break: break-all | keep-all | normal

7. Which of the following property can be used to set text flow appropriate for European
alphabets or East Asian alphabets?
a) writing-mode
b) language-mode
c) text-mode
d) reading-mode
View Answer
Answer: a
Explanation:
Syntax: writing-mode: bt-lr | bt-rl

8. Which of the following property is used to zoom in or out on an element?


a) zoom
b) zoom-set
c) zoom-in
d) zoom-out
View Answer
Answer: a
Explanation:
Syntax: zoom: float | percentage | normal

9. Which of the following property is used to describe all transition-related properties at


once?
a) transition-set
b) transition-wrap
c) transition
d) animation
View Answer
Answer: c
Explanation:
Syntax: transition: transition-property transition-duration transition-timing-
function transition-delay

where the individual transition properties are defined in their own entries. Multiple
transitions can be listed separated by commas.

10. Which of the following property is used to define which properties a transition will be
applied to?
a) transition
b) transition-property
c) transition-wrap
d) transition-style
View Answer
Answer: b

1. Which of the following values are zccepted by the float Property?


a) left
b) right
c) none
d) all of the mentioned
View Answer
Answer: d
Explanation: Self-explainatory.

2. Which of the following property is used to control the behavior of floating elements?
a) format
b) clean
c) clear
d) remove
View Answer
Answer: c
Explanation: Self-explainatory.

3. The default value for the float property is right.State true or false.
a) True
b) False
View Answer
Answer: b
Explanation: The default value for this property is none.
advertisement

4. In what direction does float will work?

img {
float: right;
}

a) left
b) top
c) bottom
d) right
View Answer
Answer: d
Explanation: Self-explainatory.

5. Which of the following property allows elements to be offset, rotated, scaled, and skewed
in a variety of different ways?
a) transform-style
b) transform
c) transition
d) transform-origin
View Answer
Answer: b
Explanation: None.

6. Which of the following property is used to define how nested items are rendered in a 3-D
space, the choice being either flattened or with their dimensions preserved?
a) transition-duration
b) transition-delay
c) transition
d) transform-style
View Answer
Answer: d
Explanation:
Syntax: transform-style: flat
7. Which of the following property is used to define the time it takes one iteration of an
animation to play?
a) transition-property
b) transition-timing
c) transition-duration
d) user-select
View Answer
Answer: c
Explanation:
Syntax transition-duration: time [,time]*

where time is a valid time value like 5s or 3500ms. The default value of time is 0, meaning
no animation plays.

8. Which of the following property sets the distance between an element’s right border and
the rightmost edge of its content?
a) auto
b) padding-left
c) padding-right
d) padding-top
View Answer
Answer: c
Explanation:
Syntax: padding-right: length | percentage | auto

9. Which of the following property is used to control page breaks when printing a document
after the bound element box ends?
a) page-inside
b) page-break-after
c) page-break-inside
d) page-break-before
View Answer
Answer: b
Explanation:
Syntax: page-break-after: always | auto

10.Which of the following property defines the style of quotation marks to be used with
embedded quotations?
a) article
b) para
c) quote
d) quotes
View Answer
Answer: d

1. Which of the following property defines the length of time that a transition takes?

a) transition
b) transition-duration
c) transform-duration
d) transition-property

View Answer
Answer: b
Explanation: None.

 
 
2. Which of the following property defines when the transition will start and it allows a
transition to begin execution some some period of time from when it is applied?
a) transform-delay
b) transition-delay
c) transform-duration
d) none of the mentioned

View Answer
Answer: b
Explanation: None.

 
 
3. Which of the following transform property value defines a 2D translation?
advertisement

a) translate(x,y)
b) translate2d(x,y)
c) translate3d(x,y)
d) all of the mentioned

View Answer
Answer: a
Explanation: None.

 
 
4. Which of the following transform property value defines a translation, using only the value
for the X-axis?
a) translate(x)
b) translateZ(x)
c) translateY(x)
d) translateX(x)

View Answer
Answer: d
Explanation: None.

 
 
5. Which of the following transform property value defines a 3D scale transformation?
a) circle(x,y,z)
b) scale3d(x,y,z)
c) rotate3d(x,y,z,angle)
d) rotate(angle)
View Answer
Answer: b
Explanation: None.

 
 
6. Which of the following transform property value defines a perspective view for a 3D
transformed element?
a) perspective3d(n)
b) perspective(n,n,n)
c) perspective(n)
d) none of the mentioned

View Answer
Answer: b
Explanation: None.

 
 
7. Which of the following transform property value defines a 2D skew transformation along
the X- and the Y-axis?
a) skewX(angle)
b) skewY(angle)
c) skew(x-angle,y-angle)
d) none of the mentioned
View Answer
Answer: c
Explanation: None.

 
 
8. Which of the following transform property value defines a 3D transformation, using a 4×4
matrix of 16 values?
a) matrix3d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n)
b) matrix(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n)
c) matrix2d(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n)
d) all of the mentioned

View Answer
Answer: a
Explanation: None.

 
 
9. Which of the following transform property value defines a 3D rotation along the Z-axis?
a) rotate-Z(angle)
b) rotate-Z-axis(angle)
c) rotateZ(angle)
d) all of the mentioned

View Answer
Answer: c
Explanation: None.

 
 
10. Which of the following transform property value defines a 3D rotation?
a) rotate3d(x,y,z,angle)
b) rotated(x,y,z,angle)
c) rotate-all(x,y,z,angle)
d) rotate(x,y,z,angle)

View Answer
Answer: a

1. Which of the following CSS Property selects an animation defined in an @keyframes rule
and applies it to the element?
a) animation
b) animation-name
c) animation-element
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

2. Which of the following CSS Property determines whether an animation should run in
reverse on some cycles?
a) animation
b) animation-run
c) animation-repeat
d) none of the mentioned
View Answer
Answer: d
Explanation: animation-direction : Determines whether an animation should run in reverse
on some cycles.

3. Which of the following CSS Property defines which property values to apply to the
element before the animation begins (if delayed) and after it ends?
a) animation-play
b) animation-delay
c) animation-fill-mode
d) animation-play-state
View Answer
Answer: c
Explanation: Self-explainatory.
advertisement

4. Which of the following CSS Property sets the pace of the transition to the next keyframe,
as described in the previous section?
a) animation-timing-function
b) animation-pace-function
c) animation-transition-function
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.

5. Which of the following CSS property defines whether the animation is running or paused?
a) animation-pause-state
b) animation-state
c) animation-play-state
d) all of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

6. Which of the following property defines when the animation will start. It allows an
animation to begin execution some time after it is applied?
a) animation-stop
b) animation-delay
c) animation-start
d) animation-control
View Answer
Answer: b
Explanation: Self-explainatory.

7. Which of the following property specifies the number of times an animation should run?
a) animation-repeat
b) animation-count
c) animation-iteration-count
d) all of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

8. Which of the following property specifies whether an element is an accelerator indicator


or not?
a) animation
b) accelerator
c) scan
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

9. Which of the following property specifies the direction in which a marquee should move?
a) marquee
b) marquee-direction
c) marquee-time
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

10. @keyframes rule is used to define the properties that will control the audio/video
formats. State true or false.
a) True
b) False
View Answer
Answer: b

1. Which of the following CSS Property controls how an element is positioned?


a) position
b) set
c) static
d) fix
View Answer
Answer: a
Explanation: Controls how an element is positioned. When set to absolute or fixed, the
element is removed completely from the normal flow of the document. When set to relative,
the element is moved relative to its position in the normal flow, but a space is left where it
would normally have been. The default value, static, means the element remains in the
normal flow and is not positioned.

2. Which of the following CSS Property specifies the top offset of a positioned element?
a) top
b) up
c) reverse
d) fix
View Answer
Answer: a
Explanation: Self-explainatory.

3. Which of the following CSS Property Specifies the left offset of a positioned element?
a) right
b) left
c) bottom
d) up
View Answer
Answer: b
Explanation: Self-explainatory.
advertisement

4. Which of the following CSS Property sets the stacking order of positioned elements?
a) x-index
b) y-index
c) z-index
d) all of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

5. Which of the following CSS Property Defines the area of an absolutely positioned
element that remains visible?
a) clamp
b) clip
c) visibility
d) static
View Answer
Answer: b
Explanation: Self-explainatory.

6. Which of the following CSS Property specifies whether the labels for an element’s list
items are positioned inside or outside the “box” defined by the listed item?
a) list-style
b) list-position
c) list-style-position
d) all of the mentioned
View Answer
Answer: c
Explanation:
Syntax: list-style-position: inside | outside

7. Which of the following CSS Property defines the x-coordinate of the background-position
property?
a) background-position-x
b) background-position-y
c) background-x-axis
d) background-y-axis
View Answer
Answer: a
Explanation:
Syntax: background-position-x: length | percentage | left | center | right

8. Which of the following CSS Property specifies the position of the mask?
a) mask
b) mask-position
c) mask-origin
d) none of the mentioned
View Answer
Answer: b
Explanation: Syntax:
mask-position: xpos ypos.

9. Which of the following CSS Property specifies the x-coordinate in the position of the
mask?
a) mask-x
b) mask-x-origin
c) mask-position-x
d) mask-origin-x
View Answer
Answer: c
Explanation:
Syntax:

mask-position-x: length | percentage | left | center | right

10. Which of the following Microsoft-introduced property defines the position of underlining
set by the text-decoration property?
a) text-underline
b) text-underline-origin
c) text-underline-position
d) none of the mentioned
View Answer
Answer: d

1. Which of the following are different origins of style sheets?


a) author
b) user
c) user agent
d) all of the mentioned
View Answer
Answer: d
Explanation: Author: The author specifies style sheets for a source document according to
the conventions of the document language. For instance, in HTML, style sheets may be
included in the document or linked externally.
User: The user may be able to specify style information for a particular document. For
example, the user may specify a file that contains a style sheet or the user agent may
provide an interface that generates a user style sheet (or behaves as if it did).
User agent: Conforming user agents must apply a default style sheet. A user agent’s default
style sheet should present the elements of the document language in ways that satisfy
general presentation expectations for the document language

2. Which of the following Cascading order has the highest precedence?


a) user agent declarations
b) user normal declarations
c) author normal declarations
d) author important declarations
View Answer
Answer: a
Explanation: Self-explainatory.

3. Which of the following property is used to define how nested items are rendered in a 3-D
space?
a) transform-style
b) transform
c) transform-origin
d) transform-3D
View Answer
Answer: a
Explanation: transform-style is used to define how nested items are rendered in a 3-D
space, the choice being either flattened or with their dimensions preserved. This property
affects the children of the element and not the element itself. Also, the property does not
cascade, so it is necessary to apply it at all levels.
advertisement

4. Which of the following rule allows users to import style rules from other style sheets?
a) @media
b) @important
c) @import
d) @style
View Answer
Answer: c
Explanation: The @import rule allows users to import style rules from other style sheets. If
an @import rule refers to a valid stylesheet, user agents must treat the contents of the
stylesheet as if they were written in place of the @import rule.

5. Which of the following property is a shorthand that resets all CSS properties?
a) reset
b) inital
c) all
d) delete
View Answer
Answer: c
Explanation: Self-explainatory.

6. Which of the following generate “virtual” rules representing their effects when running?
a) DOM’s
b) !important
c) CSS Animations
d) Inheritance
View Answer
Answer: c
Explanation: Self-explainatory.

7. The _______________ is the result of taking the computed value and completing any
remaining calculations to make it the absolute theoretical value used in the layout of the
document.
a) cascaded value
b) declared value
c) used value
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.
8. The _________________ is the result of resolving the specified value.
a) cascaded value
b) computed value
c) specified value
d) declared value
View Answer
Answer: b
Explanation: Self-explainatory.

9. The ____________ represents the result of the cascade: it is the declared value that wins
the cascade.
a) specified Value
b) actual value
c) computed value
d) cascaded value
View Answer
Answer: d
Explanation: Self-explainatory.

10. The CSS cascade assigns a weight to each style rule. State true or false.
a) True
b) False
View Answer
Answer: a

1. Which of the following css property specifies an image to use as the background of an
element?
a) background
b) background-img
c) background-image
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

2. Which of the following css property specifies a delay for the transition effect?
a) transition-delay
b) transition-effect
c) transition
d) transition-duration
View Answer
Answer: a
Explanation: Self-explainatory.

3. Which of the following method rotates an element around its Y-axis at a given degree
using tranform 3D?
a) rotateY()
b) rotate-Y()
c) rotate-Yaxis()
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.
advertisement

4. Which of the following property defines where a 3D element is based in the x- and the y-
axis?
a) transform-style
b) perspective(n)
c) perspective-origin
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

5. Which of the following css property repeats an image both horizontally and vertically?
a) background
b) background-image
c) background-repeat
d) background-position
View Answer
Answer: c
Explanation: Self-explainatory.

6. Which of the following CSS3 property specifies how nested elements are rendered in 3D
space?
a) transform
b) transform-style
c) transform-render
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

7. Which of the following CSS3 property specifies the intrinsic resolution of all raster images
used in/on the element?
a) image-orientation
b) image-rendering
c) image-resolution
d) all of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

8. Which of the following CSS3 property specifies how the contents of a replaced element
should be fitted to the box established by its used height and width?
a) object-fit
b) object-position
c) image-orientation
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.

9. Which of the following CSS3 property specifies the alignment of the replaced element
inside its box?
a) object
b) object-allign
c) object-position
d) object-render
View Answer
Answer: c
Explanation: Self-explainatory.

10. Which of the following css property defines whether or not an element should be visible
when not facing the screen?
a) visibility
b) backface-control
c) backface-visibility
d) none of the mentioned
View Answer
Answer: c

1. Which of the following selector is used to select and style when you place mouse over it?
a) focus
b) hover
c) mouse
d) all of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

2. Which of the following method increases or decreases the size of an element using
tranform?
a) rotate()
b) scale()
c) translate()
d) matrix()
View Answer
Answer: b
Explanation: Self-explainatory.

3. Which of the following method moves an element from its current position using
tranform?
a) rotate()
b) scale()
c) translate()
d) matrix()
View Answer
Answer: c
Explanation: Self-explainatory.
advertisement

4. Which of the following property specifies the speed curve of the transition effect?
a) transition-delay
b) transition-duration
c) transition-timing-function
d) transition
View Answer
Answer: c
Explanation: Self-explainatory.

5. Which of the following method skews an element along the X-axis by the given angle
using tranform?
a) skewX()
b) skewy()
c) x-axis()
d) skew()
View Answer
Answer: a
Explanation: Self-explainatory.

6. Which of the following method skews an element along the X and Y-axis by the given
angles using tranform?
a) skewX()
b) skewy()
c) skew-X-Y()
d) skew()
View Answer
Answer: d
Explanation: Self-explainatory.

7. Which of the following transition-timing-function property specifies a transition effect with


a slow start?
a) ease
b) ease-in
c) ease-in-out
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

8. Which of the following transition-timing-function property specifies a transition effect with


a slow start, then fast, then end slowly
a) ease
b) ease-in
c) ease-in-out
d) none of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.

9. Which of the following transition-timing-function property lets you define your own values
in a cubic-bezier function
a) cubic(n,n,n,n)
b) matrix(n,n,n,n)
c) cubic-bezier(n,n,n,n)
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

10. Which of the following method combines all the 2D transform methods into one using
transform?
a) combine()
b) 2D-tranform()
c) matrix()
d) matrix-2D()
View Answer
Answer: c

1. What does SVG stands for?


a) Scaled Vector Graph
b) Scalable Vector Graphics
c) Scaled Vector Graphics
d) None of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

2. Which of the following element is used to begin an SVG image?

a) <image>
b) <svg>
c) <img>
d) <graph>

View Answer
Answer: b
Explanation: Self-explainatory.

 
 
3. Which of the following element is used to create a SVG rectangle?
a) <rectangle>
b) <polygon>
c) <rect>
d) <square>

View Answer
Answer: c
Explanation: Self-explainatory.

 
 
4. Which of the following element is used to create a circle?
advertisement

a) <cir>
b) <round>
c) <circle>
d) <ellipse>

View Answer
Answer: c
Explanation: Self-explainatory.

 
 
5. Which of the following element is used to create an SVG ellipse?
a) <circle>
b) <ellipse>
c) <curve>
d) none of the mentioned

View Answer
Answer: b
Explanation: Self-explainatory.

 
 
6. Which of the following is not an attribute used with SVG ellipse?
a) cx
b) cy
c) rr
d) ry
View Answer
Answer: c
Explanation: Self-explainatory.

7. Which of the following element is used to create a SVG line?

a) <line>
b) <dot>
c) <ray>
d) <stick>

View Answer
Answer: a
Explanation: Self-explainatory.
 
 
8. Which of the following is attribute of SVG line?
a) x
b) y
c) x1
d) all of the mentioned
View Answer
Answer: d
Explanation: Self-explainatory.

9. Which of the following element is used to create any shape that consists of only straight
lines?

a) <polyogn>
b) <polyline>
c) <lines>
d) <multiline>

View Answer
Answer: b
Explanation: Self-explainatory.

 
 
10. Which of the following defines the color of a line, text or outline of an element?
a) text
b) stroke
c) line
d) all of the mentioned
View Answer
Answer: d

1. Which of the following css property should be used to make a responsive image?
a) float
b) max-width
c) margin-right
d) all of the mentioned
View Answer
Answer: d
Explanation: Self-explainatory.

2. What should be written in the blank of the code for resizing elements in Responsive Web
Design with Transitions

Code:
body { background-image: url(fog.jpg); background-size: cover;
background-repeat: no-repeat; color: #fff; font-family: Avenir, Arial, sans-
serif;
}
h1 { font-family: 'Calluna Sans', Arial, sans-serif; text-align: center;
font-size: 10rem; margin: 8rem auto;
}
h1 { font-family: 'Calluna Sans', Arial, sans-serif;
text-align: center; font-size: 10rem; margin: 8rem auto; transition: 1s font-
size linear;
}
______________ and (max-width: 1100px) {
h1 { font-size: 8rem; }

a) @media
b) @media screen
c) div
d) transform
View Answer
Answer: b
Explanation: None.

 
 
3. What should be written in the blank of the code for JQuery Code Used to Apply CSS3
Animations?
advertisement

Code:
_________ leftmove {
100% { transform: translateX(-70px); opacity: 1; }
}
_________ rightmove {
100% { transform: translateX(70px); opacity: 1; }
}
<script>
$(function() {
var footerBottom = $("#articlefooter").offset().top + $
("#articlefooter").height();
$(window).scroll(function() {
if ($(this).scrollTop() > (footerBottom - $(window).height())) {
131
$("#prevpage").css('animation', 'leftmove 1s 2s forwards');
$("#nextpage").css('animation', 'rightmove 1s 1s forwards');
});
});
</script>

a) @media
b) @keyframes
c) animation-name
d) !important
View Answer
Answer: b
Explanation: None.

4. Which of the following CSS framework is used to create a responsive design?


a) larawell
b) bootstrap
c) rails
d) django
View Answer
Answer: b
Explanation: Bootstrap is a free and open-source collection of tools for creating websites
and web applications. It contains HTML- and CSS-based design templates for typography,
forms, buttons, navigation and other interface components, as well as optional JavaScript
extensions. It aims to ease the development of dynamic websites and web applications.

5. Which of the following code set the webpage correctly displayed on a device?

a) <meta name="viewport" content="width=device-width, initial-scale=1.0">


b) <meta name="viewport" content="width=device-width, initial-scale=2.0">
c) <meta name="viewport" content="width=device-width, initial-scale='parent-
size'">
d) <meta name="viewports" content="width=device-width, initial-scale=1.0">

View Answer
Answer: a
Explanation: Self-explainatory.

 
 
6. What does this code do?

Code:
@media only screen and (max-width: 500px) {
body {
background-color: lightblue;
}
}

a) If the browser window is smaller than 500px, the background color will change to
lightblue:
b) If the browser window is larger than 500px, the background color will change to lightblue:
c) The background color will change to lightblue
d) Nothing happens
View Answer
Answer: a
Explanation: Self-explainatory.

7. What does this code do?

Code:
@media only screen and (orientation: landscape) {
body {
background-color: lightblue;
}
}

a) web page will have a lighblue background if the orientation is in landscape mode
b) web page will have a lighblue background if the orientation is not in landscape mode
c) web page will have a red background if the orientation is in landscape mode
d) None of the mentioned
View Answer
Answer: a
Explanation: Self-explainatory.

8. Which of the following css propery defines a relationship between bound elements(s) and
some code or content?
a) @import
b) @media
c) url-bind
d) binding
View Answer
Answer: d
Explanation:
Syntax: binding: none | url(bindingfile)

9. What does this code do?

Code:
@media only screen and (max-width: 768px) {
class*="col-"] {
width: 100%;
}
}

a) When the screen gets larger than 768px, each column should have a width of 100%.
b) When the screen gets smaller than 768px, each column should have a width of 100%.
c) Error occured
d) None of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

10. Which of the following css propery define the properties that will be animated in an
animation rule?
a) @keyframes
b) animation-origin
c) transform
d) animation
View Answer
Answer: d

1. Which of the following css property allows elements to be offset, rotated, scaled, and
skewed in a variety of different ways?
a) transform-3D
b) transform-origin
c) transform
d) transition
View Answer
Answer: c
Explanation:
Syntax: transform: list of transform-functions | none

2. Which of the following css property is used to define a delay before an animation starts?
a) delay
b) transition-delay
c) transform-delay
d) none of the mentioned
View Answer
Answer: b
Explanation:
advertisement

Syntax: transition-delay: time1

3. Which of the following css property is used to define the time it takes one iteration of an
animation to play?
a) control
b) animation-duration
c) transition-duration
d) all of the mentioned
View Answer
Answer: c
Explanation:

4. Which of the following css property is used to define which properties a transition will be
applied to?
a) animation-property
b) transition-property
c) css3-property
d) none of the mentioned
View Answer
Answer: b
Explanation:
Syntax: transition-property: all | none | property-name-1

5. Which of the following css property is used to describe how the animation will play?
a) animation-timing-function
b) css3-timing-function
c) transform-timing-function
d) transition-timing-function
View Answer
Answer: d
Explanation:
Syntax:transition-timing-function transition-timing-function:
timingfunction,timingfunction2,...timingfunctionN]

6. Which of the following css property is used to define a delay before an animation starts?
a) transform-delay
b) delay-function
c) delay-animation
d) animation-delay
View Answer
Answer: d
Explanation: None.
Syntax: animation-delay: time1 [,..timeN]

7. Which of the following css property is used to indicate if an animation plays in reverse or
repeats itself every other iteration?
a) animation-iteration
b) animation-check
c) animation-direction
d) animation-state
View Answer
Answer: c
Explanation:
Syntax: animation-direction: normal | alternate [,normal | alternate

8. Which of the following css property is used to define the time it takes one iteration of an
animation to play?
a) animation-duration
b) animation-time
c) animation-value
d) none of the mentioned
View Answer
Answer: a
Explanation:
Syntax: animation-duration: time

9. Which of the following css property is used to define the number of times an animation
should play?
a) scale-iteration-count
b) transtion-iteration-count
c) animation-iteration-count
d) all of the mentioned
View Answer
Answer: c
Explanation:
Syntax: animation-iteration-count: number | infinite

10. Which of the following css property is used to define the animations that should be run?
a) animation-run
b) animation-name
c) transtion-name
d) none of the mentioned
View Answer
Answer: d

1. Which of the following CSS3 property is used to tell the browser what the sizing
properties should be include?
a) box-sizing
b) box-model
c) box-design
d) box-redesign
View Answer
Answer: a
Explanation: Self-explainatory.

2. Which of the following CSS3 property specifies where to navigate when using the arrow-
down navigation key?
a) down
b) nav-down
c) arrow-down
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

3. Which of the following CSS3 property specifies the sequential navigation order for an
element?
a) nav
b) class
c) nav-index
d) class-index
View Answer
Answer: c
Explanation: Self-explainatory.
advertisement

4. Which of the following nav-left value sets it’s value to default value?
a) target-name
b) id
c) inital
d) inherit
View Answer
Answer: c
Explanation: Self-explainatory.

5. Which of the following CSS3 property adds space between an outline and the edge or
border of an element?
a) offset
b) outline
c) outline-offset
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.
6. Which of the following outline-offset value sets the distance the outline is outset from the
border edge?
a) distance
b) length
c) initial
d) all
View Answer
Answer: b
Explanation: Self-explainatory.

7. Which of the following CSS3 property specifies whether or not an element is resizable by
the user?
a) resize
b) length
c) inherit
d) none of the mentioned
View Answer
Answer: b
Explanation: Self-explainatory.

8. Which of the following CSS3 property specifies where to navigate when using the arrow-
up navigation key?
a) nav-upper
b) nav-top
c) nav-up
d) all of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

9. Which of the following CSS3 property specifies where to navigate when using the arrow-
right navigation key?
a) right
b) nav-right
c) nav-side
d) none of the mentioned
View Answer
Answer: c
Explanation: Self-explainatory.

10. Which of the following nav-right value is used to the inherits this property from its parent
element?
a) auto
b) id
c) target-name
d) inherit
View Answer
Answer: d
1. Which of the following Module is not available in CSS3.
a) DOMs
b) Fonts
c) Backgrounds and Borders
d) Color
View Answer
Answer: a
Explanation: The Document Object Model (DOM) is a programming API for HTML and XML
documents. It defines the logical structure of documents and the way a document is
accessed and manipulated.

2. What module introduces the ability to modify CSS property values over time, such as
position or color, to create animated layouts?
a) 3D Transforms
b) Animations
c) 2D Transforms
d) Box Model
View Answer
Answer: b
Explanation: Visit www.w3.org/TR/css3-animations to know more about it.

3. What module defines the management of generated content for print output, including
crop mark indication, header/footer handling, and much more?
a) Behavioral Extensions
b) Generated and Replaced Content
c) Generated Content for Paged Media
d) Grid Positioning
View Answer
Answer: c
Explanation: Visit www.w3.org/TR/css3-gcpm to know more about it.
advertisement

4. What module defines the handling of lists, including marker styles and some aspects of
counters?
a) Line Layout
b) Lists
c) Media Queries
d) Namespaces
View Answer
Answer: b
Explanation: Visit www.w3.org/TR/css3-lists to know more about it.

5. What module expands the absolute and relative units of measure, including significant
changes to support animation and aural changes with time (s and ms) and angle (deg and
rad) values?
a) Transitions
b) Template Layout
c) Web Fonts
d) Values and Units
View Answer
Answer: d
Explanation: Visit www.w3.org/TR/css3-values to know more about it.

6. Which of the following selector is used to selects siblings?


a) ::after
b) E ~ F
c) :checked
d) E[attr^=value].
View Answer
Answer: b
Explanation:
p ~ strong {font-style: italic;}

/* sets the font style to italic on all strong tags that have a p tag as a preceding sibling */

7. Which of the following selector is used to selects the elements that are the default among
a set of similar elements?
a) ::after
b) :disabled
c) :default
d) :checked
View Answer
Answer: c
Explanation:
:default {background-color: red;}

/* sets the background color of a default button like a submit to red */

8. Which of the following selector is used to selects the element that is the first child of its
parent that is of its type?

a) :nth-child(n)
b) ::first-line
c) :last-of-type
d) :first-of-type

View Answer
Answer: d
Explanation:
strong:first-of-type {font-size: bigger;}

/* sets the font size bigger on the first strong tag of its parent */

 
 
9. Which of the following selector is used to selects the element that is the nth child of its
parent?
a) :nth-child(n)
b) ::first-line
c) :last-of-type
d) :first-of-type

View Answer
Answer: a
Explanation:
div:nth-child(2) {background-color: red;}

/* sets the background color to red if the div is its parent’s second child */

 
 
10. Which of the following selector is used to selects the element that is the root of the
document?
a) :only-of-type
b) :target
c) :root
d) ::selection

View Answer
Answer: d
Explanation:
:root {background-color: blue;}

/* sets the background color to blue for the root element */

 
 
11. Which of the following selector is used to select elements that are read-only. When
applied to form elements, this would select fields with the readonly attribute set?
a) :valid
b) :target
c) :read-only
d) :required

View Answer
Answer: c
Explanation: input:read-only {color: gray;}
/* put all read only fields in gray */

 
 
12. Which of the following measurement represent seconds?
a) s
b) se
c) sec
d) second
View Answer
Answer: a

1. Which of the following property is used to control column element breaks after an
associated element when flowing multicolumn text?
a) column-break
b) column-break-after
c) column-break-before
d) multicolumn-break-after
View Answer
Answer: b
Explanation:
Syntax: column-break-after: always | auto | avoid

2. Which of the following property is used to control column element breaks before the
associated element when flowing multicolumn text?
a) multicolumn
b) column-break-before
c) column-break
d) multicolumn-break-before
View Answer
Answer: b
Explanation:
advertisement

Syntax: column-break-before: always | auto | avoid

3. Which of the following property defines the number of columns in a multicolumn text
flow?
a) columns
b) column-flow
c) column-number
d) column-count
View Answer
Answer: d
Explanation:
Syntax: column-count: integer | auto

4. Which of the following property defines the gap between columns in a multicolumn text
flow?
a) column-rule-flow
b) column-gap
c) column-rule
d) none of the mentioned
View Answer
Answer: b
Explanation:
Syntax: column-gap: length | normal

5. Which of the following property defines the style of the divider rule between columns in a
multicolumn text flow?
a) columns
b) column-flow
c) column-style
d) none of the mentioned
View Answer
Answer: d
Explanation:
Syntax: column-rule-style: dashed | dotted

6. Which of the following property defines the width of a rule between columns in a
multicolumn text flow?
a) column-rule-style
b) column-width
c) column-rule-width
d) columns
View Answer
Answer: c
Explanation:
Syntax: column-rule-width: non-negative length

7. Which of the following property is a shorthand definition of the number of columns and
their widths in a multicolumn text flow?
a) column-width
b) column-style
c) columns
d) filter
View Answer
Answer: c
Explanation:
Syntax: columns: column-count width

8. Which of the following property defines the color of any rules between columns in a
multicolumn text flow?
a) column-color
b) column-rule-color
c) column-rule-style
d) column-rule-decoration
View Answer
Answer: b
Explanation:
Syntax: column-rule-color: color

9. Which of the following property is used to apply visual effects to associated elements.
a) Alpha
b) BasicImage
c) Filter
d) Blur
View Answer
Answer: c
Explanation:
Syntax:
filter: filtername(filtervalues) ... filtername(filtervalues)

10. Which of the following property defines the resampling method to use when stretching
images?
a) interpolation-mode
b) image-rendering
c) ime-mode
d) layout-grid
View Answer
Answer: b

1. Which property is used to add space inside the text field?


a) padding
b) margin
c) number
d) password
View Answer
Answer: a
Explanation: Padding property is used to add space inside the text field, when we have
many inputs after each other we can also add some margin to add more space outside,
input[type=text] {padding:13px 30px; margin: 8px 0;}

advertisement

2. Which one can animate the width of search input when get focus?
a) focus
b) transition
c) outline
d) color
View Answer
Answer: b
Explanation: For animating the width of search input when it gets focus we used CSS
transition property,
input[type=text] {-webkit-transition: width 09s ease-in-out; transition:
width 0.9s ease-in-out; } input[type=text]:focus {width:100%;}

3. Which of the following will insert generated content in the counter?


a) content
b) counter-reset
c) counter-increment
d) counter()
View Answer
Answer: a
Explanation: content inserts generated content, counter-reset creates or resets a counter,
counter-increment increments the value of the counter, counter() function adds the value of
a counter to an element.

4. Which of the following is not the pseudo class for CSS Basic UI Level3?
a) :optional
b) :read-only
c) :valid
d) :checked
View Answer
Answer: d
Explanation: CSS Basic UI Level 3 has many pseudo-classes like :widget, :invalid, :valid,
:in-range, :required, :read-write, :read-only, :optional, :out-of-range. CSS Selector Level 3
has the classes :disabled, :enabled, :indeterminate, :checked.

5. Which is not a Mozilla CSS Extension?


a) ::-webkit-input-placeholder
b) :-moz-placeholder
c) –moz-ui-valid
d) :-moz-submit-invalid
View Answer
Answer: a
Explanation: Mozilla CSS Extensions include :-moz-placeholder, :-moz-ui-invalid, :moz-ui-
valid, :moz-submit-invalid. ::-webkit-input-placeholder is Webkit CSS Extension, :-ms-input-
placeholder is Microsoft CSS Extension.

6. Which of the following is an extension to the common JavaScript framework?


a) Niceforms
b) Uni-forms
c) Formalize
d) jQuery UI
View Answer
Answer: c
Explanation: Formalize is an extension to common JavaScript frameworks like JQuery,
Dojo, YUI etc., it helps to normalize and customize the forms. Uni-form standardizes form
markup, styling it with CSS, it also offers a few additional features when used with jQuery.

7. Which of the following will provide date pickers?


a) jQuery UI
b) Niceforms
c) WebShim
d) Twitter Bootstrap
View Answer
Answer: a
Explanation: jQuery UI offers some very interesting and advanced as well as customizable
widgets like date pickers with special attention given to accessibility. Niceforms is a
standalone JavaScript method that provides complete customization of web forms.

8. Which of the following helps to deal with HTML5 support?


a) Twitter Bootstrap
b) WebShim
c) jQuery UI
d) Niceforms
View Answer
Answer: b
Explanation: WebShim is a big tool that can help with browser HTML5 support, web form
part can be very helpful. If you want to normalize forms Twitter Bootstrap can greatly help.

9. Which is not a WebKit value?


a) push-button
b) menulist
c) radio
d) tooltip
View Answer
Answer: d
Explanation: WebKit includes various values like checkbox, button, button-level, menulist,
scrollbarbutton-up, listitem, scrollbarbutton-left, caret, textfield, textarea, searchfield,
searchfield-decoration, slider-vertical, slider-horizontal, scrollbargripper-horizontal etc.

10. Which is not a Mozilla value?


a) caret
b) resizer
c) listbox
d) scrollbar
View Answer
Answer: a
Explanation: Mozilla includes many values like menulist, radio, scrollbar, dialog, listbox,
scrollbarbutton-down, scrollbar, resizer, checkbox, scrollbarbutton-up, separator, toolbar,
toolbox, statusbar, separator, toolbarbutton, window, treetwisty, treeview etc.

11. Which is not the property of CSS box model?


a) width
b) height
c) margin
d) color
View Answer
Answer: d

1. Which of the following is not the value for an unordered list?


a) disc
b) square
c) circle
d) numeric
View Answer
Answer: d
Explanation: For unordered list, we can use none, disc, square, circle. For ordered list, we
can use decimals, decimal-leading-zero, lower-alpha, upper-roman, lower-roman.
ol {list-style-type: lower roman;}

2. Which of the following value sits to the left of the block of text?
a) outside
b) left
c) inside
d) right
View Answer
Answer: a
Explanation: List are indented into the page by default and list-style-position property
indicates whether the marker should appear on inside or outside box containing main
points. This property can take two values outside and inside. The marker sits to the left of
the block of text, this is the default behavior if this property is not used.
advertisement

3. Which is not a box-level element?


a) <p>
b) <ul>
c) <li>
d) <b>
View Answer
Answer: d
Explanation: CSS treats each HTML element as if it is in its own box. This box will either be
block-level Box or inline box. Block-level elements start on a new line e.g. <p>, <ul>, <li>
and <h1>. Inline elements follow in between surrounding text like <img>, <i>, <b>.

4. In which every block-level element appears on a new line?


a) normal flow
b) relative positioning
c) absolute positioning
d) floating positioning
View Answer
Answer: a
Explanation: Every block-level element appears on a new line, which causes each item to
appear lower down the page than the previous one. Even if we specify the width of the
boxes and there is space for two elements to sit side by side, they will not appear next to
each other.

5. Which of the following will take the element out of normal flow?
a) fixed positioning
b) floating elements
c) relative positioning
d) absolute positioning
View Answer
Answer: b
Explanation: Floating an element allows us to take that element out of normal flow and
position it too far left or right of a containing box. The floated element becomes block-level
element around which other content can flow.

6. Which value clear property can’t take?


a) left
b) right
c) none
d) center
View Answer
Answer: d
Explanation: The clear property allows us to say that no element within the same containing
element should touch left or right hand sides of a box. It can take the values left, right, both
or none. When set to none elements can touch either side.

7. Which of the property is not used for positioning columns next to each other?
a) float
b) width
c) margin
d) border
View Answer
Answer: d
Explanation: Many web pages used multiple columns in their design. The three CSS
properties are used to position columns next to each other. Width, margin, and float. Width
sets the width of the column, float positions columns next to each other, margin creates a
gap between columns.

8. Which of the following is not the value for background-repeat property?


a) repeat-y
b) repeat-x
c) no-repeat
d) fixed
View Answer
Answer: d
Explanation: Background-repeat property can have four values i.e. repeat, repeat-x, repeat-
y and no -repeat. The background image is repeated both horizontally and vertically by
setting the value repeat, repeat-x repeats the image horizontally only.

9. Which of the following will move the image up and down?


a) scroll
b) fixed
c) repeat-x
d) repeat-y
View Answer
Answer: a
Explanation: The background image moves up and down as the user scrolls up and down
the page. The fixed value helps background image stays in the same position on the page.

10. Which should be used to overlay text on image with high contrast?
a) screen
b) high contrast
c) low contrast
d) opaque
View Answer
Answer: a
Explanation: To overlay text on an image with high contrast, we can place a semi-
transparent background color or “screen” behind the text to improve legibility. The majority
of photographs have quite high contrast, that means they are not ideal for use as
background image.

11. ID selector name is preceded by __________


a) ‘.’
b) ‘%’
c) ‘#’
d) ‘@’
View Answer
Answer: c
1. Which of the following will represent browsers in their normal states?
a) CSS ON/Images ON
b) CSS ON/Images OFF
c) CSS OFF/Images ON
d) CSS OFF/Images OFF
View Answer
Answer: a
Explanation: There are five major categories for image replacement i.e. CSS ON/Images
ON, CSS ON/Images OFF, CSS OFF/Images ON, CSS OFF/Images ON, CSS OFF/Images
OFF, Extra Unnecessary Markup. CSS ON/Images ON represents browsers in their normal
states and all the techniques should pass their test.

2. Which of the following represents browsing with no stylesheets applied?


a) CSS OFF/Images ON
b) CSS OFF/Images OFF
c) CSS ON/Images OFF
d) CSS ON/Images ON
View Answer
Answer: a
Explanation: CSS OFF/Images ON represents browsing with no stylesheets being applied.
Most of the techniques default to regular web text here which is not exactly a fail, but since
images may still be turned on.

3. Which of the following technique is also known as Fahrner Image Replacement?


a) CSS ON/Images ON
b) CSS ON/Images OFF
c) CSS OFF/Images ON
d) CSS OFF/Images OFF
View Answer
Answer: a
Explanation: CSS ON/Images On technique is also known as FIR or “Fahrner Image
Replacement”. The premise here is to use a span to wrap the text inside the header and
use that span to hide the text. It works but we have to use display:none.
advertisement

4. Using negative text-indent is also known as __________


a) The Scott Kellum method
b) The Phark method
c) Radu Darvas Technique
d) The Langridge method
View Answer
Answer: b
Explanation: Using negative text-indent is also known as the Phark method. This is the most
common technique that most web developers have used. The main idea is to move the text
far outside the browser window by setting a large negative text-indent.

5. Using margin is also known as________


a) Fahrner image replacement
b) The Lindsay method
c) Radu Darvas Technique
d) The Langridge method
View Answer
Answer: c
Explanation: Using margin is also used as Radu Darvas technique. This technique also
forces the text outside of the browser window but uses margins to do so. The main idea is
to apply very large negative left margin and give our header a correspondingly large width.

6. Using padding is also known as ________


a) Leon Dwyer method
b) Radu darvas method
c) Lindsay method
d) Langridge method
View Answer
Answer: d
Explanation: Using padding is known as Langridge method. We push the text outside of our
header using padding-top property. The property is to be set to a value that is equal to the
height of the logo. But this alone is not sufficient, we have to use overflow: hidden to hide
the text.

7. Using Small font-size is also known as ____________


a) Lindsay method
b) Leon Dwyer method
c) Levin technique
d) Radu Darvas Shim
View Answer
Answer: a
Explanation: Using small font-size is known as Lindsay method. Another way to hide text is
by making it very small and set its color to the background of the image. This works without
affecting accessibility but we can also face SEO penalties because of tiny font size and
camouflaged color.

8. Using Overflow is known as ______


a) The Leon method
b) The Scott Kellum method
c) The Phark method
d) The Langridge method
View Answer
Answer: a
Explanation: In this method, overflow property is used to hide the element completely. Using
this technique requires to wrap the text in a <span> element just like the other methods.
The text is hidden by overflow: hidden property.

9. Using Absolute Positioning is known as _________


a) The Langridge method
b) The Levin Technique
c) The Scott Kellum method
d) The Leon method
View Answer
Answer: b
Explanation: This method also requires an additional <span> element to work. But the
<span> element is not wrapped around the text but used to position our image.

10. Using a bogus image is also called as _______


a) The Leon method
b) The Levin Technique
c) Radu Darvas Shim
d) The Langridge method
View Answer
Answer: c
Explanation: This method also requires a bogus image in addition to a usual <span>
element to work properly. The image is a 1×1 pixel transparent GIF. The main purpose is to
show users the alt text if images are turned off.

11. Using actual image with inline image method is also known as __________
a) The Langridge method
b) Radu Darvas Shim
c) The Levin Technique
d) Phark method
View Answer
Answer: d
Explanation: In this method, we use the actual image for image replacement. The image
has alt text that will be shown when images are turned off. This technique does not seem to
be good for SEO. Images will still be visible with CSS turned off and images kept on.

12. Using Pseudo element is known as _____________


a) Nash Image replacement
b) Phark method
c) Radu Darvas Shim
d) The Langridge method
View Answer
Answer: a
Explanation: This technique used the pseudo element to push the text aside.
<h1 class= “replace-pseudo”> Site </h1>.

The pseudo element pushes text aside. The text then overflows and is hidden by using
overflow: hidden property.

13. What is the default value of visibility?


a) visible
b) hidden
c) initial
d) inherit
View Answer
Answer: a
Explanation: The default value of visibility is visible, the element is visible. When set to
hidden, the element is invisible but it still takes up space, initial sets the property to its
default value. Inherit inherits this property from its parent element.
14. Which of the following is only for table elements?
a) initial
b) collapse
c) hidden
d) inherit
View Answer
Answer: b
Explanation: Collapse is only for table elements. Collapse removes row or column. But it
does not affect table layout. The space taken up by row or column will be available for other
content. If the collapse is used with other elements, it renders as “hidden”.

15. Clip property is not supported in ____________


a) Internet Explorer
b) Chrome
c) Safari
d) Opera
View Answer
Answer: a

1. @page is not supported in ________


a) Firefox
b) Opera
c) Chrome
d) Internet Explorer
View Answer
Answer: a
Explanation: @page is not supported in Firefox, but is supported in Chrome 2.0+, IE 8.0+,
Opera 6.0+ and safari 5.0+. @page:first is supported only in IE8+ and Opera 9.2+.

2. Which of the following does not break long URLs into a shorter one?
a) Internet Explorer
b) Chrome
c) Firefox
d) Opera
View Answer
Answer: a
Explanation: word-wrap breaks long URLs when they reach a certain limit. This property is
basically supported in a wide range of browsers even in IE 6, it works in chrome when
printing. Firefox automatically breaks long URLs, Internet Explorer has no capability for
breaking long URLs into the shorter one.

3. Orphans and widows properties are supported by _________


a) Safari
b) Chrome
c) Firefox
d) Opera 9.2+
View Answer
Answer: d
Explanation: Orphan property sets the number of lines for the bottom of the page. The
orphans and widows properties are supported in IE 8+ and Opera 9.2+, but not in Firefox,
Chrome or Safari.
advertisement

4. Which of the following will take care of breaks behind an element?


a) page-break-before
b) page-break-inside
c) page-break-after
d) page-break-into
View Answer
Answer: c
Explanation: There are three CSS attributes page-break before, page-break-after and page-
break-inside that allow us to decide exactly where a print page will be broken. Among other
things, this will prevent images from being broken into two pieces.

5. What prohibits the break?


a) always
b) avoid
c) left
d) right
View Answer
Answer: b
Explanation: Auto is print element’s standard, always places a break every time, avoid
prohibits the break, left and right are for continuation pages that are formatted left or right
accordingly.

6. Which of the following media type is used for computer screens?


a) speech
b) screen
c) all
d) print
View Answer
Answer: b
Explanation: The screen media type is used for computer screens, smart-phones, tablets
etc. The print media type is used for printers, speech is used for screenreaders that “reads”
the page loud, all is used for all media type devices.

7. Which value specifies the number of colors the device can display?
a) color-index
b) color-gamut
c) color
d) max-color
View Answer
Answer: a
Explanation: The number of colors the device can display is specified by color-index, color-
gamut specifies the approximate range of colors that are supported by a user agent and
output device. The number of bits per color component for the output device is specified by
color value.
8. Which value will define the viewport width?
a) width
b) resolution
c) pointer
d) update
View Answer
Answer: a
Explanation: Width specifies the width of the viewport, update specify how quickly can
output device modify the appearance of the content, the scan is set for scanning process of
the output device, the resolution of output device using dpi or dpcm is by resolution.

9. Which of the following will specify minimum width of display area?


a) min-resolution
b) min-width
c) monochrome
d) overflow-block
View Answer
Answer: b
Explanation: The minimum width of a display area such as browser window is specified by
min-width, min-resolution specify the minimum resolution of the device, using dpi or dpcm,
monochrome specify the number of bits per “color” on a monochrome device.

10. Which of the following specify the approximate range of colors?


a) max-color-index
b) max-color
c) color-index
d) color-gamut
View Answer
Answer: d

1. Which of the following will select all elements within the class?
a) .class
b) #id
c) element
d) element>element
View Answer
Answer: a
Explanation: .class selects all elements within the given class, #id selects the element within
the given id, element>element selects all <p> elements where parent is <div> element,
element selects all <p> elements.

2. Which of the following selects all <div> elements and all <p> elements?
a) element,element
b) element+element
c) element,element
d) element element
View Answer
Answer: c
Explanation: element,element selects all <div> elements and all <p> elements, element
element selects all <p> elements inside <div> elements, element>element selects all <p>
elements where parent is a <div> element, element+element selects all <p> elements that
are placed immediately after <div> element.

3. Which of the following selects all elements with a target attribute?


a) attribute
b) attribute=value
c) attribute~=value
d) attribute^=value
View Answer
Answer: a
Explanation: attribute selects all elements with a target attribute, attribute=value selects all
elements for the given target, attribute~=value selects all elements with a title attribute
containing the given title, attribute=value selects all elements with a lang attribute value
starting with the given lang.
advertisement

4. Which of the following selects every <a> element whose href attribute value contains the
given substring?
a) attribute$=value
b) attribute*=value
c) attribute^=value
d) attribute|=value
View Answer
Answer: b
Explanation: attribute*=value selects every <a> element whose href attribute value contains
the given substring, attribute$=value selects every <a> element whose href attribute value
ends with the given href, attribute^=value selects every <a> element element whose href
attribute value begins with “https”.

5. Which of the following selects every <p> element that has no children?
a) :empty
b) :enabled
c) :checked
d) :disabled
View Answer
Answer: a
Explanation: :empty selects every <p> element that has no children including text nodes,
:checked selects every checked <input> element, :disabled selects every disabled <input>
element, :enabled selects every enabled <input> element.

6. Which of the following selects input element which has focus?


a) :in-range
b) :hover
c) :focus
d) :invalid
View Answer
Answer: c
Explanation: :focus selects input element which has focus, :hover selects links on mouse
hover, :in-range selects input elements with a value within a specified range, :invalid selects
all input elements with an invalid value.

7. Which selects all unvisited links?


a) :last-child
b) :not(selector)
c) :link
d) :nth-child(n)
View Answer
Answer: c
Explanation: :link selects all unvisited links, :not(selector) selects every element that is the
second child of its parent, :last-child selects every <p> element that is the last child of its
parent.

8. Which of the following will select every <p> element that is the only child of its parent?
a) :only-child
b) :only-of-type
c) :optional
d) :out-of-range
View Answer
Answer: a
Explanation: :only-child selects every <p> element that is the only child of its parent, :only-
of-type selects every <p> element that is the only child of its parent, :optional selects input
elements with no “required” attribute.

9. Which selects document’s root element?


a) :required
b) :root
c) ::selection
d) :out-of-range
View Answer
Answer: b
Explanation: :root selects the document’s root element, ::selection selects the portion of an
element that is selected by a user, :required selects input elements with “required” attribute
specified, :out-of-range selects input elements with a value outside a specified range.

10. Which selects all visited links?


a) :valid
b) :visited
c) :target
d) :selection
View Answer
Answer: b
Explanation: :visited selects all visited links, :valid selects all input elements with a valid
value, :target selects the current active # element, ::selection selects the portion of an
element that is selected by a user.

11. background-blend-mode is not supported by?


a) IE
b) Opera
c) Chrome
d) Firefox
View Answer
Answer: a
Explanation: background-blend-mode is not supported by Internet Explorer, background-
clip, background-color, background-image, background-origin, background-position,
background, background-repeat, background-size are supported by all the browsers.

12. @font-feature-values are only supported in _______________


a) chrome
b) firefox
c) IE
d) Opera
View Answer
Answer: b
Explanation: @font-feature-values are supported by Firefox only, font-kerning is supported
by all the browsers, font-language-override is supported by firefox only, font-varient is
supported by all the browsers.

13. A grid is not supported by _______________


a) IE
b) Chrome
c) Opera
d) Firefox
View Answer
Answer: a
Explanation: Grid is not supported by Internet Explorer, grid-area, grid-auto-column, grid-
column, grid-column-start, grid-column-end, grid-auto-row, grid-row-gap, grid-row-start is
supported by all the browsers.

14. outline-offset is not supported by _______________


a) IE
b) Chrome
c) Opera
d) Firefox
View Answer
Answer: a
Explanation: outline-offset is not supported by Internet Explorer, outline, outline-color,
outline-style, outline-width are supported by all the browsers.

15. @page is not supported by _________________


a) chrome
b) opera
c) IE
d) Firefox
View Answer
Answer: a

1. Which of the following does not support the “:hover” pseudoclass?


a) IE 6
b) Chrome
c) Opera
d) Safari
View Answer
Answer: a
Explanation: IE 6 does not support the “:hover” pseudoclass on elements other than anchor
tags. To get hover work in IE6, we create a class that duplicates the :hover styles, and then
script a function to toggle that class on/off.

2. Which class is used for setting perspective and scroll properties for the page?
a) .wrapper
b) .section
c) .static
d) .parallax
View Answer
Answer: a
Explanation: .wrapper sets the perspective and scroll properties for the whole page, .section
is for size, display and text properties, mostly not relevant to parallax effect, .static add a
background to a section, just for demonstration.

3. Which of the following is used for adding perspective background images for each
section?
a) .bg1
b) .parallax
c) .static
d) .section
View Answer
Answer: a
Explanation: .bg1, .bg2 adds the respective background images for each section, we can
use img tag also, .parallax adds an ::after pseudo-element with the background image and
transforms needed for the parallax effect.
advertisement

4. Which of the following position is based on the user’s scroll position?


a) fixed
b) sticky
c) relative
d) static
View Answer
Answer: b
Explanation: An element with position: sticky, is positioned on the user’s scroll position. A
sticky element toggles between relative and fixed, depending on scroll position, It is
positioned relative until a given offset position is met in the viewport, then it “sticks” in place.

5. Which of the following does not support sticky version?


a) Firefox
b) Opera
c) IE
d) Chrome
View Answer
Answer: c
Explanation: Internet explorer, Edge 15 and earlier versions do not support sticky
positioning. Safari requires a –webkit-prefix. W should also specify at least one of the top,
right, bottom or left for sticky positioning to work.

6. What sets the stack order of an element?


a) z-index
b) right
c) top
d) position
View Answer
Answer: a
Explanation: The z-index property specifies the stack order of an element i.e. which element
should be placed in front of, or behind, the others, an element can have positive or negative
stack order,
img {position: absolute; left: 10px; top: 10px; z-index: -1;}

7. What clips an absolutely positioned elements?


a) right
b) bottom
c) position
d) clip
View Answer
Answer: d
Explanation: clip clips an absolutely positioned element, bottom sets the bottom margin
edge for a positioned box, position specifies the type of positioning for an element, right sets
the right margin edge for a positioned box.

8. Which of the following is positioned relative to the nearest positioned ancestor?


a) absolute
b) static
c) clip
d) relative
View Answer
Answer: a
Explanation: An element with position: absolute; is positioned relative to the nearest
positioned ancestor, instead of position relative to the viewport like fixed. However, if an
absolute positioned element has no positioned ancestors, it uses the document body and
moves along with page scrolling.

9. Which of the following position element is not affected by the top, bottom, left etc.
property?
a) static
b) clip
c) relative
d) absolute
View Answer
Answer: a
1. What is the default value of object-fit?
a) fill
b) contain
c) none
d) cover
View Answer
Answer: a
Explanation: Object-fit has can be set with five values. When set to the value fill, it is the
default value which stretches the image to fit the content box, regardless of its aspect-ratio,
contain increases or decreases the size of the image to fill the box whilst preserving its
aspect-ratio.

2. Which value will compare the difference between none and contain?
a) contain
b) scale-down
c) none
d) cover
View Answer
Answer: b
Explanation: When setting the value to scale-down the image will compare the difference
between none and contain in order to find the smallest concrete object size when set to
cover the image will fill the height and width of its box.

3. object-fit is not supported by _______


a) Chrome
b) IE
c) Opera
d) Firefox
View Answer
Answer: b
Explanation: In the desktop, object-fit is not supported by Internet Explorer but supported by
chrome, opera, firefox, edge, safari. In mobiles or tablets iOS Safari, Opera Mobile, Opera
Mini, Android, Android Chrome, Android Firefox support this.
advertisement

4. Which of the following is a library for JavaScript?


a) PlotKit
b) List bar chart
c) Pie chart
d) Stacked bar graphs
View Answer
Answer: a
Explanation: PlotKit is a library for JavaScript that is an improved version of CanvasGraph.
It lets us build various sorts of charts and graphs without a hitch. In list bar chart we style
definition list and convert it into a timeline chart.

5. Which of the following will not use JavaScript?


a) Animated attacked bar graph
b) Pie chart
c) Animated Donut chart
d) Infographic charts
View Answer
Answer: b
Explanation: Pure CSS3 experimental charts do not use any JavaScript & zero image, but
can be viewed in Webkit browsers. Animated Stacked Bar Graph use D3 chart and
JavaScript, it is developed to mimic live data feed, and give an illusion of how to handle
data on the backend.

6. Which of the following uses AngulaJS?


a) d3 linegraph
b) Animated Donut chart
c) Infographic charts
d) CSS 3D animated chart
View Answer
Answer: d
Explanation: 3D prisma are created with HTML and CSS3(D) transforms, shaded with CSS
gradients, animated with CSS transitions. AngularJS is used to write up an updating
dataset. The size and thickness of the animated donut chart can be easily edited via CSS,
JavaScript will do the rest.

7. Which of the following moves an element from its current position?


a) rotate()
b) translate()
c) scale()
d) matrix()
View Answer
Answer: b
Explanation: The translate() method moves an element from its current position according
to parameters given for X-axis and Y-axis,
div {-ms-transform: translate(12px, 100px); -webkit-transform:
translate(12px, 100px); translate(12px, 100px);}

8. Which of the following will rotate an element clockwise or counter-clockwise?


a) rotate()
b) skewX()
c) skewY()
d) matrix()
View Answer
Answer: a
Explanation: The rotate() method rotates an element clockwise or counter-clockwise
according to the given degree,
div {-ms-transform: rotate(12deg); /*IE*/ -webkit-transform: rotate(12deg);
transform: rotate(12deg); }

9. Which of the following increases or decreases the size of element?


a) skewX()
b) matrix()
c) scale()
d) skewY()
View Answer
Answer: c
Explanation: The scale() method increases or decreases the size of an element according
to the parameters given for width and height,
div {-ms-transform: scale(3,5); -webkit-transform: scale(3,5); transform:
scale(3,5);}

10. What skews an element along X and Y-axis?


a) skew()
b) skewX()
c) skewY()
d) matrix()
View Answer
Answer: a
Explanation: The skew() method skews an element along X and Y-axis by the given angles,
div {-ms-transform: skew(10deg, 20deg); -webkit-transform: skew(10deg,20deg);
transform: skew(10deg,20deg);}

11. What combines all the 2D transform methods into one?


a) skewX()
b) matrix()
c) skewY()
d) skew()
View Answer
Answer: b
Explanation: The matrix() method combines all 2D transform methods into one, the matrix()
method takes six parameters, containing mathematic functions, that allows us to rotate,
scale, move or skew the elements.

12. What does not affect the element itself?


a) perspective()
b) sacle()
c) matrix()
d) rotate()
View Answer
Answer: a

1. What does PHP stand for?

i) Personal Home Page

ii) Hypertext Preprocessor

iii) Pretext Hypertext Processor

iv) Preprocessor Home Page


a) Both i) and iii)
b) Both ii) and iv)
c) Only ii)
d) Both i) and ii)
View Answer
Answer: d
Explanation: PHP previously stood for Personal Home Page now stands for Hypertext
Preprocessor.

2. PHP files have a default file extension of_______


a) .html
b) .xml
c) .php
d) .ph
View Answer
Answer: c
Explanation: To run a php file on the server, it should be saved as AnyName.php
advertisement

3. What should be the correct syntax to write a PHP code?


a) < php >
b) < ? php ?>
c) <? ?>
d) <?php ?>
View Answer
Answer: c
Explanation: Every section of PHP code starts and ends by turning on and off PHP tags to
let the server know that it needs to execute the PHP in between them.

4. Which of the following is/are a PHP code editor?

i) Notepad

ii) Notepad++

iii) Adobe Dreamweaver

iv) PDT

a) Only iv)
b) i), ii), iii) and iv)
c) i), ii) and iii)
d) Only iii)
View Answer
Answer: b
Explanation: Any of the above editors can be used to type php code and run it.
5. Which of the following must be installed on your computer so as to run PHP script?

i) Adobe Dreamweaver

ii) XAMPP

iii) Apache and PHP

iv) IIS

a) i), ii), iii) and iv)


b) Only ii)
c) ii) and iii)
d) ii), iii) and iv)
View Answer
Answer: d
Explanation: To run PHP code you need to have PHP and a web server, both IIS and
Apache are web servers. You can choose either one according to your platform.

6. Which version of PHP introduced Try/catch Exception?


a) PHP 4
b) PHP 5
c) PHP 6
d) PHP 5 and later
View Answer
Answer: d
Explanation: PHP 5 version and later versions added support for Exception Handling.

7. How should we add a single line comment in our PHP code?

i) /?

ii) //

iii) #

iv) /* */

a) Only ii)
b) i), iii) and iv)
c) ii), iii) and iv)
d) Both ii) and iv)
View Answer
Answer: c
Explanation: /* */ can also be use to comment just a single line although it is used for
paragraphs. // and # are used only for single line comment.

8. Which of the following PHP statement/statements will store 111 in variable num?

i) int $num = 111;


ii) int mum = 111;
iii) $num = 111;
iv) 111 = $num;

a) Both i) and ii)


b) i), ii), iii) and iv)
c) Only iii)
d) Only i)
View Answer
Answer: c
Explanation: You need not specify the datatype in php.

9. What will be the output of the following PHP code?

1. <?php
2. $num = 1;
3. $num1 = 2;
4. print $num . "+". $num1;
5. ?>

a) 3
b) 1+2
c) 1.+.2
d) Error
View Answer
Answer: b
Explanation: .(dot) is used to combine two parts of the statement. Example ($num . “Hello
World”) will output 1Hello World.

10. What will be the output of the following PHP code?

1. <?php
2. $num = "1";
3. $num1 = "2";
4. print $num+$num1;
5. ?>

a) 3
b) 1+2
c) Error
d) 12
View Answer
Answer: a

1. What will be the output of the following PHP code?


1. <?php
2. $a = 5;
3. $b = 5;
4. echo ($a === $b);
5. ?>

a) 5 === 5
b) Error
c) 1
d) False
View Answer
Answer: c
Explanation: === operator returns 1 if $a and $b are equivalent and $a and $b have the
same type.
advertisement

2. Which of the below symbols is a newline character?


a) \r
b) \n
c) /n
d) /r
View Answer
Answer: b
Explanation: PHP treats \n as a newline character.

3. What will be the output of the following PHP code?

1. <?php
2. $num = 10;
3. echo 'What is her age? \n She is $num years old';
4. ?>

a) What is her age? \n She is $num years old


b)

What is her age?

She is $num years old

c) What is her age? She is 10 years old


d)

What is her age?

She is 10 years old

View Answer
Answer: a
Explanation: When a string is enclosed within single quotes both variables and escape
sequences will not be interpreted when the string is parsed.

 
 
4. Which of the conditional statements is/are supported by PHP?

i) if statements

ii) if-else statements

iii) if-elseif statements

iv) switch statements

a) Only i)
b) i), ii) and iv)
c) ii), iii) and iv)
d) i), ii), iii) and iv)
View Answer
Answer: d
Explanation: All are conditional statements supported by PHP as all are used to evaluate
different conditions during a program and take decisions based on whether these conditions
evaluate to true of false.

5. What will be the output of the following PHP code?

1. <?php
2. $team = "arsenal";
3. switch ($team) {
4. case "manu":
5. echo "I love man u";
6. case "arsenal":
7. echo "I love arsenal";
8. case "manc":
9. echo "I love manc"; }
10. ?>

a) I love arsenal
b) Error
c) I love arsenalI love manc
d) I love arsenalI love mancI love manu
View Answer
Answer: c
Explanation: If a break statement isn’t present, all subsequent case blocks will execute until
a break statement is located.

6. Which of the looping statements is/are supported by PHP?


i) for loop

ii) while loop

iii) do-while loop

iv) foreach loop

a) i) and ii)
b) i), ii) and iii)
c) i), ii), iii) and iv)
d) Only iv)
View Answer
Answer: c
Explanation: All are supported looping statements in PHP as they can repeat the same
block of code a given number of times, or until a certain condition is met.

7. What will be the output of the following PHP code?

1. <?php
2. $user = array("Ashley", "Bale", "Shrek", "Blank");
3. for ($x=0; $x < count($user); $x++) {
4. if ($user[$x] == "Shrek") continue;
5. printf ($user[$x]);
6. }
7. ?>

a) AshleyBale
b) AshleyBaleBlank
c) ShrekBlank
d) Shrek
View Answer
Answer: b
Explanation: The continue statement causes execution of the current loop iteration to end
and commence at the beginning of the next iteration.

8. If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?


a) 12
b) 1
c) Error
d) 5
View Answer
Answer: d
Explanation: ?: is known as ternary operator. If condition is true then the part just after the ?
is executed else the part after : .

9. What will be the value of $a and $b after the function call in the following PHP code?

1. <?php
2. function doSomething( &$arg ) {
3. $return = $arg;
4. $arg += 1;
5. return $return;
6. }
7. $a = 3;
8. $b = doSomething( $a );
9. ?>

a) a is 3 and b is 4
b) a is 4 and b is 3
c) Both are 3
d) Both are 4
View Answer
Answer: b
Explanation: $a is 4 and $b is 3. The former because $arg is passed by reference, the latter
because the return value of the function is a copy of the initial value of the argument.

10. Who is the father of PHP?


a) Rasmus Lerdorf
b) Willam Makepiece
c) Drek Kolkevi
d) List Barely
View Answer
Answer: a

1. Which is the right way of declaring a variable in PHP?

i) $3hello
ii) $_hello
iii) $this
iv) $This

a) Only ii)
b) Only iii)
c) ii), iii) and iv)
d) ii) and iv)
View Answer
Answer: d
Explanation: A variable in PHP can not start with a number, also $this is mainly used to
refer properties of a class so we can’t use $this as a user define variable name.
advertisement

2. What will be the output of the following PHP code?

1. <?php
2. $foo = 'Bob';
3. $bar = &$foo;
4. $bar = "My name is $bar";
5. echo $bar;
6. echo $foo;
7. ?>

a) Error
b) My name is BobBob
c) My name is BobMy name is Bob
d) My name is Bob Bob
View Answer
Answer: c
Explanation: Firstly, the line $bar = &$foo; will reference $foo via $bar. So $bar is assigned
value Bob. Therefore $bar = “My name is $bar”; will print My name is Bob($bar=Bob as said
before).

3. Which of the following PHP statements will output Hello World on the screen?

i) echo ("Hello World");


ii) print ("Hello World");
iii) printf ("Hello World");
iv) sprintf ("Hello World");

a) i) and ii)
b) i), ii) and iii)
c) i), ii), iii) and iv)
d) i), ii) and iv)
View Answer
Answer: b
Explanation: echo(), print() and printf() all three can be used to output a statement onto the
screen. The sprintf() statement is functionally identical to printf() except that the output is
assigned to a string rather than rendered to the browser.

4. What will be the output of the following PHP code?

1. <?php
2. $color = "maroon";
3. $var = $color[2];
4. echo "$var";
5. ?>

a) a
b) Error
c) $var
d) r
View Answer
Answer: d
Explanation: PHP treats strings in the same fashion as arrays, allowing for specific
characters to be accessed via array offset notation. In an array, index always starts from 0.
So in the line $var = $color[2]; if we count from start ‘r’ comes at index 2. So the output will
be r.

5. What will be the output of the following PHP code?

1. <?php
2. $score = 1234;
3. $scoreboard = (array) $score;
4. echo $scoreboard[0];
5. ?>

a) 1
b) Error
c) 1234
d) 2
View Answer
Answer: c
Explanation: The (array) is a cast operator which is used for converting values from other
data types to array.

6. What will be the output of the following PHP code?

1. <?php
2. $total = "25 students";
3. $more = 10;
4. $total = $total + $more;
5. echo "$total";
6. ?>

a) Error
b) 35 students
c) 35
d) 25 students
View Answer
Answer: c
Explanation: The integer value at the beginning of the original $total string is used in the
calculation. However if it begins with anything but a numerical value, the value will be 0.

7. Which of the below statements is equivalent to $add += $add?


a) $add = $add
b) $add = $add +$add
c) $add = $add + 1
d) $add = $add + $add + 1
View Answer
Answer: b
Explanation: a += b is an addition assignment whose outcome is a = a + b. Same can be
done with subtraction, multiplication, division etc.

8. Which statement will output $x on the screen?


a) echo “\$x”;
b) echo “$$x”;
c) echo “/$x”;
d) echo “$x;”;
View Answer
Answer: a
Explanation: A backslash is used so that the dollar sign is treated as a normal string
character rather than prompt PHP to treat $x as a variable. The backslash used in this
manner is known as escape character.

9. What will be the output of the following PHP code?

1. <?php
2. function track() {
3. static $count = 0;
4. $count++;
5. echo $count;
6. }
7. track();
8. track();
9. track();
10. ?>

a) 123
b) 111
c) 000
d) 011
View Answer
Answer: a
Explanation: Because $count is static, it retains its previous value each time the function is
executed.

10. What will be the output of the following PHP code?

1. <?php
2. $a = "clue";
3. $a .= "get";
4. echo "$a";
5. ?>

a) get
b) true
c) false
d) clueget
View Answer
Answer: d

1. How to define a function in PHP?


a) function {function body}
b) data type functionName(parameters) {function body}
c) functionName(parameters) {function body}
d) function functionName(parameters) {function body}
View Answer
Answer: d
Explanation: PHP allows us to create our own user-defined functions. Any name ending
with an open and closed parenthesis is a function. The keyword function is always used to
begin a function.
2. Type Hinting was introduced in which version of PHP?
a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
View Answer
Answer: b
Explanation: PHP 5 introduced the feature of type hinting. With the help of type hinting, we
can specify the expected data type of an argument in a function declaration. First valid
types can be the class names for arguments that receive objects and the other are array for
those that receive arrays.

3. Which type of function call is used in line 8 in the following PHP code?

advertisement

1. <?php
2. function calc($price, $tax)
3. {
4. $total = $price + $tax;
5. }
6. $pricetag = 15;
7. $taxtag = 3;
8. calc($pricetag, $taxtag);
9. ?>

a) Call By Value
b) Call By Reference
c) Default Argument Value
d) Type Hinting
View Answer
Answer: a
Explanation: If we call a function by value, we actually pass the values of the arguments
which are stored or copied into the formal parameters of the function. Hence, the original
values are unchanged only the parameters inside the function changes.

4. What will be the output of the following PHP code?

1. <?php
2. function calc($price, $tax="")
3. {
4. $total = $price + ($price * $tax);
5. echo "$total";
6. }
7. calc(42);
8. ?>

a) Error
b) 0
c) 42
d) 84
View Answer
Answer: c
Explanation: You can designate certain arguments as optional by placing them at the end of
the list and assigning them a default value of nothing.

5. Which of the following are valid function names?

i) function()
ii) €()
iii) .function()
iv) $function()

a) Only i)
b) Only ii)
c) i) and ii)
d) iii) and iv)
View Answer
Answer: b
Explanation: A valid function name can start with a letter or underscore, followed by any
number of letters, numbers, or underscores. According to the specified regular expression
([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*), a function name like this one is valid.

6. What will be the output of the following PHP code?

1. <?php
2. function a()
3. {
4. function b()
5. {
6. echo 'I am b';
7. }
8. echo 'I am a';
9. }
10. a();
11. a();
12. ?>

a) I am a
b) I am bI am a
c) Error
d) I am a Error
View Answer
Answer: a
Explanation: The output will be “I am a” as we are calling a(); so the statement outside the
block of function b() will be called.

7. What will be the output of the following PHP code?

1. <?php
2. function a()
3. {
4. function b()
5. {
6. echo 'I am b';
7. }
8. echo 'I am a';
9. }
10. b();
11. a();
12. ?>

a) I am b
b) I am bI am a
c) Error
d) I am a Error
View Answer
Answer: c
Explanation: The output will be Fatal error: Call to undefined function b(). You cannot call a
function which is inside a function without calling the outside function first. It should be a();
then b();

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

1. <?php
2. $op2 = "blabla";
3. function foo($op1)
4. {
5. echo $op1;
6. echo $op2;
7. }
8. foo("hello");
9. ?>

a) helloblabla
b) Error
c) hello
d) helloblablablabla
View Answer
Answer: c
Explanation: If u want to put some variables in function that was not passed by it, you must
use “global”. Inside the function type global $op2.

9. A function in PHP which starts with __ (double underscore) is known as __________


a) Magic Function
b) Inbuilt Function
c) Default Function
d) User Defined Function
View Answer
Answer: a
Explanation: PHP functions that start with a double underscore – a “__” – are called magic
functions in PHP. They are functions that are always defined inside classes, and are not
stand-alone functions.

10. What will be the output of the following PHP code?


1. <?php
2. function foo($msg)
3. {
4. echo "$msg";
5. }
6. $var1 = "foo";
7. $var1("will this work");
8. ?>

a) Error
b) $msg
c) 0
d) Will this work
View Answer
Answer: d

1. Which of the following PHP functions accepts any number of parameters?


a) func_get_argv()
b) func_get_args()
c) get_argv()
d) get_argc()
View Answer
Answer: b
Explanation: func_get_args() returns an array of arguments provided. One can use
func_get_args() inside the function to parse any number of passed parameters. Here is an
example:
1. function foo()
2. {
3. $args = func_get_args();
4. foreach ($args as $k => $v)
5. {
6. echo "arg".($k+1).": $v\n";
7. }
8. }
9. foo();
10. /* will print nothing */
11.  
12. foo("Hello");
13. /* will print Hello */
14.  
15. foo("Hello","World","Bye");
16. /* will print Hello World Bye */

2. Which one of the following PHP functions can be used to find files?
a) glob()
b) file()
c) fold()
d) get_file()
View Answer
Answer: a
Explanation: The function glob() returns an array of filenames or directories which matches
a specified pattern. The function returns an array of files/directories, or it will return FALSE
on failure. Here is an example-
advertisement

1. // get all php files AND txt files


2. $files = glob('*.{php,txt}', GLOB_BRACE);
3. print_r($files);
4. /* output looks like:
5.   Array
6.   (
7.   [0] => phptest.php
8.   [1] => pi.php
9.   [2] => post_output.php
10.   .
11.   .
12.   .
13.   )

3. Which of the following PHP functions can be used to get the current memory usage?
a) get_usage()
b) get_peak_usage()
c) memory_get_usage()
d) memory_get_peak_usage()
View Answer
Answer: c
Explanation: memory_get_usage() returns the amount of memory, in bytes, that’s currently
being allocated to the PHP script. We can set the parameter ‘real_usage’ to TRUE to get
total memory allocated from system, including unused pages. If it is not set or FALSE then
only the used memory is reported. To get the highest amount of memory used at any point,
we can use the memory_get_peak_usage() function.

4. Which of the following PHP functions can be used for generating unique ids?
a) uniqueid()
b) id()
c) md5()
d) mdid()
View Answer
Answer: a
Explanation: The function uniqueid() is used to generate a unique ID based on the
microtime (current time in microseconds). The ID generated from the function uniqueid() is
not optimal, as it is based on the system time. To generate an ID which is extremely difficult
to predict we can use the md5() function.

5. Which one of the following functions can be used to compress a string?


a) zip_compress()
b) zip()
c) compress()
d) gzcompress()
View Answer
Answer: d
Explanation: The function gzcompress() compresses the string using the ZLIB data format.
One can achieve upto 50% size reduction using this function. The gzuncompress() function
is used to uncompress the string.
6. What will be the output of the following PHP code?

1. <?php
2. echo chr(52);
3. ?>

a) 1
b) 2
c) 3
d) 4
View Answer
Answer: d
Explanation: The chr() function returns a character from the specified ASCII value. We can
specify ASCII value in decimal, octal, or hex values. The Octal values are defined as a
leading 0, while hex values are defined as a leading 0x. Since the ASCII value of 4 is 52,
thus 4 was displayed.

7. What will be the output of the following PHP code?

1. <?php
2. echo ord ("hi");
3. ?>

a) 106
b) 103
c) 104
d) 209
View Answer
Answer: c
Explanation: The ord() function returns the ASCII value of the first character of a string. The
ASCII value of h is 104, thus 104 was displayed.

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

1. <?php
2. $str = "Hello World";
3. echo wordwrap($str,5,"<br>\n");
4. ?>

a) Hello World
b)

Hello

World

c)

Hell
o wo

rld

d) World
View Answer
Answer: b
Explanation: The wordwrap() function wraps a string into new lines when it reaches a
specific length.

9. What will be the output of the following PHP code?

1. <?php
2. echo ucwords("i love my country");
3. ?>

a) I love my country
b) i love my Country
c) I love my Country
d) I Love My Country
View Answer
Answer: d
Explanation: The ucwords() function converts the first character of each word in a string to
uppercase.

10. What will be the output of the following PHP code?

1. <?php
2. echo lcfirst("welcome to India");
3. ?>

a) welcome to India
b) welcome to india
c) Welcome to India
d) Welcome to india
View Answer
Answer: a

1. PHP’s numerically indexed array begin with position ___________


a) 1
b) 2
c) 0
d) -1
View Answer
Answer: c
Explanation: Like all the other programming languages, the first element of an array always
starts with ‘0’.

2. Which of the following are correct ways of creating an array?


i) state[0] = "karnataka";
ii) $state[] = array("karnataka");
iii) $state[0] = "karnataka";
iv) $state = array("karnataka");

a) iii) and iv)


b) ii) and iii)
c) Only i)
d) ii), iii) and iv)
View Answer
Answer: a
Explanation: A variable name should start with $ symbol which is not present in i) and you
need not put the square brackets when you use the array() constructor.
advertisement

3. What will be the output of the following PHP code?

1. <?php
2. $states = array("Karnataka" => array
3. ("population" => "11,35,000", "capital" => "Bangalore"),
4. "Tamil Nadu" => array( "population" => "17,90,000",
5. "capital" => "Chennai") );
6. echo $states["Karnataka"]["population"];
7. ?>

a) Karnataka 11,35,000
b) 11,35,000
c) population 11,35,000
d) Karnataka population
View Answer
Answer: b
Explanation: In the following PHP code, the variable states are treated as a
multidimensional array and accordingly traverse it to get the value of ‘Karnataka’s
population’.

4. Which of the following PHP function will return true if a variable is an array or false if it is
not an array?
a) this_array()
b) is_array()
c) do_array()
d) in_array()
View Answer
Answer: b
Explanation: The function is_array() is an inbuilt function in PHP which is used to check
whether a variable is an array or not. Its prototype follows: boolean is_array(mixed variable).

5. Which in-built function will add a value to the end of an array?


a) array_unshift()
b) into_array()
c) inend_array()
d) array_push()
View Answer
Answer: d
Explanation: array_push adds a value to the end of an array, returning the total count of
elements in the array after the new value has been added.

6. What will be the output of the following PHP code?

1. <?php
2. $state = array ("Karnataka", "Goa", "Tamil Nadu",
3. "Andhra Pradesh");
4. echo (array_search ("Tamil Nadu", $state) );
5. ?>

a) True
b) 1
c) False
d) 2
View Answer
Answer: d
Explanation: The array_search() function searches an array for a specified value, returning
its key if located and FALSE otherwise.

7. What will be the output of the following PHP code?

1. <?php
2. $fruits = array ("apple", "orange", "banana");
3. echo (next($fruits));
4. echo (next($fruits));
5. ?>

a) orangebanana
b) appleorange
c) orangeorange
d) appleapple
View Answer
Answer: a
Explanation: The next() function returns the value of the next element in the array. In the
first ‘next($fruits)’ call, it will print orange which is next to apple and so on.

8. Which of the following function is used to get the value of the previous element in an
array?
a) last()
b) before()
c) prev()
d) previous()
View Answer
Answer: c
Explanation: The prev() function returns the previous element in the array.

9. What will be the output of the following PHP code?


1. <?php
2. $fruits = array ("apple", "orange", array ("pear", "mango"),
3. "banana");
4. echo (count($fruits, 1));
5. ?>

a) 3
b) 4
c) 5
d) 6
View Answer
Answer: d
Explanation: The function count() will return the number of elements in an array. The
parameter 1 counts the array recursively i.e it will count all the elements of multidimensional
arrays.

10. Which function returns an array consisting of associative key/value pairs?


a) count()
b) array_count()
c) array_count_values()
d) count_values()
View Answer
Answer: c

1. What will be the output of the following PHP code?

1.<?php
2.$cars = array("Volvo", "BMW", "Toyota");
3.echo "I like " . $cars[2] . ", " . $cars[1] . " and " . $cars[0] .
".";
4.?>

a) I like Volvo, Toyota and BMW


b) I like Volvo, BMW and Toyota
c) I like BMW, Volvo and Toyota
d) I like Toyota, BMW and Volvo
View Answer
Answer: d
Explanation: The order of elements defined. In the echo statement when we call the
elements of array using its index, it will be printed accordingly. As index ‘0’ indicates ‘Volvo’,
‘1’ for ‘BMW’ and ‘2’ for Toyota’.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$fname = array("Peter", "Ben", "Joe");
3.$age = array("35", "37", "43");
4.$c = array_combine($age, $fname);
5.print_r($c);
6.?>
a) Array (Peter Ben Joe)
b) Array ([Peter] => 35 [Ben] => 37 [Joe] => 43)
c) Array (35 37 43)
d) Array ([35] => Peter [37] => Ben [43] => Joe)
View Answer
Answer: d
Explanation: Here “keys” array is $age and “values” array is $fname. The function
array_combine() will create an array by using the elements from one “keys” array and one
“values” array. So when variable c is called, it will print keys and values.

3. What will be the output of the following PHP code?

1.<?php
2.$a=array("A","Cat","Dog","A","Dog");
3.$b=array("A","A","Cat","A","Tiger");
4.$c=array_combine($a,$b);
5.print_r(array_count_values($c));
6.?>

a) Array ( [A] => 5 [Cat] => 2 [Dog] => 2 [Tiger] => 1 )


b) Array ( [A] => 2 [Cat] => 2 [Dog] => 1 [Tiger] => 1 )
c) Array ( [A] => 6 [Cat] => 1 [Dog] => 2 [Tiger] => 1 )
d) Array ( [A] => 2 [Tiger] => 1 )
View Answer
Answer: d
Explanation: The function The array_count_values() counts all the values of an array and
the The function array_combine() will create an array by using the elements from one “keys”
array and one “values” array.

4. What will be the output of the following PHP code?

1.<?php
2.$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" =>
"yellow");
3.$a2 = array("e" => "red", "f" => "green", "g" => "blue", "h" =>
"orange");
4.$a3 = array("i" => "orange");
5.$a4 = array_merge($a2, $a3);
6.$result = array_diff($a1, $a4);
7.print_r($result);
8.?>

a) Array ( [d] => yellow )


b) Array ( [i] => orange )
c) Array ( [h] => orange )
d) Array ( [d] => yellow [h] => orange )
View Answer
Answer: a
Explanation: The array_diff() function compares the values of two (or more) arrays, and
returns the differences. This function compares the values of two (or more) arrays, and
return an array that contains the entries from array1 that are not present in other arrays
(array2, array3, etc).

5. What will be the output of the following PHP code?

1.<?php
2.$a1 = array("red", "green");
3.$a2 = array("blue", "yellow");
4.$a3 = array_merge($a1, $a2);
5.$a4 = array("a", "b", "c", "d");
6.$a = array_combine($a4, $a3);
7.print_r($a);
8.?>

a) Array ( [a] => blue [b] => yellow [c] => red [d] => green )
b) Array ( [0] => blue [1] => yellow [2] => red [3] => green )
c) Array ( [0] => red [1] => green [2] => blue [3] => yellow )
d) Array ( [a] => red [b] => green [c] => blue [d] => yellow )
View Answer
Answer: d
Explanation: The function array_merge() merges one or more arrays into one array. If in the
function array_merge(), two or more array elements have the same key, the last one
overrides the others. The function array_combine() will create an array by using the
elements from one “keys” array and one “values” array. The program is the basic combined
application of array_combine() and array_merge().

6. What will be the output of the following PHP code?

1.<?php
2.$a = array("a" => "india", "b" => "brazil", "c" => "china");
3.echo array_shift($a);
4.echo "<br>";
5.array_pop($a);
6.print_r($a);
7.?>

a)

india

Array ( [b] => Brazil )

b)

india

Array ( [a] => brazil )

c)
china

Array ( [a] => india )

d)

china

Array ( [a] => brazil )

View Answer
Answer: a
Explanation: The function array_shift() removes the first element from an array, and it
returns the value of the removed element and the function array_pop() deletes the last
element of an array. So “a” => “India”, “c” => “China” will be deleted and “b” => “Brazil” will
be printed.

 
 
7. What will be the output of the following PHP code?

1.<?php
2.$a1 = array_fill(1, 4, "hello");
3.$b1 = array_fill(5, 1, "php");
4.$a2 = array_merge($a1, $a2);
5.print_r($a2);
6.echo "<br>";
7.print_r($b1);
8.?>

a)

Array ( [1] => hello [4] => hello [5] => php )

Array ( [5] => php )

b)

Array ( [1] => hello [2] => hello [3] => hello [4] => hello )

Array ( [5] => php )

c)

Array ( [1] => hello [2] => hello [3] => hello [4] => hello [5] => php )
Array ( [5] => php )

d)

Array ( [1] => hello [2] => hello [3] => hello [4] => hello )

Array ( [1] => php )

View Answer
Answer: c
Explanation: Usage of array_fill() and array_merge() functions.

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

1.<?php
2.$names = array("Sam", "Bob", "Jack");
3.echo $names[0] . "is the brother of " . $names[1] . " and " .
$names[1] . ".";
4.?>

a) Sam is the brother of Bob and Jack


b) Samis the brother of Bob and Bob
c) Sam is the brother of Jack and Bob
d) Error
View Answer
Answer: b
Explanation: Simple definition of array and using it in a string. We have used $names[1]
twice and hence Bob appears twice.

9. What will be the output of the following PHP code?

1.<?php
2.$names = array("Sam", "Bob", "Jack");
3.echo $names[0]."is the brother of ".$names[1]." and ".$names[1].".".
$brother;
4.?>

a) Sam is the brother of Bob and Bob) $brother


b) Sam is the brother of Bob and Bob)
c) $brother
d) Error
View Answer
Answer: d
Explanation: $brother undeclared.

10. What will be the output of the following PHP code?


1.<?php
2.$place = array("NYC", "LA", "Paris");
3.array_pop($place);
4.$place1 = array("Paris");
5.$place = array_merge($place, $place1);
6.print_r($place);
7.?>

a) Array ( [0] => LA [1] => Paris [2] => Paris )


b) Array ( [0] => NYC [1] => LA [2] => Paris)
c) Array ( [0] => NYC [1] => LA [2] => Paris [3] => Paris )
d) Array ( [0] => LA [1] => Paris )
View Answer
Answer: b

1. What will be the output of the following PHP code?

1.<?php
2. $age = array("Harry" => "21", "Ron" => "23","Malfoy" => "21");
3. array_pop($age);
4. print_r(array_change_key_case($age, CASE_UPPER));
5.?>

a) Array ( [Harry] => 21 [Ron] => 23 [Malfoy] => 21 )


b) Array ( [HARRY] => 21 [RON] => 23 [MALFOY] => 21 )
c) Array ( [HARRY] => 21 [RON] => 23 )
d) Array ( [Harry] => 21 [Ron] => 23 )
View Answer
Answer: c
Explanation: The function array_pop() will delete the last element of an array. So Malfoy =>
21 will be deleted and the function array_change_key_case() will change all keys in an
array to lowercase or uppercase.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" =>
"yellow");
3.$result = array_flip($a1);
4.print_r($result);
5.?>

a) Array ( [red] => red [green] => green [blue] => blue [yellow] => yellow )
b) Array ( [a] => a [b] => b [c] => c [d] => d )
c) Array ( [red] => a [green] => b [blue] => c [yellow] => d )
d) Array ( [a] => red [b] => green [c] => blue [d] => yellow )
View Answer
Answer: c
Explanation: The function array_flip() flips/exchanges all keys with their associated values in
an array. So, in the above program “a” will be flipped with “red”, “b” will be flipped with
“green” and so on.

3. What will be the output of the following PHP code?

1.<?php
2.$a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" =>
"yellow");
3.$a2 = array("e" => "red","f" => "green", "g" => "blue");
4.$result = array_intersect($a1, $a2);
5.print_r($result);
6.?>

a) Array ( [a] => red [b] => green [c] => blue )
b) Array ( [a] => red [b] => green [c] => blue [d] => yellow )
c) Array ( [e] => red [f] => green [g] => blue )
d) Array ( [a] => red [b] => green [c] => blue [d] => yellow [e] => red [f] => green [g] =>
blue )
View Answer
Answer: a
Explanation: The function array_intersect() compares the values of two (or more) arrays,
and returns the matches. So, in the above program values of a1 and a2 will be compared
and the values present in both the arrays will be the returned.

4. What will be the output of the following PHP code?

1.<?php
2.$a = array(12, 5, 2);
3.echo(array_product($a));
4.?>

a) 024
b) 120
c) 010
d) 060
View Answer
Answer: b
Explanation: The array_product() function calculates and returns the product of an array.

5. What will be the output of the following PHP code?

1.<?php
2.$a = array("a" => "Jaguar", "b" => "Land Rover",
3."c" => "Audi", "d" => "Maseratti");
4.echo array_search("Audi", $a);
5.?>

a) a
b) b
c) c
d) d
View Answer
Answer: c
Explanation: The array_search() function searches for the element and returns the key of
that element.

6. What will be the output of the following PHP code?

1.<?php
2.$city_west = array("NYC", "London");
3.$city_east = array("Mumbai", "Beijing");
4.print_r(array_replace($city_west, $city_east));
5.?>

a) Array ( [1] => Mumbai [0] => Beijing )


b) Array ( [0] => NYC [1] => London )
c) Array ( [1] => NYC [0] => London )
d) Array ( [0] => Mumbai [1] => Beijing )
View Answer
Answer: d
Explanation: The function array_replace() replaces the values of the first array with the
values from following arrays. So, in the above program the values of city_west will be
replaced with city_east.

7. What will be the output of the following PHP code?

1.<?php
2.$people = array("Peter", "Susan", "Edmund", "Lucy");
3.echo pos($people);
4.?>

a) Lucy
b) Peter
c) Susan
d) Edmund
View Answer
Answer: b
Explanation: The pos() function returns the value of the current element in an array, and
since no operation has been done, the current element is the first element.

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

1.<?php
2.$number = range(0, 5);
3.print_r ($number);
4.?>

a) Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 )
b) Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 )
c) Array ( [0] => 5 [1] => 5 [2] => 5 [3] => 5 [4] => 5 [5] => 5 )
d) Array ( [0] => 0 [5] => 5 )
View Answer
Answer: a
Explanation: The range() function creates an array containing a range of elements.

9. What will be the output of the following PHP code?

1.<?php
2.$array = array("red", "green");
3.array_push($array, "blue", "yellow");
4.print_r($array);
5.?>

a) Array ( [0] => red [1] => green [2] => blue [3] => yellow )
b) Array ( [0] => blue [1] => yellow [2] => red [3] => green )
c) Array ( [0] => red [1] => green )
d) Array ( [0] => blue [1] => yellow )
View Answer
Answer: a
Explanation: The function array_push() inserts one or more elements to the end of an array.
So, in the above program blue and yellow will be inserted after previous values.

10. What will be the output of the following PHP code?

1.<?php
2.$age = array("Harry" => "21", "Ron" => "19", "Malfoy" => "23");
3.ksort($age);
4.foreach($age as $x => $x_value)
5.{
6. echo "Key=" . $x . ", Value=" . $x_value;
7. echo "<br>";
8.}
9.?>

a)

Key = Harry, Value = 21

Key = Ron, Value = 21

Key = Malfoy, Value = 23

b)

Key = Harry, Value = 21

Key = Ron, Value = 19

Key = Malfoy, Value = 23


c)

Key = Harry, Value = 21

Key = Malfoy, Value = 23

Key = Ron, Value = 19

d)

Key = Ron, Value = 19

Key = Harry, Value = 21

Key = Malfoy, Value = 23

View Answer
Answer: c

1. What will be the output of the following PHP code?

1.<?php
2.$cars = array("Volvo", "BMW", "Toyota");
3.echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] .
".";
4.?>

a) I like Volvo BMW and Toyota.


b) I like Volvo, BMW and Toyota)
c) I like Volvo, BMW and Toyota.
d) I like. Volvo.,. BMW. and. Toyota)
View Answer
Answer: b
Explanation: The array() function is used to create an array. Each elements are assigned ab
index as the rule of an array. So, calling $cars[0] will print element at index 0 and so on.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
3.print_r(array_change_key_case($age, CASE_UPPER));
4.?>

a) Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )


b) Array ( [peter] => 35 [ben] => 37 [joe] => 43 )
c) Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )
d) Array ( [PeTeR] => 35 [BeN] => 37 [Joe] => 43 )
View Answer
Answer: c
Explanation: The array_change_key_case() function changes all keys in an array to
lowercase or uppercase.

3. What will be the output of the following PHP code?

1.<?php
2.$cars = array("Volvo", "BMW", "Toyota", "Honda", "Mercedes", "Opel");
3.print_r(array_chunk($cars, 2));
4.?>

a) Array ( [0] => Array ( [1] => Volvo [2] => BMW ) [1] => Array ( [1] => Toyota [2] =>
Honda ) [2] => Array ( [1] => Mercedes [2] => Opel ) )
b) Array ( [1] => Array ( [1] => Volvo [2] => BMW ) [2] => Array ( [1] => Toyota [2] =>
Honda ) [3] => Array ( [1] => Mercedes [2] => Opel ) )
c) Array ( [0] => Array ( [0] => Volvo [1] => Volvo ) [1] => Array ( [0] => BMW [1] => BMW )
[2] => Array ( [0] => Toyota [1] => Toyota ) )
d) Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] =>
Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )
View Answer
Answer: d
Explanation: The array_chunk() function splits an array into chunks of new arrays.

4. What will be the output of the following PHP code?

1.<?php
2.$fname = array("Peter", "Ben", "Joe");
3.$age = array("35", "37", "43");
4.$c = array_combine($fname, $age);
5.print_r($c);
6.?>

a) Array ( Peter Ben Joe )


b) Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
c) Array ( 35 37 43 )
d) Array ( “[Peter] => 35” “[Ben] => 37” “[Joe] => 43” )
View Answer
Answer: b
Explanation: The array_combine() function creates an array by using the elements from one
“keys” array and one “values” array.

5. What will be the output of the following PHP code?

1.<?php
2.$a = array("A", "Cat", "Dog", "A", "Dog");
3.print_r(array_count_values($a));
4.?>
a) Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
b) Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )
c) Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )
d) Array ( [A] => 2 [Cat] => 1 [Dog] => 1)
View Answer
Answer: a
Explanation: The array_count_values() function counts all the values of an array.

6. What will be the output of the following PHP code?

1.<?php
2.$a1 = array("a"=>"red", "b"=>"green", "c"=>"blue", "d"=>"yellow");
3.$a2 = array("e"=>"red", "f"=>"green", "g"=>"blue");
4.$result = array_diff($a1, $a2);
5.print_r($result);
6.?>

a) Array ( [d] => yellow )


b) Array ( [c] => blue )
c) Array ( [a] => red )
d) Array ( [e] => yellow )
View Answer
Answer: a
Explanation: The array_diff() function compares the values of two (or more) arrays, and
returns the differences.

7. What will be the output of the following PHP code?

1.<?php
2.$a1 = array_fill(3, 4, "blue");
3.$b1 = array_fill(0, 1, "red");
4.print_r($a1);
5.echo "<br>";
6.print_r($b1);
7.?>

a)

Array ( [3] => blue [4] => blue)

Array ( [0] => red )

b)

Array ( [4] => blue [5] => blue [6] => blue)

Array ( [0] => red )

c)
Array ( [3] => blue [4] => blue [5] => blue [6] => blue )

Array ()

d)

Array ( [3] => blue [4] => blue [5] => blue [6] => blue )

Array ( [0] => red )

View Answer
Answer: d
Explanation: The array_fill() function fills an array with values.

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

1.<?php
2.$a1 = array("red", "green");
3.$a2 = array("blue", "yellow");
4.print_r(array_merge($a1, $a2));
5.?>

a) Array ( [0] => red [1] => green)


b) Array ( [0] => blue [1] => yellow [2] => red [3] => green )
c) Array ( [0] => red [1] => green [2] => blue [3] => yellow )
d) Array ( [0] => blue [1] => yellow )
View Answer
Answer: c
Explanation: The array_merge() function merges one or more arrays into one array.

9. What will be the output of the following PHP code?

1.<?php
2.$a = array("a"=>"red", "b"=>"green", "c"=>"blue");
3.echo array_shift($a);
4.print_r ($a);
5.?>

a) green
b) red
c) redArray( [c] => green [c] => blue )
d) redArray( [b] => green [c] => blue )
View Answer
Answer: d
Explanation: The array_shift() function removes the first element from an array, and returns
the value of the removed element.
10. What will be the output of the following PHP code?

1.<?php
2.$a = array("red", "green", "blue");
3.array_pop($a);
4.print_r($a);
5.?>

a) Array ( [0] => red [1] => green )


b) Array ( [0] => green [1] => blue )
c) Array ( [0] => red [1] => blue )
d) Array ( [0] => blue [1] => blue )
View Answer
Answer: a

. What will be the output of the following PHP code?

1. <?php
2. $fruits = array ("mango", "apple", "pear", "peach");
3. $fruits = array_flip($fruits);
4. echo ($fruits[0]);
5. ?>

a) mango
b) error
c) peach
d) 0
View Answer
Answer: b
Explanation: As we are flipping the values, $fruits[“mango”] = 0, $fruits[“apple”] = 1 and so
on.
advertisement

2. Which of the functions is used to sort an array in descending order?


a) sort()
b) asort()
c) rsort()
d) dsort()
View Answer
Answer: c
Explanation: The function sort() will sort the arrays in ascending order, the function rsort()
will sort arrays in descending order. While the function asort() will sort associative arrays in
ascending order, according to the value.

3. What will be the output of the following PHP code?

1. <?php
2. $fruits = array ("mango", "apple", "peach", "pear");
3. $fruits = asort ($fruits);
4. printr ($fruits);
5. ?>

a) Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
b) Array ( [0] => apple [1] => mango [2] => peach [3] => pear )
c) Error
d) Array ( [1] => apple [0] => mango [3] => peach [2] => pear )
View Answer
Answer: c
Explanation: The program will give an error i.e. uncaught error: call to undefined function
printr(). As the correct function is print_r().

4. What will be the output of the following PHP code?

1. <?php
2. $arr = array ("picture1.JPG", "picture2.jpg",
3. "Picture10.jpg", "picture20.jpg");
4. sort($arr);
5. print_r($arr);
6. ?>

a) Array ( [0] => picture1.JPG [1] => Picture10.jpg [2] => picture2.jpg [3] => picture20.jpg )
b) Array ( [0] => picture1.JPG [1] => picture2.jpg [2] => Picture10.jpg [3] => picture20.jpg )
c) Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
d) Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture20.jpg [3] => picture2.jpg )
View Answer
Answer: c
Explanation: The function sort() in PHP sorts an indexed array in ascending order. While
sorting, each character is compared with the others and sorted using ASCII values.

5. Which function should we use to sort the array in natural order?


a) dsort()
b) casesort()
c) natcasesort()
d) naturalsort()
View Answer
Answer: c
Explanation: The function natcasesort() in PHP sorts an array by using a “natural order”
algorithm. All the values keep their original keys. Eg: In a natural algorithm, as the number 2
is less than the number 10. But in computer sorting, 10 is less than 2, because the first
number in “10” is less than 2. The function is case-insensitive.

6. What will be the output of the following PHP code?

1. <?php
2. $face = array ("A", "J", "Q", "K");
3. $number = array ("2","3","4", "5", "6", "7", "8", "9", "10");
4. $cards = array_merge ($face, $number);
5. print_r ($cards);
6. ?>

a) Array ( [0] => A [1] => J [2] => Q [3] => K [4] => 2 [5] => 3 [6] => 4 [7] => 5 [8] => 6 [9] =>
7 [10] => 8 [11] => 9 [12] => 10 )
b) Array ( [0] => A [1] => 2 [2] => J [3] => 3 [4] => Q [5] => 4 [6] => K [7] => 5 [8] => 6 [9] =>
7 [10] => 8 [11] => 9 [12] => 10 )
c) Error
d) Array ( [0] => 2 [1] => 3 [2] => 4 [3] => 5 [4] => 6 [5] => 7 [6] => 8 [7] => 9 [8] => 10 [9] =>
A [10] => J [11] => Q [12] => K )
View Answer
Answer: a
Explanation: The array_merge() function merges one or more arrays into one array. The
resulting array will begin with the first input array parameter, appending each subsequent
array parameter in the order of appearance.

7. What will be the output of the following PHP code?

1. <?php
2. $fruits = array ("apple", "mango", "peach", "pear",
3. "orange");
4. $subset = array_slice ($fruits, 2);
5. print_r ($subset);
6. ?>

a) Array ( [0] => peach )


b) Array ( [0] => apple [1] => mango [2] => peach )
c) Array ( [0] => apple [1] => mango )
d) Array ( [0] => peach [1] => pear [2] => orange )
View Answer
Answer: d
Explanation: The array_slice() function returns a section of an array based on a starting and
ending offset value.

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

1. <?php
2. $fruits = array ("apple", "mango", "peach", "pear",
3. "orange");
4. $subset = array_splice ($fruits, 2);
5. print_r ($fruits);
6. ?>

a) Error
b) Array ( [0] => apple [1] => mango [2] => peach )
c) Array ( [0] => apple [1] => mango )
d) Array ( [0] => pear [1] => orange )
View Answer
Answer: c
Explanation: The array_splice() function removes all elements of an array found within a
specified range.

9. What will be the output of the following PHP code?

1. <?php
2. $number = array ("4", "hello", 2);
3. echo (array_sum ($number));
4. ?>

a) 4hello2
b) 4
c) 2
d) 6
View Answer
Answer: d
Explanation: The array_sum() function add all the values of the input array together,
returning the final sum. If a string datatype is found, it’ll be ignored.

10. What will be the output of the following PHP code?

1. <?php
2. $array1 = array ("KA", "LA", "CA", "MA", "TA");
3. $array2 = array ("KA", "IA", "CA", "GA", "TA");
4. $inter = array_intersect ($array1, $array2);
5. print_r ($inter);
6. ?>

a) Array ( [0] => KA [1] => LA [2] => CA [3] => MA [4] => TA [5] => IA [6] => GA )
b) Array ( [0] => KA [2] => CA [4] => TA )
c) Array ( [1] => IA [3] => GA )
d) Array ( [1] => LA [3] => MA )
View Answer
Answer: b

1. The practice of separating the user from the true inner workings of an application through
well-known interfaces is known as _________
a) Polymorphism
b) Inheritance
c) Encapsulation
d) Abstraction
View Answer
Answer: c
Explanation: In object-oriented PHP encapsulation is a concept of wrapping up or binding
up the data members and methods in a single module.

2. Which of the following term originates from the Greek language that means “having
multiple forms,” defines OOP’s ability to redefine, a class’s characteristics?
a) Abstraction
b) Polymorphism
c) Inheritance
d) Differential
View Answer
Answer: b
Explanation: The word polymorphism is derived from Greek word poly which means “many”
and morphism which means the property which helps us to assign more than one property.
3. The practice of creating objects based on predefined classes is often referred to as
______________
a) class creation
b) object creation
c) object instantiation
d) class instantiation
View Answer
Answer: d
Explanation: In object-oriented programming, classes are the blueprints of php objects.
Classes do not actually become objects until instantiation is done. When someone
instantiates a class, it creates an instance of it, thus creating the object. In other words,
instantiation is the process of creating an instance of an object in memory.
advertisement

4. Which one of the following property scopes is not supported by PHP?


a) friendly
b) final
c) public
d) static
View Answer
Answer: a
Explanation: PHP supports five class property scopes: public, private, protected, final and
static.

5. Which one of the following can be used to instantiate an object in PHP assuming class
name to be Foo?
a) $obj = new $foo;
b) $obj = new foo;
c) $obj = new foo ();
d) obj = new foo ();
View Answer
Answer: c
Explanation: To create a new object in PHP we can use the new statement to instantiate a
class.

6. Which one of the following is the right way to define a constant?


a) constant PI = “3.1415”;
b) const $PI = “3.1415”;
c) constant PI = ‘3.1415’;
d) const PI = ‘3.1415’;
View Answer
Answer: d
Explanation: Class constants are created like: const NAME = ‘VALUE’;

7. Which one of the following is the right way to call a class constant, given that the class is
mathFunction?
a) echo PI;
b) echo mathFunction->PI;
c) echo mathFunction::PI;
d) echo mathFunction=PI;
View Answer
Answer: c
Explanation: The Scope Resolution Operator “::” is a token that allows access to static,
constant, and overridden properties or methods of a class.

8. Which one of the following is the right way to invoke a method?


a) $object->methodName();
b) object->methodName();
c) object::methodName();
d) $object::methodName();
View Answer
Answer: a
Explanation: “->” is a dynamic class method invocation in PHP.

9. Which of the following is/are the right way to declare a method?

i) function functionName() { function body }

ii) scope function functionName() { function body }

iii) method methodName() { method body }

iv) scope method methodName() { method body }

a) Only ii)
b) Only iv)
c) i) and ii)
d) iii) and iv)
View Answer
Answer: c
Explanation: In case of public methods, you can forgo explicitly declaring the scope and just
declare the method like you would a function.

10. Which of the following method scopes is/are not supported by PHP?

i) private

ii) friendly

iii) static

iv) abstract

a) Only ii)
b) Only iv)
c) ii) and iv)
d) Only i)
View Answer
Answer: a

1. Which of the following advanced OOP features is/are not supported by PHP?

i) Method overloading

ii) Multiple Inheritance

iii) Namespaces

iv) Object Cloning

a) i)
b) ii)
c) i) and ii)
d) iii) and iv)
View Answer
Answer: c
Explanation: The advanced OOP features are: Object cloning, Inheritance, Interfaces,
Abstract classes, and Namespaces.

2. Which version of PHP introduced the advanced concepts of OOP?


a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
View Answer
Answer: b
Explanation: Advanced concepts of OOP were introduced in PHP version 5.
advertisement

3. Which one of the following is the right way to clone an object?


a) _clone(targetObject);
b) destinationObject = clone targetObject;
c) destinationObject = _clone(targetObject);
d) destinationObject = clone(targetObject);
View answer
Answer: b
Explanation: You can clone an object by prefacing it with the clone keyword. A copy of an
object is created by using the clone keyword. $copy_of_object = clone $object;

4. The class from which the child class inherits is called ________

i) Child class
ii) Parent class

iii) Super class

iv) Base class

a) Only i)
b) ii), iii) and iv)
c) Only iii)
d) ii) and iv)
View Answer
Answer: d
Explanation: The class whose properties are inherited by child class is called Base Class or
Parent class.

5. Which of the following is/are true for an abstract class?


i) Abstract classes in PHP are declared with the help of abstract keyword.
ii) A class is declare abstract by using the keyword implements.
iii) It is a class that really isn’t supposed to ever be instantiated but instead serves as a base
class.
iv) Attempting to instantiate an abstract class results in an error.
a) Only i)
b) Only iii)
c) ii) and iv)
d) ii), iii) and iv)
View Answer
Answer: a
Explanation: The abstract classes are the classes in which at least one method need to be
abstract. Abstract classes in PHP are declared with the help of abstract keyword.

6. If one intends to create a model that will be assumed by a number of closely related
objects, which class must be used?
a) Normal class
b) Static class
c) Abstract class
d) Interface
View Answer
Answer: c
Explanation: The abstract classes are the classes in which at least one method need to be
abstract. Abstract classes in PHP are declared with the help of keyword abstract. The use
of class abstract are that all base classes implementing abstract class should give
implementation of abstract methods declared in parent class.

7. If your object must inherit behavior from a number of sources you must use a/an
a) Interface
b) Object
c) Abstract class
d) Static class
View Answer
Answer: a
Explanation: An interface in PHP consists of methods that have no implementations, i.e. the
interface methods are abstract methods. The methods in the interfaces must have public
visibility scope. The interfaces are different from classes as the class can inherit from one
class only whereas the class can implement one or more interfaces.

8. Which method is used to tweak an object’s cloning behavior?


a) clone()
b) __clone()
c) _clone
d) object_clone()
View Answer
Answer: b
Explanation: A copy of an object is created by using the clone keyword, which calls the
object’s __clone() method.

9. Which feature allows us to call more than one method or function of the class in single
instruction?
a) Typecasting
b) Method Including
c) Method adding
d) Method chaining
View Answer
Answer: d
Explanation: When many methods are called in a single instruction in PHP, it is called
method chaining. Following is a basic example of method chaining in php:
$a = new Order();
$a->CreateOrder()->sendOrderEmail()->createShipment();

10. Which magic method is used to implement overloading in PHP?


a) __call
b) __invoke
c) __wakeup
d) __unset
View Answer
Answer: a

1. Which method scope prevents a method from being overridden by a subclass?


a) Abstract
b) Protected
c) Final
d) Static
View Answer
Answer: c
Explanation: When we declare a method is as final then it is not possible to override that
method. Methods should not be overridden due to some security or any other reasons.

2. Which of the following statements is/are true about Constructors in PHP?


i) PHP 4 introduced class constructors.

ii) Constructors can accept parameters.

iii) Constructors can call class methods or other functions.

iv) Class constructors can call on other constructors.

a) ii)
b) ii) and iii)
c) i), ii), iii) and iv)
d) ii), iii) and iv)
View Answer
Answer: c
Explanation: If a class name and the function name is similar then the function is known as
constructor. Constructor is automatically called when an object will be initialized.
Constructors can accept parameters. Constructors can call class methods or other
functions. Class constructors can call on other constructors.
advertisement

3. PHP recognizes constructors by the name _________


a) classname()
b) _construct()
c) function _construct()
d) function __construct()
View Answer
Answer: d
Explanation: A double underscore followed by the construct keyword. Its syntax is function
__construct ([ argument1, argument2,…..]) { Class Initialization code }.

4. Which version of PHP introduced the instanceof keyword?


a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
View answer
Answer: b
Explanation: Using instanceof keyword we can determine whether an object is an instance
of a class. $manager = new Employee() … if ($manager instanceof Employee) echo “True”;

5. Which one of the following functions is used to determine whether a class exists?
a) exist()
b) exist_class()
c) class_exist()
d) __exist()
View Answer
Answer: c
Explanation: The class_exist() function returns true or false according to whether the class
exists within the currently executing script content.

6. Which one of the following functions is used to determine object type?


a) obj_type()
b) type()
c) is_a()
d) is_obj()
View Answer
Answer: c
Explanation: The is_a() function returns true if object belongs to a class type or if it belongs
to a class that is a child of that class. Or else false is returned.

7. Which one of the following keyword is used to inherit our subclass into a superclass?
a) extends
b) implements
c) inherit
d) include
View Answer
Answer: a
Explanation: When we extend a class then the subclass will inherit all the public and
protected methods from the parent class.
The keyword implements are used with interfaces. With inheritance, we use the keyword
extends.

8. In the following PHP code, what is/are the properties?

1. <?php
2. class Example
3. {
4. public $name;
5. function Sample()
6. {
7. echo "This is an example";
8. }
9. }
10. ?>

a) echo “This is an example”;


b) public $name;
c) class Example
d) function sample()
View Answer
Answer: b
Explanation: Above code is an example of ‘classes’ in PHP. Classes are the blueprints of
objects. Classes are the programmer-defined data type, which includes the local methods
and the local variables. Class is a collection of objects which has properties and behaviour.

9. Which keyword is used to refer to properties or methods within the class itself?
a) private
b) public
c) protected
d) $this
View Answer
Answer: d
Explanation: In PHP, the self and ‘this’ keyword are used to refer the class members within
the scope of a class itself. The class members can be either variables or functions.

10. Which keyword allows class members (methods and properties) to be used without
needing to instantiate a new instance of the class?
a) protected
b) final
c) static
d) private
View Answer
Answer: c

1. How many error levels are available in PHP?


a) 14
b) 15
c) 16
d) 17
View Answer
Answer: c
Explanation: Whenever the PHP engine encounters any problem that prevents a script from
running properly it generates an error message. There are sixteen error levels and each
level is represented by an integer value and an associated constant.

2. What is the description of Error level E_ERROR?


a) Fatal run-time error
b) Near-fatal error
c) Compile-time error
d) Fatal Compile-time error
View Answer
Answer: a
Explanation: E_ERROR is a fatal run-time error, that can’t be recovered from and the
execution of the script is stopped immediately.

3. Which version of PHP introduced E_STRICT Error level?


a) PHP 4
b) PHP 5
c) PHP 5.2
d) PHP 5.3
View Answer
Answer: b
Explanation: E_STRICT is PHP version portability suggestions. It is not strictly an error, but
it is triggered whenever PHP encounters code that could lead to problems or forward
incompatibilities.
advertisement
4. Which character does the error_reporting directive use to represent the logical operator
NOT?
a) /
b) !
c) ~
d) ^
View Answer
Answer: c
Explanation: The twidle (~) character is used to represent the logical operator NOT.

5. Say you want to report error concerned about fatal run-time, fatal compile-time error and
core error which statement would you use?
a) error_reporting = E_ALL
b) error_reporting = E_ERROR | E_PARSE | E_CORE_ERROR
c) error_reporting = E_ERROR | E_COMPILE_WARNING | E_CORE_ERROR
d) error_reporting = E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR
View Answer
Answer: d
Explanation: E_ERROR is a fatal run-time error, that can’t be recovered from.
E_COMPILE_ERROR is a fatal error that occurs while the script was being compiled. And
E_CORE_ERROR is a fatal error that occurs during the PHP’s engine initial startup.

6. Which version introduced the function error_get_last()?


a) PHP 4
b) PHP 5
c) PHP 5.2
d) PHP 5.3
View Answer
Answer: c
Explanation: This function returns an associative array consisting of the type, message, file,
and line of the last occurring error.

7. Which of the following statements causes PHP to disregard repeated error messages
that occur within the same file and on the same line?
a) ignore_repeated_errors
b) ignore_repeat_error
c) repeatedly_ignore_error
d) repeated_error_ignore
View Answer
Answer: a
Explanation: ignore_repeated_errors will not log repeated messages. The repeated errors
must occur in the same file on the same line unless ignore_repeated_source is set to true.

8. Which function initializes the constants necessary for using the openlog(), clodelog(), and
syslog() functions?
a) define_variable()
b) define_log_variable()
c) log_variable()
d) define_syslog_variable()
View Answer
Answer: d
Explanation: If you’re running PHP version 5.2.X or older, you need to execute this function
before using any of the following logging functions.

9. Which logging option’s description is if an error occurs when writing to the syslog, send
output to the system console?
a) LOG_CONS
b) LOG_NDELAY
c) LOG_ODELAY
d) LOG_PERROR
View Answer
Answer: a
Explanation: If there is an error while sending data to the system logger, LOG_CONS will
write directly to the system console.

10. Which function is responsible for sending a custom message to the system log?
a) systemlog()
b) syslog()
c) log_system()
d) sys_log()
View Answer
Answer: b

1. Which version of PHP was added with Exception handling?


a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6
View Answer
Answer: b
Explanation: Exception handling was added to PHP with the version 5 release, and further
enhanced with version 5.3.

2. How many methods are available for the exception class?


a) 5
b) 6
c) 7
d) 8
View Answer
Answer: c
Explanation: The seven methods are: getCode(), getFile(), getLine(), getMessage(),
getPrevious(), getTrace(), getTraceAsString().

3. Which version added the method getPrevious()?


a) PHP 4
b) PHP 5
c) PHP 5.1
d) PHP 5.3
View Answer
Answer: d
Explanation: The function getPrevious() returns previous exception.
advertisement

4. Which of the following statements invoke the exception class?


a) throws new Exception();
b) throw new Exception();
c) new Exception();
d) new throws Exception();
View Answer
Answer: b
Explanation: throw new Exception(); trigger an exception and each “throw” must have at
least one “catch”.

5. Which one of the following is the right description for the method getMessage()?
a) Returns the message if it is passed to the constructor
b) Returns the message if it is passed to the class
c) Returns the message if it is passed to the file
d) Returns the message if it is passed to the object
View Answer
Answer: a
Explanation: The function getMessage() gets the exception message. It returns the
message if it is passed to the constructor.

6. You can extend the exception base class, but you cannot override any of the preceding
methods because the are declared as__________
a) protected
b) final
c) static
d) private
View Answer
Answer: b
Explanation: Marking a method as final prevents it from being overridden by a subclass.

7. What does SPL stand for?


a) Standard PHP Library
b) Source PHP Library
c) Standard PHP List
d) Source PHP List
View Answer
Answer: a
Explanation: The standard PHP library(SPL) extends PHP by offering ready-made solutions
to commonplace tasks such as file access, iteration of various sorts etc.

8. How many predefined exceptions does SPL provide access to?


a) 13
b) 14
c) 15
d) 16
View Answer
Answer: a
Explanation: It provides 13 exceptions: BadFunctionCallException,
BadMethodCallException, DomainException, InvalidArgumentException, LengthException,
LogicException, OutOfBoundsException, OutOfRangeException, OverflowException,
RangeException, RuntimeException, UnderflowException, UnexpectedValueException.

9. Which of the following is/are an exception?

i) BadFunctionCallException

ii) BadMethodCallException

iii) LogicException

iv) DomainException

a) Only ii)
b) Only iii)
c) i), ii), iii) and iv)
d) Only iv)
View Answer
Answer: c
Explanation: There are total 13 types of predefined exceptions SPL provide access to.
BadFunctionCallException,BadMethodCallExceptio, LogicException, DomainException are
also included in the exceptions.

10. Which of the following is/are an exception?

i) OutOfBoundException

ii) OutOfRangeException

iii) OverflowException

iv) UnderflowException

a) i)
b) i) and iii)
c) i) and ii)
d) i), ii), iii) and iv)
View Answer
Answer: d
1. Which of the following is/are an external data?

i) Cookies

ii) Input data from a form

iii) Server Variables

iv) Web services data

a) Only ii)
b) ii) and iii)
c) Only iii)
d) i), ii), iii) and iv)
View Answer
Answer: d
Explanation: The web applications receives external input. External input/data can be: User
input from a form, Cookies, Web services data, Server variables and, Database query
results.

2. How many types of filtering are present in PHP?


a) 3
b) 2
c) 4
d) None
View Answer
Answer: b
Explanation: There are two main types of filtering: validation and sanitization.
advertisement

3. Which one of the following filter is used to filter several variables with the same or
different filters?
a) filter_var_array()
b) filter_var()
c) filter_input
d) filter_input_array
View Answer
Answer: a
Explanation: The function filter_var_array() can get multiple variables and it optionally filters
them. The function is useful for filtering many values without calling filter_var().

4. What will be the output of the following PHP code?

1. <?php
2. $num = "123";
3. if (!filter_var($num, FILTER_VALIDATE_INT))
4. echo("Integer is not valid");
5. else
6. echo("Integer is valid");
7. ?>

a) No output is returned
b) Integer is not valid
c) Integer is valid
d) Error
View Answer
Answer: c
Explanation: The function filter_var() can validate and sanitize data. This function filters a
single variable with a specified filter.

5. Which one of the following does not describe a validating filter?


a) Are used to allow or disallow specific characters in a string
b) Are used to validate user input
c) Strict format rules
d) Returns the expected type on success or FALSE on failure
View Answer
Answer: a
Explanation: Validate filter are used to validate user input, it have strict format rules and it
returns the expected type on success or FALSE on failure but ‘are used to allow or disallow
specific characters in a string’ describes sanitizing filters.

6. What will be the output of the following PHP code?

1. <?php
2. $var=300;
3. $int_options = array("options"=>array ("min_range"=>0,
"max_range"=>256));
4. if (!filter_var($var, FILTER_VALIDATE_INT, $int_options))
5. echo("Integer is not valid");
6. else
7. echo("Integer is valid");
8. ?>

a) No output is returned
b) Integer is not valid
c) Integer is valid
d) Error
View Answer
Answer: b
Explanation: Since the integer is “300” it is not in the specified range, and the output of the
code above will be: “Integer is not valid”.

7. If the input variable is a string like this “http://www.saåånfoøøundry.com/”, the $url


variable after the sanitizing will look like?
a) http://www.saåånfoøøundry.com/
b) http://www.saaanfoooundry.com/
c) http://www.saånfoøundry.com/
d) https://www.sanfoundry.com/
View Answer
Answer: d
Explanation: Sanitize is nothing but take away invalid characters so therefore the invalid
characters like å and ø will be removed.

8. Which one of the following filter checks if the variable of the specified type exists?
a) filter_has_var
b) filter_var
c) filter_id
d) filter_var_array
View Answer
Answer: a
Explanation: The filter filter_has_var checks if the variable of the specified type exists.
Whereas the function filter_id() returns filter ID of a specified filter name. The function
filter_var() can validate and sanitize data. The function filter_var_array() can get multiple
variables and it optionally filters them.

9. What will be the output of the following PHP code?

1. <?php
2. $value = 'car';
3. $result = filter_var($value, FILTER_VALIDATE_BOOLEAN,
FILTER_NULL_ON_FAILURE);
4. ?>

a) FALSE
b) TRUE
c) NULL
d) ERROR
View Answer
Answer: c
Explanation: There is an undocumented filter flag for FILTER_VALIDATE_BOOLEAN. The
documentation implies that it will return NULL if the value doesn’t match the allowed
true/false values. However this doesn’t happen unless you give it the
FILTER_NULL_ON_FAILURE flag.

10. What will be the output of the following PHP code?

1. <?php
2. function convertSpace($string)
3. {
4. return str_replace("_", " ", $string);
5. }
6. $string = "Peter_is_a_great_guy!";
7. echo filter_var($string, FILTER_CALLBACK,
array("options"=>"convertSpace"));
8. ?>

a) Peter_is_a_great_guy!
b) Peterisagreatguy!
c) Peter is a great guy!
d) Error
View Answer
Answer: c

1. PHP has long supported two regular expression implementations known as _______ and
_______

i) Perl

ii) PEAR

iii) Pearl

iv) POSIX

a) i) and ii)
b) ii) and iv)
c) i) and iv)
d) ii) and iii)
View Answer
Answer: c
Explanation: None.

2. Which one of the following regular expression matches any string containing zero or one
p?
a) p+
b) p*
c) P?
d) p#
View Answer
Answer: c
Explanation: None.
advertisement

3. [:alpha:] can also be specified as ________


a) [A-Za-z0-9]
b) [A-za-z]
c) [A-z]
d) [a-z]
View Answer
Answer: b
Explanation:[:alpha:] is nothing but Lowercase and uppercase alphabetical characters.

4. How many functions does PHP offer for searching strings using POSIX style regular
expression?
a) 7
b) 8
c) 9
d) 10
View Answer
Answer: a
Explanation: ereg(), ereg_replace(), eregi(), eregi_replace(), split(), spliti(), and
sql_regcase() are the functions offered.

5. What will be the output of the following PHP code?

1. <?php
2. $username = "jasoN";
3. if (ereg("([^a-z])",$username))
4. echo "Username must be all lowercase!";
5. else
6. echo "Username is all lowercase!";
7. ?>

a) Error
b) Username must be all lowercase!
c) Username is all lowercase!
d) No Output is returned
View Answer
Answer: b
Explanation: Because the provided username is not all lowercase, ereg() will not return
FALSE (instead returning the length of the matched string, which PHP will treat as TRUE),
causing the message to output.

6. POSIX implementation was deprecated in which version of PHP?


a) PHP 4
b) PHP 5
c) PHP 5.2
d) PHP 5.3
View Answer
Answer: d
Explanation: None.

7. POSIX stands for ____________


a) Portable Operating System Interface for Unix
b) Portable Operating System Interface for Linux
c) Portative Operating System Interface for Unix
d) Portative Operating System Interface for Linux
View Answer
Answer: a
Explanation: None.

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

1. <?php
2. $text = "this is\tsome text that\nwe might like to parse.";
3. print_r(split("[\n\t]",$text));
4. ?>

a) this is some text that we might like to parse.


b) Array ( [0] => some text that [1] => we might like to parse. )
c) Array ( [0] => this is [1] => some text that [2] => we might like to parse. )
d) [0] => this is [1] => some text that [2] => we might like to parse.
View Answer
Answer: d
Explanation: The split() function divides a string into various elements, with the boundaries
of each element based on the occurrence of a defined pattern within the string.

9. Which of the following would be a potential match for the Perl-based regular expression
/fo{2,4}/?

i) fol

ii) fool

iii) fooool

iv) fooooool

a) Only i)
b) ii) and iii)
c) i), iii) and iv)
d) i) and iv)
View Answer
Answer: b
Explanation: This matches f followed by two to four occurrences of o.

10. Which among the following is/are not a metacharacter?

i) \a

ii) \A

iii) \b

iv) \B

a) Only i)
b) i) and iii)
c) ii), iii) and iv)
d) ii) and iv)
View Answer
Answer: a
1. How many functions does PHP offer for searching and modifying strings using Perl-
compatible regular expressions.
a) 7
b) 8
c) 9
d) 10
View Answer
Answer: b
Explanation: The functions are preg_filter(), preg_grep(), preg_match(), preg_match_all(),
preg_quote(), preg_replace(), preg_replace_callback(), and preg_split().

2. What will be the output of the following PHP code?

1. <?php
2. $foods = array("pasta", "steak", "fish", "potatoes");
3. $food = preg_grep("/^s/", $foods);
4. print_r($food);
5. ?>

a) Array ( [0] => pasta [1] => steak [2] => fish [3] => potatoes )
b) Array ( [3] => potatoes )
c) Array ( [1] => steak )
d) Array ( [0] => potatoes )
View Answer
Answer: c
Explanation: This function is used to search an array for foods beginning with s.
advertisement

3. Say we have two compare two strings which of the following function/functions can you
use?

i) strcmp()

ii) strcasecmp()

iii) strspn()

iv) strcspn()

a) i) and ii)
b) iii) and iv)
c) only i)
d) i), ii), iii) and iv)
View Answer
Answer: d
Explanation: All of the functions mentioned above can be used to compare strings in some
or the other way.
4. Which one of the following functions will convert a string to all uppercase?
a) strtoupper()
b) uppercase()
c) str_uppercase()
d) struppercase()
View Answer
Answer: a
Explanation: Its prototype follows string strtoupper(string str).

5. What will be the output of the following PHP code?

1. <?php
2. $title = "O'malley wins the heavyweight championship!";
3. echo ucwords($title);
4. ?>

a) O’Malley Wins The Heavyweight Championship!


b) O’malley Wins The Heavyweight Championship!
c) O’Malley wins the heavyweight championship!
d) o’malley wins the heavyweight championship!
View Answer
Answer: a
Explanation: The ucwords() function capitalizes the first letter of each word in a string. Its
prototype follows: string ucwords(string str).

6. What will be the output of the following PHP code?

1. <?php
2. echo str_pad("Salad", 5)." is good.";
3. ?>

a) SaladSaladSaladSaladSalad is good
b) is good SaladSaladSaladSaladSalad
 Salad c) is good
 is good d) Salad
View Answer
Answer: d
Explanation: The str_pad() function pads a string with a specified number of characters.

7. Which one of the following functions can be used to concatenate array elements to form
a single delimited string?
a) explode()
b) implode()
c) concat()
d) concatenate()
View Answer
Answer: b
Explanation: None.

8. Which one of the following functions finds the last occurrence of a string, returning its
numerical position?
a) strlastpos()
b) strpos()
c) strlast()
d) strrpos()
View Answer
Answer: d
Explanation: None.

9. What will be the output of the following PHP code?

1. <?php
2. $author = "nachiketh@example.com";
3. $author = str_replace("a","@",$author);
4. echo "Contact the author of this article at $author.";
5. ?>

a) Contact the author of this article at nachiketh@ex@mple.com


b) Cont@ct the @uthor of this @rticle @t n@chiketh@ex@mple.com
c) Contact the author of this article at n@chiketh@ex@mple.com
d) Error
View Answer
Answer: c
Explanation: The str_replace() function case sensitively replaces all instances of a string
with another.

10. What will be the output of the following PHP code?

1. <?php
2. $url = "nachiketh@example.com";
3. echo ltrim(strstr($url, "@"),"@");
4. ?>

a) nachiketh@example.com
b) nachiketh
c) nachiketh@
d) example.com
View Answer
Answer: d

1. The filesize() function returns the file size in ___________


a) bits
b) bytes
c) kilobytes
d) gigabytes
View Answer
Answer: b
Explanation: The function filesize() returns the size of the specified file and it returns the file
size in bytes on success or FALSE on failure.

2. Which one of the following PHP function is used to determine a file’s last access time?
a) fileltime()
b) filectime()
c) fileatime()
d) filetime()
View Answer
Answer: c
Explanation: The fileatime() function returns a file’s last access time in Unix timestamp
format or FALSE on error.

3. Which one of the following function is capable of reading a file into an array?
a) file()
b) arrfile()
c) arr_file()
d) file_arr()
View Answer
Answer: a
Explanation: The function file() will read the entire file into an array.
advertisement

4. Which one of the following function is capable of reading a file into a string variable?
a) file_contents()
b) file_get_contents()
c) file_content()
d) file_get_content()
View Answer
Answer: b
Explanation: The function file_get_contents() reads a file into a string. This is the preferred
way to read the contents of a file into a string as it will use memory mapping techniques.

5. Which one of the following function is capable of reading a specific number of characters
from a file?
a) fgets()
b) fget()
c) fileget()
d) filegets()
View Answer
Answer: a
Explanation: The function fgets() will return a line from an open file. This stops returning on
a new line, at the specified length, or at EOF, whichever comes first. Its prototype is string
fgets(resource handle [, int length]). If the optional length parameter is omitted, 1024
character is assumed.

6. Which one of the following function operates similarly to fgets(), except that it also strips
any HTML and PHP tags form the input?
a) fgetsh()
b) fgetsp()
c) fgetsa()
d) fgetss()
View Answer
Answer: d
Explanation: The function fgetss() returns a line, with HTML and PHP tags removed, from
an open file. This function operates similarly to fgets(), except that it also strips any HTML
and PHP tags form the input.

7. Which one of the following function outputs the contents of a string variable to the
specified resource?
a) filewrite()
b) fwrite()
c) filewrites()
d) fwrites()
View Answer
Answer: b
Explanation: The function fwrite() writes to an open file. This will stop at the end of the file or
when it reaches the specified length, whichever comes first.

8. Which function sets the file filename last-modified and last-accessed times?
a) sets()
b) set()
c) touch()
1. Which directive determines whether PHP scripts on the server can accept file uploads?
a) file_uploads
b) file_upload
c) file_input
d) file_intake
View Answer
Answer: a
Explanation: With PHP, it is easy to upload files to the server. We need to ensure that PHP
is configured to allow file uploads. In the “php.ini” file, search for the file_uploads directive,
and set it to On. By default, its value is on.

2. Which of the following directive determines the maximum amount of time that a PHP
script will spend attempting to parse input before registering a fatal error?
a) max_take_time
b) max_intake_time
c) max_input_time
d) max_parse_time
View Answer
Answer: c
Explanation: This is relevant because particularly large files can take some time to upload,
eclipsing the time set by this directive.

3. What is the default value of max_input_time directive?


a) 30 seconds
b) 60 seconds
c) 120 seconds
d) 1 second
View Answer
Answer: b
Explanation: The default value of the max_input_time directive is 60 seconds.
advertisement

4. Since which version of PHP was the directive max_file_limit available.


a) PHP 5.2.1
b) PHP 5.2.2
c) PHP 5.2.12
d) PHP 5.2.21
View Answer
Answer: c
Explanation: The max_file_limit directive sets an upper limit on the number of files which
can be simultaneously uploaded.

5. What is the default value of the directive max_file_limit?


a) 10 files
b) 15 files
c) 20 files
d) 25 files
View Answer
Answer: c
Explanation: The default value of the directive max_file_limit is 20 files.

6. Which directive sets a maximum allowable amount of memory in megabytes that a script
can allow?
a) max_size
b) post_max_size
c) max_memory_limit
d) memory_limit
View Answer
Answer: d
Explanation: Its default value is 16M.

7. If you want to temporarily store uploaded files in the /tmp/phpuploads/ directory, which
one of the following statement will you use?
a) upload_tmp_dir “/tmp/phpuploads/ directory”
b) upload_dir “/tmp/phpuploads/ directory”
c) upload_temp_dir “/tmp/phpuploads/ directory”
d) upload_temp_director “/tmp/phpuploads/ directory”
View Answer
Answer: a
Explanation: Anyone can temporarily store uploaded files on the given directory. One
cannot change upload_tmp_dir at the runtime. By the time a script runs, the upload process
has already occurred.

8. Which superglobal stores a variety of information pertinent to a file uploaded to the server
via a PHP script?
a) $_FILE Array
b) $_FILES Array
c) $_FILES_UPLOADED Array
d) $_FILE_UPLOADED Array
View Answer
Answer: b
Explanation: The superglobal $_FILES is a two-dimensional associative global array of
items which are being uploaded by via HTTP POST method and holds the attributes of files.

9. How many items are available in the $_FILES array?


a) 2
b) 3
c) 4
d) 5
View Answer
Answer: d
Explanation: $_FILEs[‘userfile’][‘error’], $_FILEs[‘userfile’][‘name’], $_FILEs[‘userfile’][‘size’],
$_FILEs[‘userfile’][‘tmp_name’], $_FILEs[‘userfile’][‘type’] are the five items in the array.

10. Which function is used to determine whether a file was uploaded?


a) is_file_uploaded()
b) is_uploaded_file()
c) file_uploaded(“filename”)
d) uploaded_file(“filename”)
View Answer
Answer: b

View Answer
Answer: c
Explanation: The function touch() will set the access and modification time of the specified
file. Syntax is touch(filename, time, atime).

9. Which function is useful when you want to output the executed command result?
a) out_cmm()
b) out_system()
c) cmm()
d) system()
View Answer
Answer: d
Explanation: The function system() in PHP is same as the C version of the function as in
that it executes the given command and outputs the result. This function also tries to
automatically flush the web server’s output buffer after each line of output if PHP is running
as a server module.

10. Which one of the following function reads a directory into an Array?
a) scandir()
b) readdir()
c) scandirectory()
d) readdirectory()
View Answer
Answer: a
1. What is the full form of DNS?
a) Digital Network System
b) Domain Network System
c) Digital Name Systmem
d) Domain Name System
View Answer
Answer: d
Explanation: DNS stands for domain name system. It is the way that internet domain names
are located and translated into internet protocol (IP) addresses. For example, if someone
types abc.com into the web browser, a server behind the scenes will map that name to the
IP address 206.16.49.139.

2. Which one of the following function checks for the existence of DNS records?
a) checkdns()
b) checkdnsr()
c) checkdnsrr()
d) checkdnsa()
View Answer
Answer: c
Explanation: The function checkdnsrr() is used to check DNS records for type
corresponding to host. DNS records are checked based on the supplied host value and
optional DNS resource record type, returning TRUE if any records are located and FALSE
otherwise.

3. Which one of the following function is used to return an array consisting of various DNS
resource records pertinent to a specific domain?
a) dns_get_record()
b) dns_record()
c) dnsrr_get_record()
d) dnsrr_record()
View Answer
Answer: a
Explanation: The function dns_get_record() is used to get the DNS resource records
associated with the specified hostname. This function is used to return an array consisting
of various DNS resource records pertinent to a specific domain.
advertisement

4. Which one of the following function is used to retrieve the MX records for the domain
specified by hostname?
a) getmx()
b) retrieve_mx()
c) getmxrr()
d) retrieve_mxrr()
View Answer
Answer: c
Explanation: The function getmxrr() returns the MX records for the specified internet host
name. This function is used to retrieve the MX records for the domain specified by
hostname.
5. What is the default port number of HTTPs?
a) 70
b) 80
c) 90
d) 100
View Answer
Answer: b
Explanation: By default, The port number HTTP uses is port 80 and HTTPS uses port 443,
but a URL like http://www.abc.com:8080/path/ specifies that the web browser connects
instead to port 8080 of the HTTP servers.

6. Which one of the following function returns the port number of a specified service?
a) getportname()
b) getservername()
c) getserverbyname()
d) getservbyname()
View Answer
Answer: d
Explanation: The function fgetservbyname() returns the port number for a given Internet
service and protocol. Example-getservbyname(“http”,”tcp”) will return 80.

7. Which one of the following statements can be used to establish port 80 connection with
www.nachi.com?
a) fsockopen(“www.nachi.com”, 80);
b) sockopen(80,”www.nachi.com”);
c) fsockopen(80,”www.nachi.com”);
d) sockopen(“www.nachi.com”, 80);
View Answer
Answer: a
Explanation: The fsockopen() function establishes a connection to the resource designated
by target on port.

8. Which one of the following function is used to send an email using PHP script?
a) mail_send()
b) send_mail()
c) mailrr()
d) mail()
View Answer
Answer: d
Explanation: The function mail() allows you to send emails directly from a script. Using
mail(string to, string subject, string message), you can send any mail.

9. How many configuration directives pertinent to PHP’s mail function are available?
a) 4
b) 5
c) 6
d) 7
View Answer
Answer: b
Explanation: They are- SMTP, sendmail_from, sendmail_path, smtp_port,
mail.force_extra_parameters.

10. Which of the following statements is used to add an attachment to the mail?
a) $mimemail->attachment(‘attachment.pdf’);
b) $mimemail=>attachment(‘attachment.pdf’);
c) $mimemail->addAttachment(‘attachment.pdf’);
d) $mimemail=>addAttachment(‘attachment.pdf’);
View Answer
Answer: c

1. Which one of the following is the very first task executed by a session enabled page?
a) Delete the previous session
b) Start a new session
c) Check whether a valid session exists
d) Handle the session
View Answer
Answer: c
Explanation: The session variables are set with the PHP global variable which is
$_SESSION. The very first task executed by a session enabled page is Check whether a
valid session exists.

2. How many ways can a session data be stored?


a) 3
b) 4
c) 5
d) 6
View Answer
Answer: b
Explanation: Within flat files(files), within volatile memory(mm), using the SQLite
database(sqlite), or through user defined functions(user).

3. Which directive determines how the session information will be stored?


a) save_data
b) session.save
c) session.save_data
d) session.save_handler
View Answer
Answer: d
Explanation: The class SessionHandler is used to wrap whatever internal save handler is
set as defined by the session.save_handler configuration directive which is usually files by
default.
advertisement

4. Which one of the following is the default PHP session name?


a) PHPSESSID
b) PHPSESID
c) PHPSESSIONID
d) PHPIDSESS
View Answer
Answer: a
Explanation: You can change this name by using the session.name directive.

5. If session.use_cookie is set to 0, this results in use of _____________


a) Session
b) Cookie
c) URL rewriting
d) Nothing happens
View Answer
Answer: c
Explanation: The URL rewriting allows to completely separate the URL from the resource.
URL rewriting can turn unsightly URLs into nice ones with a lot less agony and expense
than picking a good domain name. It enables to fill out your URLs with friendly, readable
keywords without affecting the underlying structure of pages.

6. If the directive session.cookie_lifetime is set to 3600, the cookie will live until
____________
a) 3600 sec
b) 3600 min
c) 3600 hrs
d) the browser is restarted
View Answer
Answer: a
Explanation: The lifetime is specified in seconds, so if the cookie should live 1 hour, this
directive should be set to 3600.

7. Neglecting to set which of the following cookie will result in the cookie’s domain being set
to the host name of the server which generated it.
a) session.domain
b) session.path
c) session.cookie_path
d) session.cookie_domain
View Answer
Answer: d
Explanation: The directive session.cookie_domain determines the domain for which the
cookie is valid.

8. What is the default number of seconds that cached session pages are made available
before the new pages are created?
a) 360
b) 180
c) 3600
d) 1800
View Answer
Answer: b
Explanation: The directive which determines this is session.cache_expire.
9. What is the default time(in seconds) for which session data is considered valid?
a) 1800
b) 3600
c) 1440
d) 1540
View Answer
Answer: c
Explanation: The session.gc_maxlifetime directive determines this duration. It can be set to
any required value.

10. Which one of the following function is used to start a session?


a) start_session()
b) session_start()
c) session_begin()
d) begin_session()
View Answer
Answer: b

1. Which function is used to erase all session variables stored in the current session?
a) session_destroy()
b) session_change()
c) session_remove()
d) session_unset()
View Answer
Answer: d
Explanation: The function session_unset() frees all session variables that is currently
registered. This will not completely remove the session from the storage mechanism. If you
want to completely destroy the session, you need to use the function session_destroy().

2. What will the function session_id() return is no parameter is passed?


a) Current Session Identification Number
b) Previous Session Identification Number
c) Last Session Identification Number
d) Error
View Answer
Answer: a
Explanation: The function session_id() will return the session id for the current session or
the empty string (” “) if there is no current session.

3. Which one of the following statements should you use to set the session username to
Nachi?
a) $SESSION[‘username’] = “Nachi”;
b) $_SESSION[‘username’] = “Nachi”;
c) session_start(“nachi”);
d) $SESSION_START[“username”] = “Nachi”;
View Answer
Answer: b
Explanation: You need to refer the session variable ‘username’ in the context of the
$_SESSION superglobal.
advertisement

4. What will be the output of the following PHP code? (Say your previous session username
was nachi.)

1. unset($_SESSION['username']);
2. printf("Username now set to: %s", $_SESSION['username']);

a) Username now set to: nachi


b) Username now set to: System
c) Username now set to:
d) Error
View Answer
Answer: c
Explanation: If someone want to destroy a single session variable then they can use the
function unset () to unset a session variable. To delete the session variable ‘username’ we
use the unset () function.

5. An attacker somehow obtains an unsuspecting user’s SID and then using it to


impersonate the user in order to gain potentially sensitive information. This attack is known
as __________
a) session-fixation
b) session-fixing
c) session-hijack
d) session-copy
View Answer
Answer: a
Explanation: The attack session fixation attempts to exploit the vulnerability of a system that
allows one person to set another person’s session identifier. You can minimize this risk by
regenerating the session ID on each request while maintaining the session-specific data.
PHP offers a convenient function named session_regenerate_id() that will replace the
existing ID with a new one.

6. Which parameter determines whether the old session file will also be deleted when the
session ID is regenerated?
a) delete_old_file
b) delete_old_session
c) delete_old_session_file
d) delete_session_file
View Answer
Answer: b
Explanation: The parameter delete_old_session determines whether the old session file will
also be deleted when the session ID is regenerated.

7. Which function effectively deletes all sessions that have expired?


a) session_delete()
b) session_destroy()
c) session_garbage_collect()
d) SessionHandler::gc
View Answer
Answer: d
Explanation: SessionHandler::gc is used to clean up expired sessions. It is called randomly
by PHP internally when a session_start() is invoked.

8. Which function is used to transform PHP’s session-handler behavior into that defined by
your custom handler?
a) session_set_save()
b) session_set_save_handler()
c) Session_handler()
d) session_save_handler()
View Answer
Answer: b
Explanation: The function session_set_save_handler() is used to set the user-level session
storage functions which are used for storing and retrieving data associated with a session.

9. The session_start() function must appear _________


a) after the html tag
b) after the body tag
c) before the body tag
d) before the html tag
View Answer
Answer: d
Explanation: Like this: <?php session_start(); ?> <html>

10. What is the return type of session_set_save_handler() function?


a) boolean
b) integer
c) float
d) character
View Answer
Answer: a

1. Which one of the following statements should be used to disable just the fopen(), and
file() functions?
a) disable_functions = fopen(), file()
b) disable_functions = fopen, file
c) functions_disable = fopen(), file()
d) functions_disable = fopen, file
View Answer
Answer: b
Explanation: You can set disable_functions equal to a comma-delimited list of function
names that you want to disable.

2. Which one of the following statements should be used to disable the use of two classes
administrator and janitor?
a) disable_classes = “administrator, janitor”
b) disable_classes = class administrator, class janitor
c) disable_classes = class “administrator”, class “janitor”
d) disable_class = class “administrator”, class “janitor”
View Answer
Answer: a
Explanation: There may be classes inside the libraries that you’d rather not make available.
You can prevent the use of these classes with the disable_classes directive.

3. What is the default value of max_execution_time directive? This directive specifies how
many seconds a script can execute before being terminated.
a) 10
b) 20
c) 30
d) 40
View Answer
Answer: c
Explanation: This can be useful to prevent users’ scripts from consuming too much CPU
time. If max_execution_time is set to 0, no time limit will be set.
advertisement

4. The memory_limit is only applicable if ________ is enabled when you configure PHP.
a) –enable-limit
b) -enable-memory-limit
c) –enable-memory-limit
d) -memory-limit
View Answer
Answer: c
Explanation: This directive specifies, in megabytes, how much memory a script can use.
Default value: 128M.

5. Suppose all web material is located within the directory /home/www. To prevent users
from viewing and manipulating files such as /etc/password, which one of the following
statements should you use?
a) open_dir = “/home/www/”
b) open_dir = /home/www/
c) open_basedir = /home/www/
d) open_basedir = “/home/www/”
View Answer
Answer: d
Explanation: We can use open_basedir statement to define the paths from which we can
access files using functions like fopen() and gzopen(). It is used to prevent users from
viewing and manipulating files such as /etc/password.

6. Which Apache directive outputs Apache’s server version, server name, port and compile-
in modules?
a) ServerSignature
b) ServerName
c) ServerDetails
d) ServerInfo
View Answer
Answer: a
Explanation: It is capable of displaying output like: Apache/2.2.11 (Ubuntu) Server at
localhost Port 80.
7. Which directive determines which degree of server details is provided if the
ServerSignature directive is enabled?
a) ServerAddons
b) ServerExtra
c) ServerTokens
d) ServerDetails
View Answer
Answer: c
Explanation: Six options are available: Full, Major, Minimal, Minior, OS, and Prod. If it is set
to Full ‘Apache/2.2.11 (Ubuntu) PHP/5.3.2 Server’ will be displayed.

8. Which directive should we disable to obscure the fact that PHP is being used on our
server?
a) show_php
b) expose_php
c) print_php
d) info_php
View Answer
Answer: b
Explanation: Using the expose_php directive we can prevent PHP version details from
being appended on our web server signature. When expose_php is disabled, the server
signature will look like: Apache/2.2.11 (Ubuntu) Server.

9. Say I want to change the extension of a PHP file, which of the following statements
should I edit to change from .php to .html in the httpd.conf file?
a) AddType application/x-httpd-php .php
b) AddType application/x-httpd-php .asp
c) AddType application/x-httpd-asp .php
d) AddType application/x-httpd-asp .asp
View Answer
Answer: a
Explanation: Just change the .php to .html and your extension will change. This is used for
security purpose.

10. The developers of PHP deprecated the safe mode feature as of which PHP version.
a) PHP 5.1.0
b) PHP 5.2.0
c) PHP 5.3.0
d) PHP 5.3.1
View Answer
Answer: c

1. What will be the output of the following PHP code?

1. <?php
2. echo (checkdate(4,31,2010) ? 'Valid' : 'Invalid');
3. ?>

a) TRUE
b) FALSE
c) Valid
d) Invalid
View Answer
Answer: d
Explanation: The function checkdate() is used to validate a Gregorian date. In the program,
April has 30 days and the above date is 31 therefore Invalid is returned.
advertisement

2. The date() function returns ___ representation of the current date and/or time.
a) Integer
b) String
c) Boolean
d) Float
View Answer
Answer: b
Explanation: The function date() is used to format a local date and time, and it will return the
formatted date string. The syntax of this function is string date(string format [, int
timestamp]).

3. Which one of the following format parameter can be used to identify timezone?
a) T
b) N
c) E
d) I
View Answer
Answer: c
Explanation: When the format is E the time zone is identified and returned, for example,
America/New York. N denotes ISO-8601 numeric representation of the day of the week, T
denotes time zone abbreviation, I denotes whether or not the date is in daylight saving time.

4. If the format is F then which one of the following will be returned?


a) Complete text representation of month
b) Day of month, with leading zero
c) Daylight saving time
d) Day of month, without zeros
View Answer
Answer: a
Explanation: F represents a full textual representation of a month, such as January or
March. Day of month, with leading zero is represented by D, Daylight saving time by I, Day
of month without zeros by j.

5. What will be the output of the following code? (If say date is 22/06/2013.)

1. <?php
2. echo "Today is ".date("F d, Y");
3. ?>

a) Today is 22 June, 2013


b) Today is 22-06-2013
c) Today is 06-22-2013
d) Today is June 22, 2013
View Answer
Answer: d
Explanation: The function date() is used to format a local date and time, and it will return the
formatted date string. F is the parameter for complete text representation of month, d for
day of month, and Y for 4 digit representation of year.

6. Which one of the following function is useful for producing a timestamp based on a given
date and time?
a) time()
b) mktime()
c) mrtime()
d) mtime()
View Answer
Answer: b
Explanation: The function mktime() returns the Unix timestamp for a date. This function is
same as gmmktime() except that the passed parameters represents a date not a GMT date.

7. Which function displays the web page’s most recent modification date?
a) lastmod()
b) getlastmod()
c) last_mod()
d) get_last_mod()
View Answer
Answer: b
Explanation: The function getlastmod() gets the time of the last modification of the main
script of execution. It returns the value of the page’s last modified header or FALSE in the
case of an error.

8. What will be the output of the following PHP code? (If say date is 22/06/2013.)

1. <?php
2. printf( date("t") );
3. ?>

a) 30
b) 22
c) JUNE
d) 2013
View Answer
Answer: a
Explanation: The t parameter is used to determine the number of days in the current month.

9. Suppose you want to calculate the date 45 days from the present date which one of the
following statement will you use?
a) totime(“+45”)
b) totime(“+45 days”)
c) strtotime(“+45 days”)
d) strtotime(“-45 days”)
View Answer
Answer: c
Explanation: The strtotime() function and GNU date syntax is used to calculating the date x
days from the present date.

10. To create an object and set the date to JUNE 22, 2013, which one of the following
statement should be executed?
a) $date = Date(“22 JUNE 2013”)
b) $date = new Date(“JUNE 22 2013”)
c) $date = DateTime(“22 JUNE 2013”)
d) $date = new DateTime(“22 JUNE 2013”)
View Answer
Answer: d

1. How many methods does the DateTime class have?


a) 8
b) 9
c) 10
d) 11
View Answer
Answer: b
Explanation: The DateTime class has nine methods, all of which are public.

2. How many constants does the DateTime class have?


a) 8
b) 9
c) 10
d) 11
View Answer
Answer: d
Explanation: The DateTime class has 11 constants, no static properties or methods.

3. Which method is simply an object-oriented version of date()?


a) DateTime::format()
b) DateTime::modify()
c) DateTime::setTime()
d) DateTime::setDate()
View Answer
Answer: a
Explanation: The format() method is simply an object-oriented version of date(). It takes
$dateFormat as an argument. $dateFormat is a string consisting of the same date
formatting characters accepted by the procedural date() function.
advertisement

4. Which of the following is the right way to use the DateTime class?
a) $date = get_Class(DateTime);
b) $date = class DateTime;
c) $date = new DateTime();
d) $date = new class DateTime();
View Answer
Answer: c
Explanation: The way you use the DateTime class is like any other class: instantiate an
object, and store it in a variable.

5. What will be the output of the following PHP code if date is 24/02/2008?

1. <?php
2. $date = new DateTime();
3. echo $date->format('l,F,js,Y');
4. ?>

a) Sunday, February 24th 2008


b) Sunday, 02 24 2008
c) Sunday, 24 02 2008
d) Sunday, 24th February 2008
View Answer
Answer: a
Explanation: The format() method displays the date in same way as standard date
function().

6. Which of the following statements can be used to set the time zone in individual scripts?
a) date_set_timezone(‘Europe/London’);
b) date_default_timezone_set(‘Europe/London’);
c) date_set_default_timezone(‘Europe/London’);
d) date_default_timezone(‘Europe/London’);
View Answer
Answer: b
Explanation: The function date_default_timezone_set is used to set the default time zone
used by all date/time functions in a script. You can also use ini_set(‘date.timezone’,
‘Europe/London’);

7. Which of the following DateTimeZone classes are static?

i) listAbbreviations()

ii) getName()

iii) getOffset()

iv) listIdentifiers()

a) Only i)
b) Only ii)
c) i) and iv)
d) iii) and iv)
View Answer
Answer: c
Explanation: listAbbreviations() and listIdentifiers() are static methods.

8. Which of the following DateTimeZone classes are non-static?

i) _construct()

ii) getName()

iii) getOffset()

iv) getTransitions()

a) Only i)
b) Only ii)
c) i), ii), iii) and iv)
d) iii) and iv)
View Answer
Answer: c
Explanation: All of the given methods are non static.

9. Which of the following statements can be used to add two months to the existing date?
a) $date->modify(‘+2 months’);
b) $date = modify(‘+2 months’);
c) $date = modify(‘2+ months’);
d) $date->modify(‘2+ months’);
View Answer
Answer: a
Explanation: To change the date stored by a DateTime object after it has been created, you
use DateTime::modify() with a natural language expression.

10. Which method enables you to calculate whether daylight saving time is in force at a
specific date and time?
a) getOffset()
b) getTranitions()
c) ISODate()
d) savingTime()
View Answer
Answer: b

1. Which two predefined variables are used to retrieve information from forms?
a) $GET & $SET
b) $_GET & $_SET
c) $__GET & $__SET
d) GET & SET
View Answer
Answer: b
Explanation: The global variables $_GET is used to collect form data after submitting an
HTML form with the method=”get”. The variable $_SET is also used to retrieve information
from forms.

2. The attack which involves the insertion of malicious code into a page frequented by other
users is known as _______________
a) basic sql injection
b) advanced sql injection
c) cross-site scripting
d) scripting
View Answer
Answer: c
Explanation: The cross-site scripting attack is among one of the top five security attacks
carried out across the Internet. It is also known as XSS, this attack is a type of code
injection attack which is made possible by incorrectly validating user data, which usually
gets inserted into the page through a web form or using an altered hyperlink.

3. When you use the $_GET variable to collect data, the data is visible to ___________
a) none
b) only you
c) everyone
d) selected few
View Answer
Answer: c
Explanation: The information sent from a form with the method GET is visible to everyone
i.e. all variable names and values are displayed in the URL.
advertisement

4. When you use the $_POST variable to collect data, the data is visible to ___________
a) none
b) only you
c) everyone
d) selected few
View Answer
Answer: b
Explanation: The information sent from a form with the method POST is invisible to others
i.e. all names/values are embedded within the body of the HTTP request.

5. Which variable is used to collect form data sent with both the GET and POST methods?
a) $BOTH
b) $_BOTH
c) $REQUEST
d) $_REQUEST
View Answer
Answer: d
Explanation: In PHP the global variable $_REQUEST is used to collect data after submitting
an HTML form.

6. Which one of the following should not be used while sending passwords or other
sensitive information?
a) GET
b) POST
c) REQUEST
d) NEXT
View Answer
Answer: a
Explanation: The information sent from a form with the method GET is visible to everyone
i.e. all variable names and values are displayed in the URL. So, it should not be used while
sending passwords or other sensitive information.

7. Which function is used to remove all HTML tags from a string passed to a form?
a) remove_tags()
b) strip_tags()
c) tags_strip()
d) tags_remove()
View Answer
Answer: b
Explanation: The function strip_tags() is used to strip a string from HTML, XML, and PHP
tags.

8. What will be the value of the variable $input in the following PHP code?

1. <?php
2. $input = "Swapna<td>Lawrence</td>you are really<i>pretty</i>!";
3. $input = strip_tags($input,"<i></i>");
4. echo $input;
5. ?>

a) Swapna Lawrence you are really pretty!


b) Swapna <td>Lawrence</td> you are really<i>pretty</i>!
c) Swapna <td>Lawrence</td> you are really pretty!
d) Swapna Lawrence you are really<i>pretty</i>!
View Answer
Answer: d
Explanation: Italic tags <i></i> might be allowable, but table tags <td></td> could potentially
wreak havoc on a page.

9. To validate an email address, which flag is to be passed to the function filter_var()?


a) FILTER_VALIDATE_EMAIL
b) FILTER_VALIDATE_MAIL
c) VALIDATE_EMAIL
d) VALIDATE_MAIL
View Answer
Answer: a
Explanation: The FILTER_VALIDATE_EMAIL is used to validates an e-mail address.

10. How many validation filters like FILTER_VALIDATE_EMAIL are currently available?
a) 5
b) 6
c) 7
d) 8
View Answer
Answer: c

1. How many predefined variables does PHP use to authenticate a user?


a) 1
b) 2
c) 3
d) 4
View Answer
Answer: b
Explanation: The variables PHP use to authenticate a user are
$_SERVER[‘PHP_AUTH_USER’] and $_SERVER[‘PHP_AUTH_PW’].

2. Which of the following variables does PHP use to authenticate a user?

i) $_SERVER['PHP_AUTH_USER'].
ii) $_SERVER['PHP_AUTH_USERS'].
iii) $_SERVER['PHP_AUTH_PU'].
iv) $_SERVER['PHP_AUTH_PW'].

a) i) and ii)
b) ii) and iv)
c) i) and iv)
d) ii) and iii)
View Answer
Answer: c
Explanation: $_SERVER[‘PHP_AUTH_USER’] and $_SERVER[‘PHP_AUTH_PW’] store
the username and password values, respectively.
advertisement

3. Which of the following PHP function is commonly used when handling authentication via
PHP?

i) header()

ii) footer()

iii) inset()

iv) isset()

a) i) and iv)
b) ii) and iv)
c) ii) and iii)
d) i) and iii)
View Answer
Answer: a
Explanation: The function isset () is used to check whether a variable is set or not and the
function header() sends a raw HTTP header to a client.

4. Which function is used to verify whether a variable contains a value?


a) header()
b) footer()
c) inset()
d) isset()
View Answer
Answer: d
Explanation: The isset() function determines whether a variable has been assigned a value.
Its prototype follows: boolean isset(mixed var [,mixed var [,…]]).

5. Which of the following are types of PHP authentication implementation methodologies?

i) Hard-coding a login pair directly into the script

ii) File-based authentication

iii) Data-based authentication

iv) PEAR'S HTTP authentication

a) ii) and iii)


b) i) and iv)
c) i), ii), iii) and iv)
d) Only iv)
View Answer
Answer: c
Explanation: The method PEAR’S HTTP authentication is used to provides a framework for
user authentication on the HTTP. The data-based authentication is the process of
confirming that a user who is attempting to log in to a database is authorized to do so. In the
file-based authentication as some small sites does not have a need for database back-end
to store data, but security is still important either the site is big or small. They need to
authenticate some folder or file and want to set access credentials for that. One can handle
such by using file-based authentication using PHP. The simplest way to restrict resource
access is by hard-coding the username and password directly into the script.

6. In which authentication method does changing the username or password can be done
only by entering the code and making the manual adjustment.
a) Hard-coding a login pair directly into the script
b) File-based authentication
c) Data-based authentication
d) PEAR’S HTTP authentication
View Answer
Answer: a
Explanation: The simplest way to restrict resource access is by hard-coding the username
and password directly into the script. In this authentication method, changing the username
or password can be done only by entering the code and making the manual adjustment.
This is one of the drawbacks of hard-coding a login pair directly into the script.

7. The authenticationFile.txt, the file which stores username and password should be stored
___ the server document root.
a) Inside
b) Outside
c) Within
d) None of the mentioned
View Answer
Answer: b
Explanation: If it is not stored outside, the attacker could discover the file through brute
force guessing.

8. Which function is used to split a string into a series of substrings, with each string
boundary is determined by a specific separator?
a) break()
b) divide()
c) explode()
d) md5()
View Answer
Answer: c
Explanation: Although they are a similar function, you should use explode() instead of
split(). In fact split() function has been deprecated altogether.

9. In which of the following situations does file-based authentication become inconvenient.

i) small list

ii) large number of user

iii) users are being regularly added

iv) static authentication

a) i) and iv)
b) i) and iii)
c) ii) and iii)
d) ii) and iv)
View Answer
Answer: c
Explanation: Such requirements are better satisfied by implementing a database based
solution.
10. Which is the most powerful authentication method among the four?
a) Hard-coding a login pair directly into the script
b) File-based authentication
c) Data-based authentication
d) PEAR’S HTTP authentication
View Answer
Answer: c

1. What will be the output of the following PHP code?

1. <?php
2. $number = array(0,1,two,three,four,5);
3. $num = preg_grep("/[0-5]/", $number);
4. print_r($num);
5. ?>

a) Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)


b) Array([2]=>two [3]=>three [4]=>four)
c) Array([1]=> 1)
d) Array([0]=>0 [1]=>1 [5]=>5)
View Answer
Answer: d
Explanation: The preg_grep function is used to search an array for specific patterns and
then return a new array based on that filtering.
advertisement

2. What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with
$num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?
a) Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)
b) Array([2]=>two [3]=>three [4]=>four)
c) Array([1]=> 1)
d) Array([0]=>0 [5]=>5)
View Answer
Answer: b
Explanation: When we include PREG_GREP_INVERT, this will invert our data, so instead
of outputting numbers it will output our non-numeric values.

3. Which one of the following functions are used to search a string?


a) preg_match
b) preg_search
c) preg_find
d) preg_found
View Answer
Answer: a
Explanation: The function preg_match() searches string for pattern and it returns true if
pattern exists, and false otherwise. The function returns 1 if search was successful else
returns 0.

4. What will be the output of the following PHP code?


1. <?php
2. $name = "What is your name?";
3. if (preg_match("/name/"),$name)
4. echo "My name is Will Pitt ";
5. else
6. echo "My name is not Will Pitt ";
7. if (preg_match("/are/"))
8. echo "I am great";
9. else
10. echo "I am not great";
11. ?>

a) My name is Will Pitt I am great


b) My name is not Will Pitt I am great
c) My name is Will Pitt I am not great
d) My name is not Will Pitt I am not great
View Answer
Answer: c
Explanation: The code uses preg_match to check for a keyword and replies based on
whether it is true (1) or false (0).

5. Which one of the following preg PHP function is used to do a find and replace on a string
or an array?
a) preg_replace()
b) preg_find()
c) preg_find_replace()
d) preg_findre()
View Answer
Answer: a
Explanation: In preg_replace() function, after the replacement has occurred, the modified
string will be returned and if no matches are found, the string will remain unchanged.

6. What will be the output of the following PHP code?

1. <?php
2. $str = "Hello! My name is Cameron Fox. Coffee?";
3. $find = array('/is/','/coffee/');
4. $replace = array('/was/','/tea/');
5. echo preg_replace ($find, $replace, $str);
6. ?>

a) Hello! My name was Cameron Fox. tea?


b) Hello! My name is Cameron Fox. tea?
c) Hello! My name is Cameron Fox. Coffee?
d) Hello! My name was Cameron Fox. Coffee?
View Answer
Answer: d
Explanation: Coffee was not replaced because the preg_replace function is case sensitive.
Therefore it treats coffee and Coffee differently.

7. Which one of the following preg PHP functions is used to take a string, and put it in an
array?
a) preg_destroy()
b) preg_split()
c) preg_unchain()
d) preg_divide()
View Answer
Answer: b
Explanation: The string is broken up into different values in the array based upon your input.

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

1. <?php
2. $line = "You like dogs. I hate dogs. We should marry.";
3. $sen = preg_split('/\./', $line);
4. print_r($sen);
5. ?>

a) You like dogs. I hate dogs. We should marry.


b) Array([0]=>You like dogs. I hate dogs. We should marry.)
c) Array([0]=>You like dogs. [1]=>I hate dogs. [2]=>We should marry.)
d) Error
View Answer
Answer: c
Explanation: We use a ‘.’ period to split the data, therefor giving each sentence it’s own
array entry.

9. Which one of the following is not a preg PHP function?


a) preg_match
b) preg_match_all
c) preg_matchall
d) preg_split
View Answer
Answer: c
Explanation: The function preg_match_all() matches all occurrences of pattern in string.

10. Parameter flags was added in which version of PHP?


a) PHP 4.0
b) PHP 4.1
c) PHP 4.2
d) PHP 4.3
View Answer
Answer: d

1. Which one of the following databases has PHP supported almost since the beginning?
a) Oracle Database
b) SQL
c) SQL+
d) MySQL
View Answer
Answer: d
Explanation: We can connect, insert, update, delete and retrieve data from the databases
with the help of PHP and MySQL is the most popular database system used with PHP.

2. The updated MySQL extension released with PHP 5 is typically referred to as


_______________
a) MySQL
b) mysql
c) mysqli
d) mysqly
View Answer
Answer: c
Explanation: The updated MySQL extension with PHP 5 is known as MySQL and typically
referred to as mysqli.

3. 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
View Answer
Answer: a
Explanation: Also make sure that extension_dir directive points to the appropriate directory.
advertisement

4. In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?
a) PHP 5.0
b) PHP 5.1
c) PHP 5.2
d) PHP 5.3
View Answer
Answer: d
Explanation: PHP required that MySQL client library be installed on the server from which
PHP was communicating with MySQL, whether the MySQL server also happened to reside
locally or elsewhere. PHP 5.3 removes this problem by introducing MySQL Native Driver.

5. Which one of the following statements is used to create a table?


a) CREATE TABLE table_name (column_name column_type);
b) CREATE table_name (column_type column_name);
c) CREATE table_name (column_name column_type);
d) CREATE TABLE table_name (column_type column_name);
View Answer
Answer: a
Explanation: The example creates a table called “student” that contains five columns: SID,
LastName, FirstName, Address, and City:
CREATE TABLE student (
SID int,

LastName varchar(255),

FirstName varchar(255),

Address varchar(255),

City varchar(255)

);

6. Which one of the following statements instantiates the mysqli class?


a) mysqli = new mysqli()
b) $mysqli = new mysqli()
c) $mysqli->new.mysqli()
d) mysqli->new.mysqli()
View Answer
Answer: b
Explanation: If you choose to interact with MySQL server using the object-oriented
interface, you need to first instantiate the mysqli class via its constructor.

7.Which one of the following statements can be used to select the database?
a) $mysqli=select_db('databasename');
b) mysqli=select_db('databasename');
c) mysqli->select_db('databasename');
d) $mysqli->select_db('databasename');
View Answer
Answer: d
Explanation: $mysqli->select_db(‘databasename’); can be used to select the database.

8. Which one of the following methods can be used to diagnose and display information
about a MySQL connection error?
a) connect_errno()
b) connect_error()
c) mysqli_connect_errno()
d) mysqli_connect_error()
View Answer
Answer: c
Explanation: The mysqli extension includes a few features that can be used to capture error
messages or alternatively you can use exceptions.
9. Which method returns the error code generated from the execution of the last MySQL
function?
a) errno()
b) errnumber()
c) errorno()
d) errornumber()
View Answer
Answer: a
Explanation: Error numbers are often used in lieu of natural-language message to ease
software internationalization efforts and allow for customization of error messages.

10. If there is no error, then what will the error() method return?
a) TRUE
b) FALSE
c) Empty String
d) 0
View Answer
Answer: c

1. Which one of the following statements should be used to include a file?


a) #include ‘filename’;
b) include ‘filename’;
c) @include ‘filename’;
d) #include <filename>;
View Answer
Answer: b
Explanation: Include in PHP will takes all the code from the specified file and copies to the
existing file containing include statement. An example of this-
1. <?php
2. #include 'mysql.connect.php';
3. //begin database selection and queries.
4. ?>

2. Which one of the following methods is responsible for sending the query to the database?
a) query()
b) send_query()
c) sendquery()
d) mysqli_query()
View Answer
Answer: d
Explanation: The method mysqli_query() is responsible for sending the query to the
database. Query() method was previously used in older versions of PHP.
advertisement

3. Which one of the following methods recuperates any memory consumed by a result set?
a) destroy()
b) mysqli_free_result()
c) alloc()
d) free()
View Answer
Answer: b
Explanation: The function mysqli_free_result() is used to free the memory which is
associated with the result. Once this method is executed, the result set is no longer
available. Free() function was used in the previous version of PHP.

4. Which of the methods are used to manage result sets using both associative and indexed
arrays?
a) get_array() and get_row()
b) get_array() and get_column()
c) fetch_array() and fetch_row()
d) mysqli_fetch_array() and mysqli_fetch_row()
View Answer
Answer: d
Explanation: The method mysqli_fetch_array() is used to fetch a result row as an
associative array or a numeric array.
And the function mysqli_fetch_row() is used to fetche one row from a result-set and returns
it as an enumerated array.
The method fetch_array() and fetch_row() were used in the previous version of PHP.

5. Which one of the following method is used to retrieve the number of rows affected by an
INSERT, UPDATE, or DELETE query?
a) num_rows()
b) affected_rows()
c) changed_rows()
d) mysqli_affected_rows()
View Answer
Answer: d
Explanation: The method mysqli_num_rows() is only useful for determining the number of
rows retrieved by a SELECT query. But to retrieve the number of rows affected by INSERT,
UPDATE, or DELETE query, use mysqli_affected_rows(). Num_rows() and affected_rows()
were used in previous version of PHP.

6. Which version of MySQL introduced the prepared statements?


a) MySQL 4.0
b) MySQL 4.1
c) MySQL 4.2
d) MySQL 4.3
View Answer
Answer: b
Explanation: When the query() method is looped repeatedly it comes at a cost of both
overhead, because of the need to repeatedly parsing of the almost identical query for
validity, and coding convenience, because of the need to repeatedly reconfigure the query
using the new values for each iteration. To help resolve the issues incurred by repeatedly
executed queries, MySQL introduced prepared statements.

7. Which of the following methods is used to execute the statement after the parameters
have been bound?
a) bind_param()
b) bind_result()
c) bound_param()
d) bound_result()
View Answer
Answer: a
Explanation: Once the statement has been prepared, it needs to be executed. Exactly when
it’s executed depends upon whether you want to work with bound parameters or bound
results. In the case of bound parameters, you’d execute the statement after the parameters
have been bound with the bind_param() method.

8. Which one of the following methods is used to recuperating prepared statements


resources?
a) end()
b) finish()
c) mysqli_close()
d) close()
View Answer
Answer: c
Explanation: The function mysqli_close() is used to close an opened database connection.
Once you’ve finished using a prepared statement, the resources it requires can be
recuperated with the mysqli_close() method. Close() was used in previous version of PHP.

9. Which method retrieves each row from the prepared statement result and assigns the
fields to the bound results?
a) get_row()
b) fetch_row()
c) fetch()
d) mysqli_fetch_row()
View Answer
Answer: d
Explanation: The function mysqli_fetch_row() is used to fetche row from a result-set and
returns it as an enumerated array.
Its syntax is mysqli_fetch_row(result);

10. Which method rolls back the present transaction?


a) commit()
b) undo()
c) mysqli_rollback()
d) rollback()
View Answer
Answer: c

1. Which one of the following is not a valid class name?


a) ShopProduct
b) Shopproduct
c) Shopproduct1
d) 1shopproduct
View Answer
Answer: d
Explanation: You declare a class with the class keyword and an arbitrary class name. Class
names can be any combination of numbers and letters, although they must not begin with a
number.

2. Fill in the blank with the best option. An Object is a/an ________ of a class.
a) type
b) prototype
c) instance
d) object
View Answer
Answer: c
Explanation: An object is said to be an instance of its class. It is of the type defined by the
class.

3. There are two objects-


$product1 = new Shop();
$product2 = new Shop();
Which one of the following statements is right about them?
a) $product1 and $product2 are same objects of the same type generated from a single
class
b) $product1 and $product2 are different objects of the same type generated from a single
class
c) $product1 and $product2 are same objects of the different type generated from a single
class
d) $product1 and $product2 are different objects of the different type generated from a
single class
View Answer
Answer: b
Explanation: In PHP object is created using new operator. $product1 and $product2 are
different objects of the same type generated from a single class.
advertisement

4. Which version of PHP introduced the visibility keywords i.e public, private, and protected?
a) PHP 4
b) PHP 5
c) PHP 5.1
d) PHP 5.3
View Answer
Answer: b
Explanation: In PHP 4, all properties were declared with var keyword, which is identical in
effect to using public. For the sake of backward compatibility, PHP 5 accepts var in place of
public for properties.

5. Which characters is used to access property variables on an object-by-object basis?


a) ::
b) =
c) ->
d) .
View Answer
Answer: c
Explanation: Example: $product1->title=”My Life”;

6. Code that uses a class, function, or method is often described as the ____________
a) client code
b) user code
c) object code
d) class code
View Answer
Answer: a
Explanation: Code that uses a class, function, or method is often described as the class’s,
function, or method client or as client code.

7. Which keyword precedes a method name?


a) method
b) function
c) public
d) protected
View Answer
Answer: b
Explanation: A method declaration resembles a function declaration. The function keyword
precedes a method name, followed by an optional list of argument variables in parentheses.

8. If you omit the visibility keyword in your method declaration, by default the method will be
declared as ____________
a) public
b) private
c) protected
d) friendly
View Answer
Answer: a
Explanation: By declaring a method public, you ensure that it can be invoked from outside
of the current object.

9. Which function is used to determine whether the variable’s value is either TRUE or
FALSE?
a) boolean()
b) is_boolean()
c) bool()
d) is_bool()
View Answer
Answer: d
Explanation: None.

10. What will be the output of the following PHP code?

1.<?php
2. class ShopProductWriter
3. {
4. public function write( $shopProduct )
5. {
6. $str = "{$shopProduct->title}: " .$shopProduct-
>getProducer() ." ({$shopProduct->price})\n";
7. print $str;
8. }
9. }
10. $product1 = new ShopProduct( "My Antonia", "Willa",
"Cather", 5.99 );
11. $writer = new ShopProductWriter();
12. $writer->write( $product1 );
13. ?>

a) Error
b) Cather: Willa My Antonia (5.99)
c) Willa: Cather My Antonia (5.99)
d) My Antonia: Willa Cather (5.99)
View Answer
Answer: d

1. Which version of PHP introduced class type hints?


a) PHP 4
b) PHP 4.3
c) PHP 5
d) PHP 5.3
View Answer
Answer: c
Explanation: None.

2. Inheritance is the means by which one or more classes can be derived from a/an
___________ class.
a) base
b) abstract
c) null
d) predefined
View Answer
Answer: a
Explanation: A class that inherits from another is said to be a subclass of it. This
relationship is often described in terms of parents and children. A child class is derived from
and inherits characteristics from the parent.

3. What will be the output of the following PHP code?

advertisement

1.<?php
2.class MyClass
3.{
4.}
5. 
6.class NotMyClass
7.{
8.}
9.$a = new MyClass;
10.  
11. var_dump($a instanceof MyClass);
12. var_dump($a instanceof NotMyClass);
13. ?>

a)

bool(true)

bool(true)

b)

bool(false)

bool(false)

c)

bool(true)

bool(false)

d)

bool(false)

bool(true)

View Answer
Answer: c
Explanation: instanceof is used to determine whether a PHP variable is an instantiated
object of a certain class.

 
 
4. What will be the output of the following PHP code?

1.<?php
2.class ParentClass
3.{
4.}
5. 
6.class MyClass extends ParentClass
7.{
8.}
9. 
10. $a = new MyClass;
11.  
12. var_dump($a instanceof MyClass);
13. var_dump($a instanceof ParentClass);
14. ?>

a)

bool(false)

bool(false)

b)

bool(true)

bool(true)

c)

bool(false)

bool(true)

d)

bool(true)

bool(false)

View Answer
Answer: b
Explanation: instanceof can also be used to determine whether a variable is an instantiated
object of a class that inherits from a parent class.

 
 
5. What will be the output of the following PHP code?

1.<?php
2.class MyClass
3.{
4.}
5. 
6.$a = new MyClass;
7.var_dump(!($a instanceof stdClass));
8.?>

a) bool(true)
b) bool(false)
c) error
d) none of the mentioned
View Answer
6. What will be the output of the following PHP code?

1.<?php
2.interface MyInterface
3.{
4.}
5. 
6.class MyClass implements MyInterface
7.{
8.}
9. 
10. $a = new MyClass;
11.  
12. var_dump($a instanceof MyClass);
13. var_dump($a instanceof MyInterface);
14. ?>

a)

bool(false)

bool(false)

b)

bool(true)

bool(true)

c)

bool(false)

bool(true)

d)
bool(true)

bool(false)

View Answer
Answer: b
Explanation: instanceof can also be used to determine whether a variable is an instantiated
object of a class that implements an interface.

 
 
7. What should be used to refer to a method in the context of a class rather than an object
you use?
a) ->
b) __
c) $
d) ::
View Answer
Answer: d
Explanation: Example- parent::__construct()

8. Prior to which version of PHP did constructors took the name of the enclosing class.
a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 5.4
View Answer
Answer: b
Explanation: The new unified constructors use the name __construct(). Using the old
syntax, a call to a parent constructor would tie you to that particular class:
parent::ShopProduct();

9. Which method or property can only be accessed from within the enclosing class? Even
subclasses have no access.
a) public
b) friendly
c) private
d) protected
View Answer
Answer: c
Explanation: None.

10. A mutator method is also called as ___________


a) Setter
b) Accessor
c) Getter
d) Destructor
View Answer
Answer: a
1. When you are building administrative links you’ll need to accept two arguments, which of
the following are they?
a) URL of previous entry and URL of the entry you are working with
b) The current page and previous page
c) URL of previous entry and previous page
d) The current page and URL of the entry you are working with
View Answer
Answer: d
Explanation: Your function should look like this:
1. function adminLinks($page, $url)
2. {
3. //Build admin links here
4. }

2. Once your application can generate administrative links, you need to load those links into
_________
a) php.ini
b) index.ini
c) index.php
d) start.php
View Ansewr
Answer: c
Explanation: You place your administrative links only on the full display of an entry, so you
must place the call to load information from adminLinks() within a conditional statement
advertisement

3. The URLs in the administrative links won’t mean anything to admin.php unless you
modify _________
a) .htaccess
b) .adminaccess
c) .htmlaccess
d) .urlaccess
View answer
Answer: a
Explanation: You need to modify .htaccess with an additional rule that handles URLs
passed in a link to admin.php.

4. The (|/) tells the server to match ___________


a) nothing
b) forward slash
c) backward slash
d) either nothing or a forward slash
View Answer
Answer: d
Explanation: The vertical pipe character (|) is the regular expression equivalent of “or”.

5. ([\w-]+) will match ___________


a) one word characters
b) one or more word characters
c) one or more word characters and/or hyphens
d) one or more word characters and hyphens
View Answer
Answer: c
Explanation: ([\w-]+), will match one or more word characters and/or hyphens—which is
what your custom entry URLs consist.

6. You need to check whether ______ is set, to determine whether you’re editing an entry or
creating a new one.
a) $_GET[‘url’]
b) $_SET[‘url’]
c) $_GET[‘admin’]
d) $_SET[‘admin’]
View Answer
Answer: a
Explanation: If an entry is being edited, you need to load the existing entry data and save
each piece in a variable.

7. To identify entries marked for deletion, you check whether $_GET[‘page’] == ‘delete’
inside __________
a) index.php
b) index.ini
c) admin.php
d) .htaccess
View Answer
8. To declare the function to confirm the deletion you need to add the code to __________
a) inc.php
b) functions.inc.php
c) include.php
d) functions.include.php
View Answer
Answer: b
Explanation: You need to add the following code –
1. function confirmDelete($db, $url)
2. {
3. $e = retrieveEntries($db, '', $url);
4. return <<<FORM
5. <form action="/simple_blog/admin.php" method="post">
6. <fieldset>
7. <legend>Are You Sure?</legend>
8. <p>Are you sure you want to delete the entry "$e[title]"?</p>
9. <input type="submit" name="submit" value="Yes" />
10. <input type="submit" name="submit" value="No" />
11. <input type="hidden" name="action" value="delete" />
12. <input type="hidden" name="url" value="$url" />
13. </fieldset>
14. </form>
15. FORM;
16. }
9. Your confirmation form submits your choice, via the _______ method, to ________
a) GET index.php
b) GET admin.php
c) POST index.php
d) POST admin.php
View Answer
Answer: d
Explanation: To process this, you need to add an additional block of code to the top of
admin.php that determines what choices you’ve made and act accordingly.

10. When a user confirms that he wishes to delete an entry, that entry’s URL is passed to a
function which removes the entry from the __________
a) index.php
b) function.inc.php
c) database
d) admin.php
View Answer
Answer: c

1. Before you can start processing images with PHP, you must first add the ability to upload
images to your administrative form on ________
a) .htaccess
b) function.inc.php
c) index.php
d) admin.php
View Answer
Answer: d
Explanation: To do this, you’ need to add a file upload input to your administrative form.

2. When you’re uploading files you need to set the enctype of the form to __________
a) text
b) text/file
c) multipart/form-data
d) multimedia/form-data
View Answer
Answer: c
Explanation: Set the enctype of the form to multipart/form-data, which can accept files and
standard form values.

3. To check whether a file was uploaded, you look in the _______ superglobal array.
a) $_FILES
b) $_DOCS
c) $_DOCUMENTS
d) $_FOLDERS
View Answer
Answer: a
Explanation: Whenever a file is uploaded via an HTML form, that file is stored in temporary
memory and information about the file is passed in the $_FILES superglobal.
advertisement
4. To make the ImageHandler class portable you should create a separate file for it called
__________
a) imagehandler.inc.php
b) images.inc.php
c) handler.inc.php
d) imghandler.inc.php
View Answer
Answer: b
Explanation: You save this file in the inc folder (full path:
/xampp/htdocs/simple_blog/inc/images.inc.php).

5. DocBlocks are indicated by opening a comment using _________


a) /*
b) //*
c) /**
d) /*/
View Answer
Answer: c
Explanation: This is a special comment that provides information about a class, property, or
method.

6. To process the file, you need to break the array from $_FILES into individual values. You
can do this using the ________ function.
a) divide()
b) list()
c) break()
d) indi()
View Answer
Answer: b
Explanation: The list() function allows you to create named variables for each array index as
a comma-separated list.

7. Before you try to process the file, you need to make sure that your $err value is
equivalent to _________
a) UPLOAD_ERR_OK
b) UPLOAD_NO_ERR
c) UPLOAD_ERR_NO_OK
d) UPLOAD_ERR
View Answer
Answer: a
Explanation: When you’re dealing with files uploaded through an HTML form, you have
access to a special constant called UPLOAD_ERR_OK that tells you whether a file
uploaded successfully.

8. You use the $_SERVER superglobal and your _______ property to create your path to
check.
a) $load_dir
b) $load
c) $save
d) $save_dir
View Answer
Answer: d
Explanation: // Determines the path to check
$path = $_SERVER['DOCUMENT_ROOT'] . $this->save_dir;

9. Which function do you have to use to check whether the $path you’ve stored exists?
a) path_dir()
b) path()
c) is_dir()
d) path_dir()
View Answer
Answer: c
Explanation: If the path exists, is_dir() returns TRUE; otherwise, it returns FALSE.

10. Which one of the following is true about the following line – $obj = new
ImageHandler(‘/images/’, array(400, 300));?
a) This snippet sets the maximum dimensions allowed to 400 pixels wide by 300 pixels high
b) This snippet sets the minimum dimensions allowed to 300 pixels wide by 400 pixels high
c) This snippet sets the minimum dimensions allowed to 400 pixels wide by 300 pixels high
d) This snippet sets the maximum dimensions allowed to 300 pixels wide by 400 pixels high
View Answer
Answer: a

1. Which version of PHP introduced the static keyword?


a) PHP 4
b) PHP 5
c) PHP 5.2
d) PHP 5.3
View Answer
Answer: b
Explanation: The static keyword was introduced with PHP 5. It cannot be used in PHP 4
scripts.

2. Which keyword is used to access a static method or property from within the same
class(rather than from child)?
a) static
b) strat
c) self
d) set
View Answer
Answer: c
Explanation: Self is to classes what the $this pseudo-variable is to objects.

3. In which of the following circumstance should you use a static reference to a non static
method?
a) Making a method call using parent
b) Making a method call using child
c) Making an object call using parent
d) Making an object call using child
View Answer
Answer: a
Explanation: Making a method call using parent is the only circumstance in which you
should use a static reference to a non-static method.
advertisement

4. Which one of the following variable cannot be used inside a static method?
a) $this
b) $get
c) $set
d) $date
View Answer
Answer: a
Explanation: By definition, static methods are not invoked in the context of an object. For
this reason, static methods and properties are often referred to as class variables and
properties.

5. What does PDO stand for?


a) PHP Data Orientation
b) PHP Database Object
c) PHP Database Orientation
d) PHP Data Object
View Answer
Answer: d
Explanation: The PDO class provides a common interface to different database
applications.

6. Which version of PHP allows you to define constant properties within a class?
a) PHP 4
b) PHP 4.1
c) PHP 4.3
d) PHP 5
View Answer
Answer: d
Explanation: None.

7. Which keyword is used to declare a constant property?


a) const
b) con
c) constant
d) _constant
View Answer
Answer: a
Explanation: A constant property is declared with the const keyword. Like global constants,
class constants cannot be changed once they are set.
8. Which one of the following is a constant variable?
a) const $name
b) const $NAME
c) constant NAME
d) const NAME
View Answer
Answer: d
Explanation: Constants are not prefixed with a dollar sign like regular properties. By
convention, they are often named using only uppercase characters

9. What will happen if you try to set a value to a constant once it has been declared?
a) The value of the variable will change
b) The value of the variable will not change
c) Parse Error
d) Nothing
View Answer
Answer: c
Explanation: You should use constants when your property needs to be available across all
instances of a class, and when the property value needs to be fixed and unchanging.

10. How many of the following can be contained in constants?

i) boolean

ii) integer

iii) float

iv) string

a) 1
b) 2
c) 3
d) 4
View Answer
Answer: d

his set of PHP MCQs focuses on “Object Advanced Features – 2”.

1. Which one of the following class can not be instantiated?


a) inherited class
b) abstract class
c) constant class
d) every class
View Answer
Answer: b
Explanation: An abstract class cannot be instantiated. Instead, it defines (and, optionally,
partially implements) the interface for any class that might extend it.

2. Which one of the following keywords are used to define an abstract class?
a) extends
b) implements
c) abstract
d) new
View Answer
Answer: c
Explanation: The introduction of abstract classes was one of the major changes ushered in
with PHP 5. Its inclusion in the list of new features was another sign of PHP’s extended
commitment to object-oriented design.

3. Which one of the following is the correct abstract method?


a) public function write()
b) abstract function write()
c) abstract public write();
d) abstract public function write();
View Answer
Answer: d
Explanation: An abstract method cannot have an implementation. You declare it in the
normal way, but end the declaration with a semicolon rather than a method body.
advertisement

4. At least how many abstract methods must an abstract class contain?


a) None
b) One
c) Two
d) Five
View Answer
Answer: b
Explanation: Classes defined as abstract may not be instantiated, and any class that
contains at least one abstract method must also be abstract.

5. Which one of the following keyword is used to implement an interface?


a) interface
b) get
c) inherit
d) implements
View Answer
Answer: d
Explanation: A class can implement an interface using the implements keyword in its
declaration.

6. Which version of PHP introduced the concept called late static binding?
a) PHP 4
b) PHP 5
c) PHP 5.1
d) PHP 5.3
View Answer
Answer: d
Explanation: None.

7. Which one of the following methods in the exception class, is used to get a nested
exception object?
a) getPrevious()
b) getCode()
c) getFile()
d) getLine()
View Answer
Answer: a
Explanation: getCode() – Get the code integer that was passed to the constructor. getFile()
– Get the file in which the exception was generated. getLine() – Get the line number at
which the exception was generated.

8. Which one of the following keyword is used in conjunction with an Exception object?
a) throws
b) exception
c) throw
d) final
View Answer
Answer: c
Explanation: The throw keyword is used in conjunction with an Exception object. It halts the
execution of the current method and passes responsibility for handling the error back to the
calling code.

9. Which keyword is used to put a stop on inheritance?


a) stop
b) end
c) break
d) final
View Answer
Answer: d
Explanation: A final class cannot be subclassed.

10. PHP provides built-in interceptor methods, which can intercept messages sent to
undefined methods and properties. This is also known as _________
a) overloading
b) overriding
c) overbending
d) overbinding
View Answer
Answer: a

1. Which one of the following method is invoked when a value is assigned to an undefined
property?
a) __get()
b) __set()
c) __isset()
d) __call()
View Answer
Answer: b
Explanation: The __set() method is invoked when client code attempts to assign to an
undefined property. It is passed two arguments: the name of the property, and the value the
client is attempting to set.

2. Which one of the following method is invoked when an undefined method is called by
client code?
a) __get()
b) __isset()
c) __unset()
d) __call()
View Answer
Answer: d
Explanation: The __call() method is probably the most useful of all the interceptor methods.
The __call() method can be useful for delegation. Delegation is the mechanism by which
one object passes method invocations on to a second.

3. Which method introduced in PHP 5, is invoked just before an object is a garbage


collected?
a) __collect()
b) __garbage()
c) __destruct()
d) __destructor()
View Answer
Answer: c
Explanation: You can use this method to perform any final cleaning up that might be
necessary. Imagine, for example, a class that saves itself to a database when so ordered. I
could use the __destruct() method to ensure that an instance saves its data when it is
deleted.
advertisement

4. Which one of the following PHP statements is true?

1.class CopyMe {}
2.$first = new CopyMe();
3.$second = $first;

a) In PHP 4: $second and $first are 2 distinct objects


b) In PHP 5: $second and $first are 2 distinct objects
c) In PHP 4: $second and $first refer to one object
d) None of the mentioned
View Answer
Answer: a
Explanation: None.
5. Which keyword must be added before $first variable on the third line of the above
question to make $second and $first as distinct objects in PHP 5?
a) copy
b) clone
c) cut
d) Can’t add any word to make them distinct
View Answer
Answer: b
Explanation: Clone operates on an object instance, producing a by-value copy.

6. What will be the output of the following PHP code? (Before the version PHP 5.2)

1.class StringThing {}
2.$st = new StringThing();
3.print $st;

a) Object Not Found


b) Object id #1
c) PHP Catchable fatal error
d) Cannot initialize object
View Answer
Answer: b
Explanation: Since PHP 5.2, this code will produce an error like this: PHP Catchable fatal
error: Object of class StringThing could not be converted to string.

7. What will be the output of the following PHP code?

1.class Person
2.{
3. function getName() { return "Bob"; }
4. function getAge() { return 44; }
5. function __toString() {
6. $desc = $this->getName();
7. $desc .= " (age ".$this->getAge().")";
8. return $desc;
9. }
10. }
11. $person = new Person();
12. print $person;

a) Object Not Found


b) PHP Catchable fatal error
c) BOB (age 44)
d) BOB
View Answer
Answer: c
Explanation: By implementing a __toString() method, you can control how your objects
represent themselves when printed. The method is invoked automatically when your object
is passed to print or echo, and its return value is substituted.
8. __clone() is run on the ___ object.
a) original
b) pseudo
c) external
d) copied
View Answer
Answer: d
Explanation: __clone() is run on the copied object and not the original.

9. Which method is invoked when an undefined property is accessed?


a) __get()
b) __isset()
c) __unset()
d) __undefined()
View Answer
Answer: a
Explanation: None.

10. What will be the output of the following PHP code?

1.class Checkout
2. {
3. final function totalize()
4. {
5. // calculate bill
6. }
7. }
8. 
9.class IllegalCheckout extends Checkout
10. {
11. final function totalize()
12. {
13. // change bill calculation
14. }
15. }

a) PHP Fatal error: Class IllegalCheckout may not inherit from final class
b) Value of the bill calculated
c) PHP Fatal error: Cannot find object
d) PHP Fatal error: Cannot override final method
View Answer
Answer: d

1. A package is a set of related _________


a) Objects
b) Classes
c) Programs
d) Functions
View Answer
Answer: b
Explanation: A package is a set of related classes, usually grouped together in some way.
Packages can be used to separate parts of a system from one another.

2. Till which version of PHP, developers were forced to name their files in a global context?
a) PHP 4
b) PHP 5
c) PHP 5.2
d) PHP 5.3
View Answer
Answer: d
Explanation: If you named a class ShoppingBasket, it would become instantly available
across your system.

3. Which of the following can you place inside a namespace?

i) classes

ii) functions

iii) variables

advertisement

a) i)
b) ii)
c) iii)
d) i), ii) & iii)
View Answer
Answer: d
Explanation: A namespace is a bucket in which you can place your classes, functions and
variables.

4. Which one of the following is the correct way of declaring a namespace?


a) namespace my;
b) namespace my();
c) my namespace;
d) namespace(my);
View Answer
Answer: a
Explanation: The namespace declaration must be the first statement in its file.

5. Which symbol is used to declare nested namespaces?


a) /
b) \
c) .
d) |
View Answer
Answer: b
Explanation: Example – namespace com\getinstance\util;

6. Output:

namespace main;
com\getinstance\util\Debug::helloWorld()
PHP Fatal error: Class 'main\com\getinstance\util\Debug' not found in ...

Using which one of the following PHP lines will the error be removed?
a) \\com\getinstance\util\Debug::helloWorld();
b) getinstance\util\Debug::helloWorld();
c) main.com\getinstance\util\Debug::helloWorld();
d) \com\getinstance\util\Debug::helloWorld();
View Answer
Answer: d
Explanation: PHP is looking below the namespace main for com\getinstance\util and not
finding it. That’s because we are using a relative namespace here. Just as you can make
absolute URLs and filepaths by starting off with a separator so you can with namespaces.

7. Which keyword can be used to fix the following PHP error?

namespace main;
com\getinstance\util\Debug::helloWorld()
PHP Fatal error: Class 'main\com\getinstance\util\Debug' not found in ...

a) fix
b) join
c) use
d) namespace
View Answer
Answer: c
Explanation: Use keyword allows you to alias other namespaces within the current
namespace.
Example – namespace main;
use com\getinstance\util;

util\Debug::helloWorld();

8. If I already had a Debug class in the main namespace. What will be the output of the
following PHP code?

1.namespace main;
2.use com\getinstance\util\Debug;
3. 
4.class Debug {
5. static function helloWorld() {
6. print "hello from main\Debug";
7. }
8.}
9. 
10. Debug::helloWorld();

a) error
b) hello from main
c) hello from main\Debug
d) debug
View Answer
Answer: a
Explanation: PHP Fatal error: Cannot declare class main\Debug because the name is
already in use.

9. Which one of the following statements is true for include_once() and require_once()?
a) Both are exactly the same
b) include_once is used for files where as require_once() is not
c) Both Handle the errors in the same way
d) Both do not handle the errors in the same way
View Answer
Answer: d
Explanation: The only difference between the include() and require() statements lies in their
handling of errors. A file invoked using require() will bring down your entire process when
you meet an error. The same error encountered via a call to include() will merely generate a
warning and end execution of the included file.

10. Which one of the following statements is true for require() and require_once()?
a) They are functions
b) They are statements
c) They’ll not work if the () is not present
d) They can not be used to require files
View Answer
Answer: b

1. Which function was introduced to help automate the inclusion of class files?
a) __load()
b) __preload()
c) __autoload()
d) __inload()
View Answer
Answer: c
Explanation: When the PHP engine encounters an attempt to instantiate an unknown class,
it invokes the __autoload() function, passing it the class name as a string. It is up to the
implementer to define a strategy for locating and including the missing class file.

2. How many times can you define _________ autoload in a process?


a) once
b) twice
c) thrice
d) as many times as needed
View Answer
Answer: a
Explanation: __autoload is a powerful tool, but it does have some limitations. In particular,
you can only define it once in a process. If you need to change your autoload function
dynamically you should look at the spl_autoload_register function, which supports that
functionality.

3. Which one of the following functions will you use to check that the class exists before you
work with it?
a) class_exist()
b) class_exists()
c) exist()
d) exists_class()
View Answer
Answer: b
Explanation: The class_exists() function accepts a string representing the class to check for
and returns a Boolean true value if the class exists and false otherwise.
advertisement

4. Which one of the following will you use to check the class of an object?
a) class()
b) _class()
c) class_check()
d) get_class()
View Answer
Answer: d
Explanation: This function accepts any object as an argument and returns its class name as
a string.

5. PHP 4 did not support instanceof. Instead, which function did it provide?
a) is()
b) get_class()
c) is_a()
d) is_the()
View Answer
Answer: c
Explanation: As of PHP 5.3 is_a() no longer deprecated.

6. You use the get_class_methods() function to return the names of all the methods in the
class. Which function will you use to print it on the screen?
a) printf()
b) print_ar
c) print_r
d) echo
View Answer
Answer: c
Explanation: The function get_class_methods returns an array therefore we cannot use
echo.

7. If you call a method and it doesn’t exist it’ll cause a problem. To check the method which
function will you use?
a) _method()
b) methodexists()
c) is_callable()
d) is_method()
View Answer
Answer: c
Explanation: There is another method which you can use – method_exists() for similar
purpose.

8. What will be the output if a protected method is given as the argument to the function
method_exist()?
a) Method does not exist
b) False
c) Error
d) True
View Answer
Answer: d
Explanation: method_exists() returns true for private and protected methods as well as for
public ones. Remember that the fact that a method exists does not mean that it will be
callable.

9. Which one of the following function should I use to find the parent class of a class?
a) get_parent_class()
b) parent_class()
c) class_parent()
d) get_class_parent()
View Answer
Answer: a
Explanation: The class functions also allow us to chart inheritance relationships.This
function requires either an object or a class name, and it returns the name of the
superclass, if any. If no such class exists, that is, if the class we are testing does not have a
parent, then the function returns false.

10. Which class accepts a class name or an object reference and returns an array of
interface name?
a) class_implements()
b) is_subclass()
c) is_subclass_of()
d) class_interface()
View Answer
Answer: a

1. Object-oriented code tries to minimize dependencies by moving responsibility for


handling tasks away from ___ and toward the objects in the system.
a) server code
b) client code
c) machine code
d) procedural code
View Answer
Answer: b
Explanation: Procedural code takes the form of a sequential series of commands and
method calls. The controlling code tends to take responsibility for handling differing
conditions. This top-down control can result in the development of duplications and
dependencies across a project. Object-oriented code tries to minimize these dependencies
by moving responsibility for handling tasks away from client code and toward the objects in
the system.

2. Placing a static method for generating ________ objects in the ____________ class is
convenient.
a) child parent
b) parent child
c) final static
d) static final
View Answer
Answer: a
Explanation: Such a design decision does have its own consequences, however.

3. The extent to which proximate procedures are related to one another is known as
________
a) Coupling
b) Balancing
c) Cohesion
d) Co-relation
View Answer
Answer: c
Explanation: Ideally, you should create components that share a clear responsibility. If your
code spreads related routines widely, you will find them harder to maintain as you have to
hunt around to make changes. Our Param Handler classes collect related procedures into a
common context.
advertisement

4. ______ occurs when discrete parts of a system’s code are tightly bound up with one
another so that a change in one part necessitates changes in the others.
a) Loose Coupling
b) Tight Coupling
c) Co-relation
d) Balancing
View Answer
Answer: b
Explanation: Tight coupling is by no means unique to procedural code, though the
sequential nature of such code makes it prone to the problem.

5. ________ code makes change easier because the impact of altering an implementation
will be localized to the component being altered.
a) Orthogonal
b) Cohesion
c) Coupling
d) Balancing
View Answer
Answer: a
Explanation: Orthogonality, it is argued, promotes reuse in that components can be plugged
into new systems without needing any special configuration. Such components will have
clear inputs and outputs independent of any wider context.

6. Polymorphism is also known as______


a) switch
b) overact
c) encapsulation
d) class switching
View Answer
Answer: d
Explanation: Polymorphism is the maintenance of multiple implementations behind a
common interface.

7. Which one of the following is known as the key to object-oriented programming?


a) Polymorphism
b) Encapsulation
c) Data Abstraction
d) Orthogonality
View Answer
Answer: b
Explanation: Encapsulation simply means the hiding of data and functionality from a client.

8. Which one among the following means tight coupling?


a) Code Duplication
b) Inheritance
c) Encapsulation
d) Polymorphism
View Answer
Answer: a
Explanation: Duplication is one of the great evils in code. Take a look at the instances of
repetition in your system. Perhaps they belong together. If you change something
fundamental about one routine, will the similar routines need amendment? If this is the
case, they probably belong in the same class.

9. UML stands for?


a) unified mailing language
b) unified modeling logo
c) undefined modeling language
d) unified modeling language
View Answer
Answer: d
Explanation: The UML emerged as a standard only after long years of intellectual and
bureaucratic sparring among the great and good of the object oriented design community.

10. In a class diagram the class is divided into three sections, what is displayed in the first
section?
a) Class Attributes
b) Class Declaration
c) Class Name
d) Class Functions
View Answer
Answer: c

1. ________ are used in class diagrams to describe the way in which specific elements
should be used.
a) Attributes
b) Constraints
c) Constants
d) Class Names
View Answer
Answer: b
Explanation: The {abstract} syntax is an example of a constraint. There is no special
structure for the text between the braces; it should simply provide a short clarification of any
conditions that may apply to the element.

2. Which one of the following is displayed below the class name in the class diagrams?
a) Functions
b) Methods
c) Attributes
d) Constraints
view Answer
Answer: c
Explanation: Attributes describe a class’s properties. Attributes are listed in the section
directly beneath the class name.

3. + is the visibility code for?


a) Public
b) Private
c) Protected
d) Friendly
View Answer
Answer: a
Explanation: The visibility symbol is followed by the name of the attribute.
advertisement

4. Which relationship is illustrated by a line that begins with an unfilled diamond?


a) Composition
b) Abstraction
c) Aggregation
d) Inheritance
View Answer
Answer: c
Explanation: In the case of aggregation, the contained objects are a core part of the
container, but they can also be contained by other objects at the same time.
5. If the diamond is filled it depicts which relationship?
a) Strong Aggregation
b) Composition
c) Abstraction
d) Inheritance
View Answer
Answer: b
Explanation: In composition, the contained object can be referenced by its container only. It
should be deleted when the container is deleted.

6. Which one of the following statements is true about sequence diagrams?


a) A sequence diagram is class based
b) A sequence diagram presents the participants of a system from right to left
c) The vertical broken lines represent the lifetime of the class in the system
d) A sequence diagram is object based
View Answer
Answer: d
Explanation: A sequence diagram is object based rather than class based. It is used to
model a process in a system step by step.

7. A bidirectional relationship in class diagrams is described by________


a) double-headed arrow
b) visibility symbols
c) single-headed arrow
d) double diamond
View Answer
Answer: a
Explanation: A unidirectional association has single-headed arrow.

8. # is the visibility code for?


a) Private
b) Friendly
c) Protected
d) Static
View Answer
Answer: c
Explanation: Available to the current class and its subclasses only.

9. Which one of the following is displayed in the third section of the class diagram?
a) Operations
b) Inheritance
c) Abstraction
d) Coupling
View Answer
Answer: a
Explanation: Operations describe methods, or more properly, they describe the calls that
can be made on an instance of a class.

10. Inheritance in class diagrams is depicted by________


a) single-headed empty arrow
b) single-headed filled arrow
c) double-headed empty arrow
d) double-headed filled arrow
view Answer
Answer: a

1. What will be the output of the following PHP code?

1.<?php
2."Hello World"
3.?>

a) Error
b) Hello World
c) Nothing
d) Missing semicolon error
View Answer
Answer: c
Explanation: If you need to output something onto the screen you’ll need to use echo or
print_r.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.print_r "Hello world"
3.?>

a) Error
b) Hello World
c) Nothing
d) Missing semicolon error
View Answer
Answer: a
Explanation: The statement should be print_r(‘Hello World’) to print Hello world. Also if there
is only one line then there is no requirement of a semicolon, but it is better to use it.

3. What will be the output of the following PHP code?

1.<?php
2.echo 'Hello World';
3.<html>
4.Hello world
5.</html>
6.?>

a) Hello world
b) Hello World Hello World
c)
Hello world

Hello World

d) Syntax Error
View Answer
Answer: d
Explanation: Parse error: syntax error, unexpected ‘<‘ on line 2. You can not use the html
tag inside php tags.

4. What will be the output of the following PHP code?

1.<?php
2.Echo "Hello World1";
3.echo " Hello world2";
4.ECHO " Hello world3";
5.?>

a) Hello world1 Hello world2 Hello World3


b)

Hello world1

Hello world2

Hello World3

c) Error
d) Hello world1 Hello world3
View Answer
Answer: a
Explanation: In PHP, all user-defined functions, classes, and keywords (e.g. if, else, while,
echo, etc.) are case-insensitive.

5. What will be the output of the following PHP code?

1.<?php
2.$color = "red";
3.echo "$color";
4.echo "$COLOR";
5.echo "$Color";
6.?>

a) redredred
b) redred
c) red
d) Error
View Answer
Answer: c
Explanation: In PHP, all variables are case-sensitive.

6. What will be the output of the following PHP code?

1.<?php
2. # echo "Hello world";
3. echo "# Hello world";
4.?>

a) # Hello world
b) Hello world# Hello world
c) Hello world
d) Error
View Answer
Answer: a
Explanation: # is a single line comment.

7. What will be the output of the following PHP code?

1.<?php
2.echo "<i>Hello World</i>"
3.?>

a) Hello world
b) Hello world in italics
c) Nothing
d) Error
View Answer
Answer: b
Explanation: You can use tags like italics, bold etc. inside php script.

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

1.<?php
2.echo "echo "Hello World"";
3.?>

a) Hello world
b) echo “Hello world”
c) echo Hello world
d) Error
View Answer
Answer: d
Explanation: It would have printed echo “Hello world” if we have put backslash
doublequotes just before and just after Hello World string.

9. What will be the output of the following PHP code?

1.<?php
2.<?php
3.echo "Hello world";
4.?>
5.?>

a) HELLO WORLD
b) Hello world
c) Nothing
d) Error
View Answer
Answer: d
Explanation: You can not have php tags inside a php tag.

10. What will be the output of the following PHP code?

1.<?php
2.$color = red;
3.echo "\$color";
4.?>

a) red
b) $color
c) \red
d) Error
View Answer
Answer: b

1. What will be the output of the following PHP code?

1.<?php
2./*
3.echo "Hello world";
4.*/
5.?>

a) Hello world
b) Nothing
c) Error
d)

/*

Hello world

*/

View Answer
Answer: b
Explanation: /* */ is used for commenting multiple lines.
 
 
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$color = red;
3.echo "$color" . red ;
4.?>

a) red red
b) red
c) error
d) nothing
View Answer
Answer: c
Explanation: Use of undefined constant red.

3. What will be the output of the following PHP code?

1.<?php
2.$color1 = red;
3.$color2 = green;
4.echo "$color1"."$color2";
5.?>

a) red green
b) red
c) green
d) error
View Answer
Answer: d
Explanation: It has to be $color1 = “red”; and $color2 = “green”; therefore the error.

4. What will be the output of the following PHP code?

1.<?php
2.$color = "red";
3.$color = "green";
4.echo "$color";
5.?>

a) red
b) green
c) red green
d) error
View Answer
Answer: b
Explanation: The variable contains the last value which has been assigned.

5. What will be the output of the following PHP code?


1.<?php
2.$color1 = "red";
3.$color2 = "green";
4.echo "$color1" . "$color2";
5.?>

a) red
b) green
c) red green
d) redgreen
View Answer
Answer: d
Explanation: The . operator is used to join to strings.

6. What will be the output of the following PHP code?

1.<?php
2.$color1 = "red";
3.$color2 = "green";
4.echo "$color1" + "$color2";
5.?>

a) redgreen
b) red green
c) 0
d) error
View Answer
Answer: c
Explanation: + operator does not join both the strings.

7. What will be the output of the following PHP code?

1.<?php
2.$color1 = "red";
3.$color2 = "red";
4.echo "$color1" + "$color2";
5.?>

a) redgreen
b) red green
c) 0
d) 1
View Answer
Answer: c
Explanation: + does not return 1 if the variables are equal.

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

1.<?php
2.$color1 = "red";
3.$color2 = "1";
4.echo "$color1" + "$color2";
5.?>

a) red1
b) red 1
c) 0
d) 1
View Answer
Answer: d
Explanation: + just returns the numeric value even though it is inside double quotes.

9. What will be the output of the following PHP code?

1.<?php
2.$color1 = "1";
3.$color2 = "1";
4.echo "$color1" + "$color2";
5.?>

a) 11
b) 2
c) 0
d) 1
View Answer
Answer: b
Explanation: + can be used to add to integer values which are enclosed by double-quotes.

10. What will be the output of the following PHP code?

1.<?php
2.$color1 = "red";
3.$color2 = "1";
4.$color3 = "grey"
5.echo "$color1" + "$color2" . "$color3";
6.?>

a) 1grey
b) grey
c) 0
d) red1grey
View Answer
Answer: a

1. What will be the output of the following PHP code?

1.<?php
2.$x = 5;
3.$y = 10;
4.$z = "$x + $y";
5.echo "$z";
6.?>
a) 15
b) 10 + 5
c) $z
d) $x + $y
View Answer
Answer: b
Explanation: Variable z will store 10 + 5 because 10 + 5 is given in double-quotes.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$x = 4;
3.$y = 3;
4.$z = 1;
5.echo "$x = $x + $y + $z";
6.?>

a) 4 = 4 + 3 + 1
b) 8
c) 8 = 4 + 3 +1
d) Error
View Answer
Answer: a
Explanation: Again since the variables are inside double quotes we get this result.

3. What will be the output of the following PHP code?

1.<?php
2.$x = 4;
3.$y = 3
4.$z = 1;
5.$z = $z + $x + $y;
6.echo "$z";
7.?>

a) $z
b) 15
c) 8
d) 1
View Answer
Answer: c
Explanation: Normal addition of variables x, y and z occurs and result of 8 will be displayed.

4. What will be the output of the following PHP code?

1.<?php
2.$x = 3.3;
3.$y = 2;
4.echo $x % $y;
5.?>
a) 0
b) 1
c) 2
d) Error
View Answer
Answer: b
Explanation: % is the modulo operator. Unlike in C we can use it get reminder or floating
point numbers in PHP.

5. What will be the output of the following PHP code?

1.<?php
2.$x = 10;
3.$y = 4;
4.$z = 3;
5.echo $x % $y % $z;
6.?>

a) 0
b) 1
c) 2
d) Error
View Answer
Answer: c
Explanation: The expression is considered as ($x%$y)%z in this case (10%4)%3 which is 2.

6. What will be the output of the following PHP code?

1.<?php
2.$x = 10;
3.$y = 4;
4.$z = 3;
5.echo ($x % ($y) + $z);
6.?>

a) 5
b) 3
c) 0
d) 1
View Answer
Answer: a
Explanation: The innermost bracket is evaluated first, since it covers only variable y it is as
good as not using brackets.

7. What will be the output of the following PHP code?

1.<?php
2.$x = 30;
3.$y = 20;
4.$z = 10;
5.echo $x + $y - $z / ($z - $y);
6.?>
a) 41
b) -4
c) -5
d) 51
View Answer
Answer: d
Explanation: First ($z – $y) is evaluated then -$z/($z – $y) is evaluated this results in 1
which is added to $x + $y therefore we get 51.

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

1.<?php
2.$x = -1;
3.$y = 1;
4.$z = $x * $y + $z;
5.echo $z;
6.?>

a) Undefined variable z
b) -1
c)

Undefined variable z

-1

d) None of the mentioned


View Answer
Answer: c
Explanation: Since the variable z is not defined it returns the error also it takes z as 0 and
returns the value -1.

9. What will be the output of the following PHP code?

1.<?php
2.$x = 4;
3.$y = -3;
4.$z = 11;
5.echo 4 + $y * $z / $x;
6.?>

a) 4.25
b) 3.25
c) -3.25
d) -4.25
View Answer
Answer: d
Explanation: First the * is evaluated then / followed by + therefore we can rewrite this
expression as 4 +((- 3 * 11) / 4) which results in -4.25.
10. What will be the output of the following PHP code?

1.<?php
2.$x = 3.5;
3.$y = 2;
4.$z = 2;
5.echo $x / $y / $z;
6.?>

a) 1.75
b) 0.875
c) 3.5
d) Error
View Answer
Answer: b

1. What will be the output of the following PHP code?

1.<?php
2.one = 1;
3.two = 2;
4.three = 3;
5.four = 4;
6.echo "one / two + three / four";
7.?>

a) 0.75
b) 0.05
c) 1.25
d) Error
View Answer
Answer: d
Explanation: Variables should start with a $ symbol, since one, two, three, four don’t begin
with $ symbol we’ll get an error.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$on$e = 1;
3.$tw$o = 2;
4.$thre$e = 3;
5.$fou$r = 4;
6.echo "$on$e / $tw$o + $thre$e / $fou$r";
7.?>

a) 0.75
b) 0.05
c) 1.25
d) Error
View Answer
Answer: d
Explanation: You can not use the $ in between the variable name.

3. What will be the output of the following PHP code?

1.<?php
2.$on_e = 1;
3.$tw_o = 2;
4.$thre_e = 3;
5.$fou_r = 4;
6.echo $on_e / $tw_o + $thre_e / $fou_r;
7.?>

a) 0.75
b) 0.05
c) 1.25
d) Error
View Answer
Answer: c
Explanation: You can use _ in a variable name.

4. What will be the output of the following PHP code?

1.<?php
2.$On_e = 1;
3.$tw_o = 2;
4.$thre_e = 3;
5.$fou_r = 4;
6.echo $on_e / $tw_o + $thre_e / $fou_r;
7.?>

a) 0.75
b) 0.05
c) 1.25
d) Error
View Answer
Answer: a
Explanation: Since the variable initialised is $On_e and the variable in the echo statement is
$on_e the echo statement treats $on_e as 0;

5. What will be the output of the following PHP code?

1.<?php
2.echo $red;
3.?>

a) 0
b) Nothing
c) True
d) Error
View Answer
Answer: b
Explanation: There will no output returned as the variable $red does not hold any value.

6. What will be the output of the following PHP code?

1.<?php
2.$four4 = 4;
3.$three3 = 3;
4.$two2 = 2;
5.echo $four4 + $three3 / $two2 - 1;
6.?>

a) 4.5
b) 7
c) 3.5
d) Error
View Answer
Answer: a
Explanation: You can use numbers in a variable name.

7. What will be the output of the following PHP code?

1.<?php
2.$4four = 4;
3.$3three = 3;
4.$2two = 2;
5.echo $4four + $3three / $2two - 1;
6.?>

a) 4.5
b) 7
c) 3.5
d) Error
View Answer
Answer: d
Explanation: A variable name can not start with a numeric value.

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

1.<?php
2.int $one = 1;
3.echo "$one";
4.?>

a) 0
b) 1
c) $one
d) Error
View Answer
Answer: d
Explanation: Unlike other programming languages there are no data types in PHP.
9. What will be the output of the following PHP code?

1.<?php
2.var $one = 1;
3.var $two = 2;
4.echo $one / $two * $one / $two * $two;
5.?>

a) 1
b) 0
c) 0.5
d) Error
View Answer
Answer: d
Explanation: You can not use var before a variable name.

10. What will be the output of the following PHP code?

1.<?php
2.$hello = "Hello World";
3.$bye = "Bye";
4.echo $hello;"$bye";
5.?>

a) Hello World
b) Bye
c) Hello worldBye
d) Error
View Answer
Answer: a

This set of PHP Problems focuses on “Variables – 3”.

1. What will be the output of the following PHP code?

1.<?php
2.$x;
3.echo "$x";
4.?>

a) 0
b) 1
c) Nothing
d) Error
View Answer
Answer: c
Explanation: Since the variable x is not initialised it is not storing any value, therefore
nothing will be printed on the screen.
advertisement
2. What will be the output of the following PHP code?

1.<?php
2.$x = 5;
3.{
4. $x = 10;
5. echo "$x";
6.}
7.echo "$x";
8.?>

a) 1010
b) 105
c) 510
d) error
View Answer
Answer: a
Explanation: Variable x stores the value 10 and not 5.

3. What will be the output of the following PHP code?

1.<?php
2.$x = 5;
3.{
4. echo "$x";
5.}
6.?>

a) 0
b) 5
c) Nothing
d) Error
View Answer
Answer: b
Explanation: The variable x stores the value 5 and therefore the value 5 is printed on the
screen.

4. What will be the output of the following PHP code?

1.<?php
2.$x = 5;
3.function fun()
4.{
5. echo "$x";
6.}
7.fun();
8.?>

a) 0
b) 5
c) Nothing
d) Error
View Answer
Answer: c
Explanation: The variable x is not defined inside the function fun(), therefore nothing is
printed on the screen.

5. What will be the output of the following PHP code?

1.<?php
2.$x = 5;
3.function fun()
4.{
5. $x = 10;
6. echo "$x";
7.}
8.fun();
9.echo "$x";
10. ?>

a) 0
b) 105
c) 510
d) Error
View Answer
Answer: b
Explanation: First when the function is called variable x is initialised to 10 so 10 is printed
later the global value 5 is printed.

6. What will be the output of the following PHP code?

1.<?php
2.$x = 4;
3.$y = 3;
4.function fun($x = 3, $y = 4)
5.{
6. $z = $x+$y/$y+$x;
7. echo "$z";
8.}
9.echo $x;
10. echo $y;
11. echo $z;
12. fun($x, $y);
13. ?>

a) 43
b) 943
c) 349
d) 439
View Answer
Answer: d
Explanation: Firstly, the statements outside the function are printed, since z is not defined
it’ll no value is printed for z. Next the function is called and the value of z inside the function
is printed.

7. What will be the output of the following PHP code?

1.<?php
2.$x = 4;
3.$y = 3;
4.function fun($x, $y)
5.{
6. $z = $x + $y / $y + $x;
7. echo "$z";
8.}
9.echo $x;
10. echo $y;
11. echo $z;
12. fun(3, 4);
13. ?>

a) 437
b) 439
c) 349
d) 347
View Answer
Answer: a
Explanation: It is same as above but the value passed into the function is 3,4 and not 4,3.
Therefore the difference in answer.

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

1.<?php
2.function fun($x,$y)
3.{
4. $x = 4;
5. $y = 3;
6. $z = $x + $y / $y + $x;
7. echo "$z";
8.}
9.fun(3, 4);
10. ?>

a) 7
b) 9
c) 0
d) Error
View Answer
Answer: b
Explanation: Value 3, 4 is passed to the function but that is lost because x and y are
initialised to 4 and 3 inside the function. Therefore we get the given result.

9. What will be the output of the following PHP code?


1.<?php
2.$x = 3, 4, 5, 6;
3.echo "$x";
4.?>

a) 3
b) 4
c) 6
d) Error
View Answer
Answer: d
Explanation: In C you won’t get an error but in PHP you’ll get a syntax error.

10. What will be the output of the following PHP code?

1.<?php
2.$a = 10;
3.$b = 4;
4.$c = fun(10,4);
5.function fun($a,$b)
6.{
7. $b = 3;
8. return $a - $b + $b - $a;
9.}
10. echo $a;
11. echo $b;
12. echo $c;
13. ?>

a) 104
b) 410
c) 1400
d) 4100
View Answer
Answer: c

1. What will be the output of the following PHP code?

1.<?php
2.print "echo hello world";
3.?>

a) echo hello world


b) hello world
c) nothing
d) error
View Answer
Answer: a
Explanation: The print statement will print whatever is present inside the double-quotes.
advertisement

2. What will be the output of the following PHP code?


1.<?php
2.$one = 1;
3.print($one);
4.print $one;
5.?>

a) 01
b) 11
c) 10
d) Error
View Answer
Answer: b
Explanation: Print can be used with or without parentheses.

3. What will be the output of the following PHP code?

1.<?php
2.$cars = array("Volvo", "BMW", "Toyota");
3.print $cars[2];
4.?>

a) Volvo
b) BMW
c) Toyota
d) Error
View Answer
Answer: c
Explanation: Print statement can be used to output a specific array member.

4. What will be the output of the following PHP code?

1.<?php
2.$one = "one";
3.$two = "two";
4.print($one$two);
5.?>

a) onetwo
b) one
c) nothing
d) error
View Answer
Answer: d
Explanation: The above syntax will produce an error, unlike the echo statement.

5. What will be the output of the following PHP code?

1.<?php
2.$one = "one";
3.$two = "two";
4.print($one,$two);
5.?>
a) onetwo
b) one, two
c) one
d) error
View Answer
Answer: d
Explanation: The above syntax will produce an error, unlike the echo statement.

6. What will be the output of the following PHP code?

1.<?php
2.$one = "one";
3.$two = "two";
4.print("$one$two");
5.?>

a) onetwo
b) $one$two
c) one
d) error
View Answer
Answer: a
Explanation: This is same as the echo statement.

7. What will be the output of the following PHP code?

1.<?php
2.$one = "one";
3.$two = "two";
4.print($one==$two);
5.?>

a) true
b) false
c) nothing
d) error
View Answer
Answer: c
Explanation: Since we are equating two unequal strings we do not get any output.

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

1.<?php
2.$one = "one";
3.$two = "one";
4.print($one == $two);
5.?>

a) true
b) false
c) 1
d) error
View Answer
Answer: c
Explanation: Since both the strings are equal the result 1 is printed on the screen.

9. What will be the output of the following PHP code?

1.<?php
2.print "Hello world!<br>";
3.print "I'm about to learn PHP!";
4.?>

a) Hello world!
I’m about to learn PHP!
b) Hello world! I’m about to learn PHP!
c)

Hello world!

I'm about to learn PHP!

d) Error
View Answer
Answer: c
Explanation: Most of the properties of echo and print are same. Strings can contain HTML
markup.

10. What will be the output of the following PHP code?

1.<?php
2.print("this"."was"."a"."bad"."idea");
3.?>

a) thiswasabadidea
b) this was a bad idea
c) nothing
d) error
View Answer
Answer: a

1. What will be the output of the following PHP code?

1.<?php
2.echo 5 * 9 / 3 + 9;
3.?>

a) 24
b) 3.7
c) 3.85
d) 0
View Answer
Answer: a
Explanation: Operator precedence order must be followed.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.echo 5 * 9 / 3 + 9
3.?>

a) 24
b) 3.7
c) 3.85
d) 0
View Answer
Answer: a
Explanation: Operator precedence order must be followed.

3. What will be the output of the following PHP code?

1.<?php
2.$i = 0;
3.$j = 0;
4.if ($i && ($j = $i + 10)) {
5. echo "true";
6.}
7.echo $j;
8.?>

a) 10
b) 0
c) true0
d) true10
View Answer
Answer: b
Explanation: In if condition when the first case is 0 and is an && operation then the second
command is not executed.

4. What will be the output of the following PHP code?

1.<?php
2.$i = 10;
3.$j = 0;
4.if ($i || ($j = $i + 10)) {
5. echo "true";
6.}
7.echo $j;
8.?>
a) 20
b) true0
c) 0
d) true20
View Answer
Answer: b
Explanation: In if condition when the first case is 1 and is an || operation then the second
command is not executed.

5. What will be the output of the following PHP code?

1.<?php
2.$i = 1;
3.if ($i++ && ($i == 1))
4. printf("Yes\n$i");
5.else
6. printf("No\n$i");
7.?>

a) No 2
b) Yes 1
c) Yes 2
d) No 1
View Answer
Answer: a
Explanation: The first condition returns true and increments but the second condition is
false.

6. What will be the output of the following PHP code?

1.<?php
2.$a = 1; $b = 3;
3.$d = $a++ + ++$b;
4.echo $d;
5.?>

a) 5
b) 4
c) 3
d) error
View Answer
Answer: a
Explanation: Post increment of a is done after expression evaluation.

7. What will be the output of the following PHP code?

1.<?php
2.$a = 1; $b = 1; $d = 1;
3.print ++$a + ++$a+$a++; print $a++ + ++$b; print ++$d + $d++ + $a++;
4.?>
a) 869
b) 742
c) 368
d) error
View Answer
Answer: a
Explanation: Follow the order of post and pre increments.

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

1.<?php
2.$a = 10; $b = 10;
3.if ($a = 5)
4. $b--;
5.print $a;print $b--;
6.?>

a) 58
b) 59
c) 109
d) 108
View Answer
Answer: b
Explanation: a is set to 5 in the if condition and b is post decremented in the print statement.

9. What will be the output of the following PHP code?

1.<?php
2.$i = 0;
3.$x = $i++; $y = ++$i;
4.print $x; print $y;
5.?>

a) 02
b) 12
c) 01
d) 21
View Answer
Answer: a
Explanation: First case i is incremented after setting x to i.

10. What will be the output of the following PHP code?

1.<?php
2. $a = 5; $b = -7; $c =0;
3. $d = ++$a && ++$b || ++$c;
4. print $d; print $a;
5.?>

a) 16
b) 06
c) 15
d) 05
View Answer
Answer: a
Explanation: 1&&0||1 is evaluated to 1 and the a is also preincremented to 6.

11. What will be the output of the following PHP code?

1.<?php
2.$b = 1; $c = 4; $a = 5;
3.$d = $b + $c == $a;
4.print $d;
5.?>

a) 5
b) 0
c) 10
d) 1
View Answer
Answer: d

1. What will be the output of the following PHP code?

1.<?php
2.echo 5 * 9 / 3 + 9;
3.?>

a) 24
b) 3.7
c) 3.85
d) 0
View Answer
Answer: a
Explanation: Operator precedence order must be followed.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$var1 = 1 + ++5;
3.echo $var1;
4.?>

a) no output
b) error
c) 6
d) 7
View Answer
Answer: b
Explanation: Operator ++ can be done only on variables.

3. What will be the output of the following PHP code?


1.<?php
2.$var1 = 0;
3.$var1 = ($var1 + 5)++;
4.echo $var1;
5.?>

a) 5
b) error
c) 6
d) 7
View Answer
Answer: b
Explanation: Operator ++ can be done only on variables.

4. What will be the output of the following PHP code?

1.<?php
2.$var1 = 0;
3.$var1 = $var1++ + 5;
4.echo $var1;
5.?>

a) 5
b) error
c) 6
d) 7
View Answer
Answer: a
Explanation: Operator precedence followed.

5. What will be the output of the following PHP code?

1.<?php
2.$var1 = 0;
3.$var1 = ++$var1 + 5;
4.echo $var1;
5.?>

a) 5
b) error
c) 6
d) 7
View Answer
Answer: c
Explanation: Operator precedence followed.

6. What will be the output of the following PHP code?

1.<?php
2.$var1 = 0;
3.$var1 = $var1 + 5;
4.echo $var1++;
5.?>

a) 5
b) error
c) 6
d) 7
View Answer
Answer: a
Explanation: Operator precedence followed,incremented after display.

7. What will be the output of the following PHP code?

1.<?php
2.$var1 = 1;
3.echo $var1 = ++$var1 % 2 + ++$var1;
4.?>

a) 1
b) 0
c) 2
d) 3
View Answer
Answer: d
Explanation: Evaluation done from right to left.

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

1.<?php
2. $a = 5;$b = -7;$c =0;
3. $d = ++$a && ++$b || ++$c;
4. print $d;print $a;
5.?>

a) 16
b) 06
c) 15
d) 05
View Answer
Answer: a
Explanation: 1&&0||1 is evaluated to 1 and the a is also pre incremented to 6.

9. What will be the output of the following PHP code?

1.<?php
2.$var1 = 3;
3.print $var = ++$var;
4.?>

a) 1
b) 0
c) 2
d) 3
View Answer
Answer: a
Explanation: $var = ++$var returns 1(success).

10. What will be the output of the following PHP code?

1.<?php
2.$var1 = 3;
3.print ++$var++;
4.?>

a) 3
b) 4
c) 5
d) error
View Answer
Answer: d

1. What will be the output of the following PHP code?

1.<?php
2.$i = 0; $j = 1; $k = 2;
3.print !(($i + $k) < ($j - $k));
4.?>

a) 1
b) true
c) false
d) 0
View Answer
Answer: a
Explanation: True is 1.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$i = 0;$j = 1;$k = 2;
3.print !(( + + $i + $j) > ($j - $k));
4.?>

a) 1
b) no output
c) error
d) 0
View Answer
Answer: b
Explanation: The equation outputs false .

3. What will be the output of the following PHP code?


1.<?php
2.$i = 0;$j = 1;$k = 2;
3.print (( + + $i + $j) >! ($j - $k));
4.?>

a) 1
b) no output
c) error
d) 0
View Answer
Answer: a
Explanation: Negation of a number is 0.

4. What will be the output of the following PHP code?

1.<?php
2.$a = 0x6db7;
3.print $a<<6;
4.?>

a) 1797568
b) no output
c) error
d) 0x6dc0
View Answer
Answer: a
Explanation: The output is in decimal.

5. What will be the output of the following PHP code?

1.<?php
2.$a = 'a' ;
3.print $a * 2;
4.?>

a) 192
b) 2
c) error
d) 0
View Answer
Answer: d
Explanation: Characters cannot be multiplied.

6. What will be the output of the following PHP code?

1.<?php
2.$a = '4' ;
3.print + + $a;
4.?>

a) no output
b) error
c) 5
d) 0
View Answer
Answer: c
Explanation: The character is type casted to integer before multiplying.

7. What will be the output of the following PHP code?

1.<?php
2.$a = '12345';
3.print "qwe{$a}rty";
4.?>

a) qwe12345rty
b) qwe{$a}rty
c) error
d) no output
View Answer
Answer: a
Explanation: {$}dereferences the variable within.

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

1.<?php
2.$a = '12345';
3.print "qwe".$a."rty";
4.?>

a) qwe12345rty
b) qwe$arty
c) error
d) no output
View Answer
Answer: a
Explanation: . dereferences the variable/string within.

9. What will be the output of the following PHP code?

1.<?php
2.$a = '12345';
3.echo 'qwe{$a}rty';
4.?>

a) qwe12345rty
b) qwe{$a}rty
c) error
d) no output
View Answer
Answer: b
Explanation: qwe{$a}rty, single quotes are not parsed.
10. What will be the output of the following PHP code?

1.<?php
2.$a = '12345';
3.echo "qwe$arty";
4.?>

a) qwe12345rty
b) qwe$arty
c) qwe
d) error
View Answer
Answer: c

1. What will be the output of the following PHP code?

1.<?php
2.$x;
3.if ($x)
4. print "hi" ;
5.else
6. print "how are u";
7.?>

a) how are u
b) hi
c) error
d) no output
View Answer
Answer: a
Explanation: Uninitialized x is set to 0, thus if condition fails.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$x = 0;
3.if ($x++)
4. print "hi";
5.else
6. print "how are u";
7.?>

a) hi
b) no output
c) error
d) how are u
View Answer
Answer: d
Explanation: x is incremented after if which evaluates to false.
3. What will be the output of the following PHP code?

1.<?php
2.$x;
3.if ($x == 0)
4. print "hi" ;
5.else
6. print "how are u";
7. print "hello"
8.?>

a) how are uhello


b) hihello
c) hi
d) no output
View Answer
Answer: b
Explanation: else condition without brackets performs the following statements only.

4. What will be the output of the following PHP code?

1.<?php
2.$x = 0;
3.if ($x == 1)
4. if ($x >= 0)
5. print "true";
6. else
7. print "false";
8.?>

a) true
b) false
c) error
d) no output
View Answer
Answer: d
Explanation: The nested for loop is not entered if outer condition is false.

5. What will be the output of the following PHP code?

1.<?php
2.$a = 1;
3.if ($a--)
4. print "True";
5.if ($a++)
6. print "False";
7.?>

a) true
b) false
c) error
d) no output
View Answer
Answer: a
Explanation: Due to post increment and post decrement only the first condition is satisfied.

6. What will be the output of the following PHP code?

1.<?php
2.$a = 1;
3.if (echo $a)
4. print "True";
5.else
6. print "False";
7.?>

a) true
b) false
c) error
d) no output
View Answer
Answer: c
Explanation: echo does not return anything so if condition is empty.

7. What will be the output of the following PHP code?

1.<?php
2.$a = 1;
3.if (print $a)
4. print "True";
5.else
6. print "False";
7.?>

a) true
b) false
c) error
d) no output
View Answer
Answer: a
Explanation: print returns 1 if it prints anything.

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

1.<?php
2.$a = 10;
3.if (1)
4. print "all";
5.else
6. print "some"
7.else
8. print "none";
9.?>
a) all
b) some
c) error
d) none
View Answer
Answer: c
Explanation: Hanging else statement.

9. What will be the output of the following PHP code?

1.<?php
2.$a = 10;
3.if (0)
4. print "all";
5. if
6. else
7. print "some"
8.?>

a) all
b) some
c) error
d) no output
View Answer
Answer: c
Explanation: No else statement to end the if statement.

10. What will be the output of the following PHP code?

1.<?php
2.$a = "";
3.if ($a)
4. print "all";
5.if
6.else
7. print "some";
8.?>

a) all
b) some
c) error
d) no output
View Answer
Answer: b
Explanation: Empty string is evaluated to 0.

11. What will be the output of the following PHP code?

1.<?php
2.$a = "a";
3.if ($a)
4. print "all";
5.else
6. print "some";
7.?>

a) all
b) some
c) error
d) no output
View Answer
Answer: a

1. What will be the output of the following PHP code?

1.<?php
2.$x = 10;
3.$y = 20;
4.if ($x > $y + $y != 3)
5. print "hi" ;
6.else
7. print "how are u";
8.?>

a) how are u
b) hi
c) error
d) no output
View Answer
Answer: b
Explanation: Expression evaluates to true.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$x = 10;
3.$y = 20;
4.if ($x > $y && 1||1)
5. print "hi" ;
6.else
7. print "how are u";
8.?>

a) how are u
b) hi
c) error
d) no output
View Answer
Answer: b
Explanation: Expression evaluates to true.

3. What will be the output of the following PHP code?


1.<?php
2.$x = 10;
3.$y = 20;
4.if ($x > $y && 1||1)
5. print "hi" ;
6.else
7. print "how are u";
8.?>

a) how are u
b) hi
c) error
d) no output
View Answer
Answer: b
Explanation: Expression evaluates to true.

4. What will be the output of the following PHP code?

1.<?php
2.if (-100)
3. print "hi" ;
4.else
5. print "how are u";
6.?>

a) how are u
b) hi
c) error
d) no output
View Answer
Answer: b
Explanation: Expression evaluates to true.

5. What will be the output of the following PHP code?

1.<?php
2.if (0.1)
3. print "hi" ;
4.else
5. print "how are u";
6.?>

a) how are u
b) hi
c) error
d) no output
View Answer
Answer: b
Explanation: Expression evaluates to true.

6. What will be the output of the following PHP code?


1.<?php
2.if (0.0)
3. print "hi" ;
4.else
5. print "how are u";
6.?>

a) how are u
b) hi
c) error
d) no output
View Answer
Answer: a
Explanation: Expression evaluates to false.

7. What will be the output of the following PHP code?

1.<?php
2.if (print "0")
3. print "hi" ;
4.else
5. print "how are u";
6.?>

a) 0how are u
b) 0hi
c) hi
d) how are u
View Answer
Answer: b
Explanation: Expression evaluates to true as print returns 1.

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

1.<?php
2.$x = 1;
3.if ($x == 2)
4. print "hi" ;
5.else if($x = 2)
6. print $x;
7.else
8. print "how are u";
9.?>

a) error
b) 2
c) hi
d) how are u
View Answer
Answer: b
Explanation: Enters if else as first condition is false and thus x is set to 2.

9. What will be the output of the following PHP code?


1.<?php
2.$x = 1;
3.if ($x = $x&0)
4. print $x ;
5.else
6. print "how are u";
7.?>

a) 0
b) 1
c) error
d) how are u
View Answer
Answer: d
Explanation: x&0 is 0,thus evaluated to false.

10. What will be the output of the following PHP code?

1.<?php
2.$x = 1;
3.if ($x = $x&0)
4. print $x ;
5.else
6. print "how are u";
7.?>

a) 0
b) 1
c) error
d) how are u
View Answer
Answer: d
Explanation: x&0 is 0,thus evaluated to false.

11. What will be the output of the following PHP code?

1.<?php
2.$x = 1;
3.if ($x = $x&0)
4. print $x;
5.else
6. break;
7.?>

a) 0
b) 1
c) error
d) no output
View Answer
Answer: c
Explanation: break is not defined for a if else ladder.

12. What will be the output of the following PHP code?


1.<?php
2.$a = 100;
3.if ($a > 10)
4. printf("M.S. Dhoni");
5.else if ($a > 20)
6. printf("M.E.K Hussey");
7.else if($a > 30)
8. printf("A.B. de villiers");
9.?>

a) M.S.Dhoni
b) M.E.K.Hussey
c)

M.S.Dhoni

M.E.K.Hussey

A.B.de villiers

d) No output
View Answer
Answer: a

1. What will be the output of the following PHP code?

1.<?php
2.$x = 10;
3.$y = 5;
4.$z = 3;
5.if ($x / $y / $z)
6. print "hi";
7.else
8. print "hello";
9.?>

a) hi
b) hello
c) error
d) no output
View Answer
Answer: a
Explanation: In php division returns a float that is a non zero value thus evaluates to true.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.if (!print "hi")
3. if (print "hello")
4.print "hi";
5.?>

a) hi
b) hihellohi
c) hihi
d) no output
View Answer
Answer: a
Explanation: Print returns true and thus the first if statement also is not executed.

3. What will be the output of the following PHP code?

1.<?php
2.if (print "hi" - 1)
3. print "hello"
4.?>

a) hi
b) hihello
c) error
d) no output
View Answer
Answer: c
Explanation: print returns true and when 1 is subtracted it is syntax error.

4. What will be the output of the following PHP code?

1.<?php
2.$x = 1;
3.if ($x--)
4. print "hi"
5. $x--;
6.else
7. print "hello"
8.?>

a) hi
b) hello
c) error
d) no output
View Answer
Answer: c
Explanation: The if statement has no brackets and it expects a else/else if after a if.

5. What will be the output of the following PHP code?

1.<?php
2.$a = 10;
3.$b = 11;
4.if ($a < ++$a || $b < ++$b)
5. print "hello";
6.else
7. print "hi";
8.?>

a) hi
b) hello
c) error
d) no output
View Answer
Answer: a
Explanation: The operator precedence of ++ is higher than <, thus the increment happens
first and then compared.

6. What will be the output of the following PHP code?

1.<?php
2.$a = 2;
3.if ($a-- - --$a - $a)
4. print "hello";
5.else
6. print "hi";
7.?>

a) hi
b) hello
c) error
d) no output
View Answer
Answer: b
Explanation: Computing the expression in the if clause,it sums upto to 2 which is a positive
value.

7. What will be the output of the following PHP code?

1.<?php
2.$a = 2;
3.if ($a-- - --$a - $a)
4. print "hello";
5.else
6. print "hi";
7.?>

a) hi
b) hello
c) error
d) no output
View Answer
Answer: b
Explanation: Computing the expression in the if clause, it sums upto to 2 which is a positive
value.

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


1.<?php
2.$a = "hello";
3.if ($a.length)
4. print $a.length;
5.else
6. print "hi";
7.?>

a) hellolength
b) 5
c) hi
d) error
View Answer
Answer: a
Explanation: The . operator appends a string and returns true.

9. What will be the output of the following PHP code?

1.<?php
2.$a = "hello";
3.if (strlen($a))
4. print strlen($a);
5.else
6. print "hi";
7.?>

a) hellolength
b) 5
c) hi
d) error
View Answer
Answer: b
Explanation: The function strlen($a) gives the length of the string, 5, which is considered
true.

10. What will be the output of the following PHP code?

1.<?php
2.$a = "1";
3.$b = "0";
4.if ((int)$a && $b)
5. print"hi";
6.else
7. print "hello";
8.?>

a) hello
b) no output
c) hi
d) error
View Answer
Answer: a
1. What will be the output of the following PHP code?

1.<?php
2.$a = "1";
3.switch ($a)
4.{
5.case 1:
6. print "hi";
7.case 2:
8. print "hello";
9.default:
10. print "hi1";
11. }
12. ?>

a) hihellohi1
b) hi
c) hihi1
d) hi1
View Answer
Answer: a
Explanation: As break is not provided it executes all the cases.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$a = "2";
3.switch ($a)
4.{
5.case 1:
6. print "hi";
7.case 2:
8. print "hello";
9. break;
10. default:
11. print "hi1";
12. }
13. ?>

a) hihellohi1
b) hello
c) hihi1
d) hi1
View Answer
Answer: b
Explanation: As hello is provided after case2 it breaks the loop.

3. What will be the output of the following PHP code?

1.<?php
2.$a = "1";
3.switch($a)
4.{
5.case 1:
6. break;
7. print "hi";
8.case 2:
9. print "hello";
10. break;
11. default:
12. print "hi1";
13. }
14. ?>

a) hihellohi1
b) no output
c) hihi1
d) hi1
View Answer
Answer: b
Explanation: As break is provided before print statement in case 2 it breaks the loop before
printing.

4. What will be the output of the following PHP code?

1.<?php
2.$a = "1";
3.$a = 1;
4.$b = 1;
5.switch($a)
6.{
7.case $a * $b:
8. print "hi";
9. break;
10. case $a / $b:
11. print "hello";
12. break;
13. default:
14. print "hi1";
15. }
16. ?>

a) hihellohi1
b) hi
c) hihello
d) hi1
View Answer
Answer: b
Explanation: It checks the first case, when it finds it equal it will perform it breaks out.

5. What will be the output of the following PHP code?

1.<?php
2.$a = 97;
3.switch($a)
4.{
5.case "a":
6. print "hi";
7. break;
8.case 97:
9. print "hello";
10. break;
11. default:
12. print "hi1";
13. }
14. ?>

a) hihellohi1
b) hi
c) hihello
d) hello
View Answer
Answer: d
Explanation: Downcasting does not happen in case, it compares only with its data type.

6. What will be the output of the following PHP code?

1.<?php
2.$b = 1;
3.switch($b)
4.{
5.case 1.0:
6. print "hi";
7. break;
8.case 1:
9. print "hello";
10. break;
11. default:
12. print "hi1";
13. }
14. ?>

a) hihellohi1
b) hi
c) hihello
d) hello
View Answer
Answer: a
Explanation: Upcasting does happen in case, it compares it with 1.0 and thus prints hi and
exits.

7. What will be the output of the following PHP code?

1.<?php
2.const $b = 1;
3.switch($b)
4.{
5.case 1:
6. print "hi";
7. break;
8.case 1:
9. print "hello";
10. break;
11. default:
12. print "hi1";
13. }
14. ?>

a) error
b) hi
c) hihello
d) hello
View Answer
Answer: a
Explanation: Constants cannot be used in switch cases.

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

1.<?php
2.$b = 1;
3.switch(print $b)
4.{
5.case 2:
6. print "hello";
7. break;
8.case 1:
9. print "hi";
10. break;
11. default:
12. print "hi1";
13. }
14. ?>

a) 1hello
b) 1hi
c) 1hi1
d) error
View Answer
Answer: b
Explanation: Print returns 1, thus it gives case 1.

9. What will be the output of the following PHP code?

1.<?php
2.switch($b)
3.{
4.case 2:
5. print "hello";
6. break;
7.case 1:
8. print "hi";
9. break;
10. }
11. ?>

a) hello
b) hi
c) no output
d) error
View Answer
Answer: c
Explanation: If that case does not exist then it searches for default and on not finding it does
nothing.

10. What will be the output of the following PHP code?

1.<?php
2.switch($b)
3.{
4.case 2:
5. print "hello";
6. break;
7.case b:
8. print "hi";
9. break;
10. }
11. ?>

a) hello
b) hi
c) no output
d) error
View Answer
Answer: c

1. What will be the output of the following PHP code?

1.<?php
2.while()
3.{
4. print "hi";
5.}
6.?>

a) infinite loop
b) hi
c) no output
d) error
View Answer
Answer: d
Explanation: The while loop cannot be defined without a condition.
advertisement
2. What will be the output of the following PHP code?

1.<?php
2.do
3.{
4. print "hi";
5.}
6.while(0);
7.print "hello";
8.?>

a) infinite loop
b) hihello
c) hello
d) error
View Answer
Answer: b
Explanation: The do while loop executes at least once as the condition is in the while loop.

3. What will be the output of the following PHP code?

1.<?php
2.$i = 0
3.do
4.{
5. print "hi";
6. $i++;
7.}
8.while ($i != 3);
9.?>

a)

hi

hi

b) hi
c)

hi

hi

hi

hi
d) no output
View Answer
Answer: c
Explanation: The check happens after the increment,thus it prints until i = 4.

4. What will be the output of the following PHP code?

1.<?php
2.$i = 0
3.while ($i != 3)
4.{
5. print "hi";
6. $i++;
7.}
8.?>

a)

hi

hi

b)

hi

hi

hi

c)

hi

hi

hi

hi

d) no output
View Answer
Answer: b
Explanation: The check happens before the increment, thus it prints until i = 3.

5. What will be the output of the following PHP code?


1.<?php
2.$i = 0
3.while ($i < 3)
4.{
5. print "hi";
6. $i--;
7.}
8.print "hello"
9.?>

a)

hi

hi

hello

b)

hi

hi

hi

hello

c)

hi

hi

hi

hi

hello

d) infinite loop
View Answer
Answer: d
Explanation: There is no increment of i making it infinite.
6. What will be the output of the following PHP code?

1.<?php
2.$i = 0
3.while ($i < 3)
4.{
5. $i++;
6.}
7.print $i;
8.?>

a) 2
b) 3
c) 0
d) 1
View Answer
Answer: b
Explanation: The increment happens and then the check happens.

7. What will be the output of the following PHP code?

1.<?php
2.$i = 0
3.do
4.{
5. $i++;
6.}
7.while ($i < 3);
8.print $i;
9.?>

a) 2
b) 3
c) 0
d) 1
View Answer
Answer: b
Explanation: The increment happens and then the check happens.

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

1.<?php
2.$i = 0
3.while ($i++)
4.{
5. print $i;
6.}
7.print $i;
8.?>

a) 0
b) infinite loop
c) 01
d) 1
View Answer
Answer: d
Explanation: As it is a post increment, it checks and then does not enter the loop, thus prints
only 1.

9. What will be the output of the following PHP code?

1.<?php
2.$i = "";
3.while($i)
4.{
5. print "hi";
6.}
7.print "hello";
8.?>

a) hello
b) infinite loop
c) hihello
d) error
View Answer
Answer: a
Explanation: While accept does not accept anything other than a 0 or any other number as
false and true.

10. What will be the output of the following PHP code?

1.<?php
2.$i = "";
3.while ($i)
4.{
5. print "hi";
6.}
7.while($i < 8)
8. $i++;
9.print "hello";
10. ?>

a) Hi is printed 8 times, hello 7 times and then hi 2 times


b) Hi is printed 10 times, hello 7 times
c) Hi is printed once, hello 7 times
d) Hi is printed once, hello 7 times and then hi 2 times
View Answer
Answer: d

1. What will be the output of the following PHP code?

1.<?php
2.$i = 0;
3.while($i = 10)
4.{
5. print "hi";
6.}
7.print "hello";
8.?>

a) hello
b) infinite loop
c) hihello
d) error
View Answer
Answer: b
Explanation: While condition always gives 1.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$i = "";
3.while ($i = 10)
4.{
5. print "hi";
6.}
7.print "hello";
8.?>

a) hello
b) infinite loop
c) hihello
d) error
View Answer
Answer: b
Explanation: While condition always gives 1.

3. What will be the output of the following PHP code?

1.<?php
2.$i = 5;
3.while (--$i > 0)
4.{
5. $i++; print $i; print "hello";
6.}
7.?>

a) 4hello4hello4hello4hello4hello…..infinite
b) 5hello5hello5hello5hello5hello…..infinite
c) no output
d) error
View Answer
Answer: b
Explanation: i is decremented in the while loop in the condition check and then incremented
back.
4. What will be the output of the following PHP code?

1.<?php
2.$i = 5;
3.while (--$i > 0 && ++$i)
4.{
5. print $i;
6.}
7.?>

a) 5
b) 555555555…infinitely
c) 54321
d) error
View Answer
Answer: b
Explanation: As it is && operator it is being incremented and decremented continuously.

5. What will be the output of the following PHP code?

1.<?php
2.$i = 5;
3.while (--$i > 0 || ++$i)
4.{
5. print $i;
6.}
7.?>

a) 54321111111….infinitely
b) 555555555…infinitely
c) 54321
d) 5
View Answer
Answer: a
Explanation: As it is || operator the second expression is not evaluated till i becomes 1 then
it goes into a loop.

6. What will be the output of the following PHP code?

1.<?php
2.$i = 0;
3.while(++$i || --$i)
4.{
5. print $i;
6.}
7.?>

a) 1234567891011121314….infinitely
b) 01234567891011121314…infinitely
c) 1
d) 0
View Answer
Answer: a
Explanation: As it is || operator the second expression is not evaluated and i is always
incremented, in the first case to 1.

7. What will be the output of the following PHP code?

1.<?php
2.$i = 0;
3.while (++$i && --$i)
4.{
5. print $i;
6.}
7.?>

a) 1234567891011121314….infinitely
b) 01234567891011121314…infinitely
c) no output
d) error
View Answer
Answer: c
Explanation: The first condition itself fails thus the loop exists.

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

1.<?php
2.$i = 0;
3.while ((--$i > ++$i) - 1)
4.{
5. print $i;
6.}
7.?>

a) 00000000000000000000….infinitely
b) -1-1-1-1-1-1-1-1-1-1…infinitely
c) no output
d) error
View Answer
Answer: a
Explanation: (–$i > ++$i) evaluates to 0 but -1 makes it enters the loop and prints i.

9. What will be the output of the following PHP code?

1.<?php
2.$i = 2;
3.while (++$i)
4.{
5. while ($i --> 0)
6. print $i;
7.}
8.?>

a) 210
b) 10
c) no output
d) infinite loop
View Answer
Answer: a
Explanation: The loop ends when i becomes 0.

10. What will be the output of the following PHP code?

1.<?php
2.$i = 2;
3.while (++$i)
4.{
5. while (--$i > 0)
6. print $i;
7.}
8.?>

a) 210
b) 10
c) no output
d) infinite loop
View Answer
Answer: d

1. What will be the output of the following PHP code?

1.<?php
2.$i = 0;
3.for ($i)
4.{
5. print $i;
6.}
7.?>

a) 0
b) infinite loop
c) no output
d) error
View Answer
Answer: d
Explanation: Wrong syntax for for loop.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.$colors = array("red","green","blue","yellow");
3.foreach ($colors as $value)
4.{
5. echo "$value <br>";
6.}
7.?>

a)

red

green

blue

yellow

b) red
c) no output
d) error
View Answer
Answer: a
Explanation: This runs a for loop for that array.

3. What will be the output of the following PHP code?

1.<?php
2.for ($x = 0; $x <= 10; $x++)
3.{
4. echo "The number is: $x <br>";
5.}
6.?>

a)

The number is: 0

The number is: 1

The number is: 2

The number is: 3

The number is: 4

The number is: 5

The number is: 6

The number is: 7


The number is: 8

The number is: 9

The number is: 10

b) The number is: 0


c) no output
d) error
View Answer
Answer: a
Explanation: This runs a for loop from 0 to 10.

4. What will be the output of the following PHP code?

1.<?php
2.for ($x = 0; $x <= 10; print ++$x)
3.{
4. print ++$x;
5.}
6.?>

a) 123456789101112
b) 12345678910
c) 1234567891011
d) infinite loop
View Answer
Answer: a
Explanation: The value of x is incremented and printed twice before checking,this last loop it
prints 11 and 12.

5. What will be the output of the following PHP code?

1.<?php
2.for ($x = 1; $x < 10;++$x)
3.{
4. print "*\t";
5.}
6.?>

a) **********
b) *********
c) ***********
d) infinite loop
View Answer
Answer: b
Explanation: Loop runs from 1 to 9 i.e 9 times.

6. What will be the output of the following PHP code?


1.<?php
2.for ($x = -1; $x < 10;--$x)
3.{
4. print $x;
5.}
6.?>

a) 123456789101112
b) 12345678910
c) 1234567891011
d) infinite loop
View Answer
Answer: d
Explanation: The value of x is decremented thus making it an infinite loop.

7. What will be the output of the following PHP code?

1.<?php
2.$x;
3.for ($x = -3; $x < -5; ++$x)
4.{
5. print ++$x;
6.}
7.?>

a) -3-4-5
b) -3-4
c) infinite loop
d) no output
View Answer
Answer: d
Explanation: The loop is not even entered as x is initially 0.

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

1.<?php
2.for ($i++; $i == 1; $i = 2)
3. print "In for loop ";
4.print "After loop\n";
5. 
6.?>

a) In for loop
b) After for loop
c) In for loopAfter for loop
d) Infinite loop
View Answer
Answer: c
Explanation: The loop runs only once as value of x is incremented.

9. What will be the output of the following PHP code?


1.<?php
2.for (1; $i == 1; $i = 2)
3. print "In for loop ";
4.print "After loop\n";
5.?>

a) In for loop
b) After for loop
c) In for loopAfter for loop
d) Infinite loop
View Answer
Answer: b
Explanation: The loop does not run as i initialized in check statement will be zero.

10. What will be the output of the following PHP code?

1.<?php
2.for ($i == 2; ++$i == $i; ++$i)
3. print "In for loop ";
4.print "After loop\n";
5.?>

a) In for loopIn for loopIn for loopIn for loop……infinitely


b) After for loopAfter for loopAfter for loop……..infinitely
c) In for loopAfter for loopIn for loopAfter for loopIn for loopAfter for loop…..infinitely
d) After for loop
View Answer
Answer: a

1. What will be the output of the following PHP code?

1.<?php
2.for ($x = 1; $x < 10; $x++)
3. for ($y = 1; $y < 5; $y++)
4. print "Hello";
5.?>

a) Hello….36 times
b) Hello….45 times
c) Hello….50 times
d) Hello….40 times
View Answer
Answer: a
Explanation: 9*4 times is printed.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.for ($count = 1; $count != 20;$count++)
3.{
4. print $count;
5. $count++;
6.}
7.?>

a) Infinite
b) 123…….20
c) 1357…19
d) 13579…21
View Answer
Answer: a
Explanation: Condition always fails as count takes only odd numbers.

3. What will be the output of the following PHP code?

1.<?php
2.for ($count = 1; $count < 20; $count++);
3. print $count;
4.?>

a) 20
b) 19
c) 12345678910….19
d) 12345678910….1920
View Answer
Answer: a
Explanation: The for loop has no body, it just runs till condition is satisfied.

4. What will be the output of the following PHP code?

1.<?php
2.for ($count = 0; $count < 3;$count++);
3.{
4. print "hi";continue;print "hello";
5.}
6.?>

a) hihihi
b) hihellohihellohihello
c) hellohellohello
d) hi
View Answer
Answer: a
Explanation: When continue is encountered it skips to the next iteration.

5. What will be the output of the following PHP code?

1.<?php
2.for ($count = 0; $count<3;$count++);
3.{
4. print "hi";break;print "hello";
5.}
6.?>

a) hihihi
b) hihellohihellohihello
c) hellohellohello
d) hi
View Answer
Answer: d
Explanation: When break is encountered it leaves the loop.

6. What will be the output of the following PHP code?

1.<?php
2.for(++$i; ++$i; ++$i)
3.{
4. print $i;
5. if ($i == 4)
6. break;
7.}
8.?>

a) 24
b) 134
c) 1234
d) 1
View Answer
Answer: a
Explanation: The order of execution is initialization, check, increment/decrement, check,
increment/decrement, check, increment/decrement….so on.

7. What will be the output of the following PHP code?

1.<?php
2.for ($i = 0;$i = -1;$i = 1)
3.{
4. print $i;
5. if ($i != 1)
6. break;
7.}
8.?>

a) 0
b) infinite loop
c) -1
d) 1
View Answer
Answer: c
Explanation: The order of execution is initialization, check, increment/decrement, check,
increment/decrement, check, increment/decrement….so on.

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


1.<?php
2.for(;;)
3.{
4. print "10";
5.}
6.?>

a) 10
b) infinite loop
c) no output
d) error
View Answer
Answer: b
Explanation: There is no check condition to stop the execution of the loop.

9. What will be the output of the following PHP code?

1.<?php
2.for ($i = 0; $i < 3; $i++)
3.{
4. for($j = $i; $j > 0; $j--)
5. print " ";
6. for($k = $j; $k < 3; $k++)
7. print "*";
8. print "\n";
9.}
10. ?>

a)

**

***

b)

***

**

c)
*

**

***

d) error
View Answer
Answer: a
Explanation: Follow the trace of i, j prints 3 – i no of spaces for each i, k prints i stars for
each loop.

10. What will be the output of the following PHP code?

1.<?php
2.for ($i = 0; -5 ; $i++)
3.{
4. print"i";
5. if ($i == 3)
6. break;
7.}
8.?>

a) 0 1 2 3 4
b) 0 1 2 3
c) 0 1 2 3 4 5
d) error
View Answer
Answer: b

1. What will be the output of the following PHP code?

1.<?php
2. function sum($num1, $num2)
3. {
4. $total = $num1 + $num2;
5. echo "chr($total)";
6. }
7. $var1 = "sum";
8. $var1(5, 44);
9.?>

a) Error
b) 49
c) 1
d) Sum
View Answer
Answer: c
Explanation: It is possible to call a function using a variable which stores the function name
also the chr() function returns a character from the specified ASCII value.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2. function sum($num1, $num2)
3. {
4. $total = $num1 + $num2;
5. echo "cos($total)";
6. }
7. sum(5,-5);
8.?>

a) 0
b) 1
c) 0.5
d) -0.5
View Answer
Answer: b
Explanation: cos() gives the cos value of the argument. Here the function returns 1.

3. What will be the output of the following PHP code?

1.<?php
2. function b()
3. {
4. echo "b is executed";
5. }
6. function a()
7. {
8. b();
9. echo "a is executed";
10. b();
11. }
12. a();
13. ?>

a) b is executedb is executedb is executed


b) b is executeda is executed
c) a is executed
d) b is executeda is executedb is executed
View Answer
Answer: d
Explanation: Simple order of execution.

4. What will be the output of the following PHP code?

1.<?php
2.function sum($x, $y)
3.{
4. $z = $x + $y;
5. return $z;
6.}
7.echo "5 + 10 = " . sum(7,13) . "<br>";
8.echo "7 + 13 = " . sum(2,4) . "<br>";
9.echo "2 + 4 = " . sum(5,10);
10. ?>

a)

5 + 10 = 15

2+4=6

7 + 13 = 20

b)

7 + 13 = 20

5 + 10 = 15

2+4=6

c)

5 + 10 = 15

7 + 13 = 20

2+4=6

d)

5 + 10 = 20

7 + 13 = 6

2 + 4 = 15

View Answer
Answer: d
Explanation: The function calls are jumbled.

 
 
5. What will be the output of the following PHP code?
1.<?php
2.function addFive($num)
3.{
4. $num += 5;
5.}
6.function addSix(&$num)
7.{
8. $num += 6;
9.}
10. $orignum = 10;
11. addFive( &$orignum );
12. echo "Original Value is $orignum<br />";
13. addSix( $orignum );
14. echo "Original Value is $orignum<br />";
15. ?>

a)

Original Value is 15

Original Value is 21

b)

Original Value is 15

Original Value is 21

c)

Original Value is 15

Original Value is 15

d) None Of The mentioned


View Answer
Answer: b
Explanation: addSix() passes value of the variable by reference.

6. What will be the output of the following PHP code?

1.<?php
2.function addFunction($num1, $num2)
3.{
4. $sum = $num1 + $num2;
5. return $sum;
6.}
7.$return_value = addFunction(10, 20);
8.echo "Returned value from the function : $return_value"
9.?>

a) Returned value from the function : $return_value


b) Error
c) Returned value from the function : 30
d) Returned value from the function :
View Answer
Answer: c
Explanation: Functions returns value 30.

7. What will be the output of the following PHP code?

1.<?php
2.function sayHello()
3.{
4. echo "HelloWorld<br />";
5.}
6.$function_holder = "sayHello";
7.$function_holder();
8.?>

a) No Output
b) Error
c) sayHello
d) HelloWorld
View Answer
Answer: d
Explanation: It is possible to assign function names as strings to variables and then treat
these variables exactly as you would the function name itself.

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

1.<?php
2.function one()
3.{
4. echo " this works";
5. function two()
6. {
7. echo "this too works";
8. }
9.}
10. one();
11. two();
12. ?>

a) error
b) this works
c) this worksthis too works
d) this works this too works
View Answer
Answer: c
Explanation: Two is declared in one and is called after one. Hence it works.
9. What will be the output of the following PHP code?

1.<?php
2.function do($myString)
3.{
4. echo strpos($myString, "donkey",0);
5.}
6.do("The donkey looks like a horse.");
7.?>

a) 4
b) 5
c) 2
d) None of the mentioned
View Answer
Answer: a
Explanation: Donkey starts from position 4 in string.

10. What will be the output of the following PHP code?

1.<?php
2.function one()
3.{
4. define("const","I am awesome!");
5. echo constant("const");
6.}
7.one();
8.?>

a) I am awesome!!
b) const
c) const, I am awesome!!
d) “const”,”I am awesome!”
View Answer
Answer: a

1. What will be the output of the following PHP code?

1. <?php
2. function calc($price, $tax="")
3. {
4. $total = $price + ($price * $tax);
5. echo "$total";
6. }
7. calc(42);
8. ?>

a) Error
b) 0
c) 42
d) 84
View Answer
Answer: c
Explanation: You can designate certain arguments as optional by placing them at the end of
the list and assigning them a default value of nothing.
advertisement

2. What will be the output of the following PHP code?

1. <?php
2. function a()
3. {
4. function b()
5. {
6. echo 'I am b';
7. }
8. echo 'I am a';
9. }
10. a();
11. a();
12. ?>

a) I am b
b) I am bI am a
c) Error
d) I am a Error
View Answer
Answer: d
Explanation: This will be the output- I am a Fatal error: Cannot redeclare b()

3. What will be the output of the following PHP code?

1. <?php
2. function a()
3. {
4. function b()
5. {
6. echo 'I am b';
7. }
8. echo 'I am a';
9. }
10. b();
11. a();
12. ?>

a) I am b
b) I am bI am a
c) Error
d) I am a Error
View Answer
Answer: c
Explanation: This will be the output- Fatal error: Call to undefined function b(). You cannot
call a function which is inside a function without calling the outside function.
4. What will be the output of the following PHP code?

1. <?php
2. $op2 = "blabla";
3. function foo($op1)
4. {
5. echo $op1;
6. echo $op2;
7. }
8. foo("hello");
9. ?>

a) helloblabla
b) error
c) hello
d) helloblablablabla
View Answer
Answer: c
Explanation: If you want to put some variables in function that was not passed by it, you
must use “global”. Inside the function type global $op2.

5.What will be the output of the following PHP code?

1. <?php
2. function foo($msg)
3. {
4. echo "$msg";
5. }
6. $var1 = "foo";
7. $var1("will this work");
8. ?>

a) error
b) $msg
c) 0
d) will this work
View Answer
Answer: d
Explanation:It is possible to call a function using a variable which stores the function name.

6. What will be the output of the following PHP code?

1. <?php
2. echo "chr(52)";
3. ?>

a) 1
b) 2
c) 3
d) 4
View Answer
Answer: d
Explanation: The chr() function returns a character from the specified ASCII value. Since
the ASCII value of 4 is 52, thus 4 was displayed.

7. What will be the output of the following PHP code?

1. <?php
2. echo ord ("hi");
3. ?>

a) 106
b) 103
c) 104
d) 209
View Answer
Answer: c
Explanation: The ord() function returns the ASCII value of the first character of a string. The
ASCII value of h is 104, thus 104 was displayed.

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

1. <?php
2. echo(atan(0.50));
3. ?>

a) 0.11845976421345
b) 0.23568451142521
c) 0.46364760900081
d) 1
View Answer
Answer: c
Explanation: The atan() function returns the arc tangent of arg as a numeric value between
-Pi/2 and Pi/2 radians.

9. What will be the output of the following PHP code?

1. <?php
2. define("GREETING","Hello you! How are you today?");
3. echo constant("GREETING");
4. ?>

a) Hello you! How are you today?


b) GREETING
c) GREETING, Hello you! How are you today?
d) “GREETING”,”Hello you! How are you today?”
View Answer
Answer: a
Explanation: The define() function defines a constant.

10. What will be the output of the following PHP code?


1. <?php
2. define("GREETING1","Hello you! How are you today?");
3. define("GREETING2","Hello you! How are you today?");
4. define("GREETING3","Hello you! How are you today?");
5. echo defined("GREETING");
6. ?>

a) 1
b) 0
c) 3
d) 4
View Answer
Answer: b

1. What will be the output of the following PHP code?

1.<?php
2.for ($i = 0; 0; $i++)
3.{
4. print"i";
5.}
6.?>

a) infinite loop
b) 0
c) no output
d) error
View Answer
Answer: c
Explanation: The condition of the loop is always false 0.
advertisement

2. What will be the output of the following PHP code?

1.<?php
2.for ($i = 0; $i < 5; $i++)
3.{
4. for ($j = $i; $j > 0; $i--)
5. print $i;
6.}
7.?>

a) infinite loop
b) 0 1 2 3 4 5
c) 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5
d) no output
View Answer
Answer: a
Explanation: In the second loop j value is not being changed.

3. What will be the output of the following PHP code?


1.<?php
2.for ($i = 0; $i < 5; $i++)
3.{
4. for ($j = $i;$j > $i; $i--)
5. print $i;
6.}
7.?>

a) infinite loop
b) 0 1 2 3 4 5
c) 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5
d) no output
View Answer
Answer: d
Explanation: The second loop does not execute as the check condition is always false.

4. What will be the output of the following PHP code?

1.<?php
2.$user = array("Ashley", "Bale", "Shrek", "Blank");
3.for ($x = 0; $x < count($user); $x++)
4.{
5. if ($user[$x] == "Shrek")
6. continue;
7. printf ($user[$x]);
8.}
9.?>

a) AshleyBaleBlank
b) AshleyBale
c) AshleyBaleShrek
d) No output
View Answer
Answer: a
Explanation: Only the Shrek is skipped due to the continue statement.

5. What will be the output of the following PHP code?

1.<?php
2.$user = array("Ashley", "Bale", "Shrek", "Blank");
3. for ($x=0; $x < count($user) - 1; $x++)
4. {
5. if ($user[$x++] == "Shrek")
6. continue;
7. printf ($user[$x]);
8. }
9.?>

a) AshleyBaleBlank
b) Bale
c) AshleyShrek
d) BaleBlank
View Answer
Answer: a
Explanation: Only Bale is printed as $x++ is done before printing and then checked.

6. What will be the output of the following PHP code?

1.<?php
2.$user = array("Ashley", "Bale", "Shrek", "Blank");
3.for ($x = 0; $x < count($user); $x)
4.{
5. if ($user[$x++] == "Shrek")
6. continue;
7. printf ($user[$x]);
8.}
9.?>

a) AshleyBaleBlank
b) BaleShrek
c) AshleyBlank
d) Bale
View Answer
Answer: b
Explanation: x is incremented only inside loop i the if condition.

7. What will be the output of the following PHP code?

1.<?php
2.for ($i = 0; $i % ++$i; $i++)
3.{
4. print"i";
5.}
6.?>

a) error
b) infinite loop
c) no output
d) 0
View Answer
Answer: b
Explanation: Loop condition is true as i%(i+1) is a float non zero value in php.

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

1.<?php
2.for ($i = 0; $i < 5; $i++)
3.{
4. for(; $i < 5; $i++)
5. print"i";
6.}
7.?>

a) iiiii
b) infinite loop
c) iiiiiiiiiiiiiiiiiiiiiiiii
d) no output
View Answer
Answer: a
Explanation: The i value is changed in the inner loop and reaches five, thus does not
execute the second outer loop.

9. What will be the output of the following PHP code?

1.<?php
2.$a = array("hi", "hello", "bye");
3.foreach ($a as $value)
4.{
5. if (count($a) == 2)
6. print $value;
7.}
8.?>

a) hihellobye
b) infinite loop
c) hihello
d) no output
View Answer
Answer: d
Explanation: As count($a) returns 3 the condition is always false.

10. What will be the output of the following PHP code?

1.<?php
2.$a = array("hi", "hello", "bye");
3.for (;count($a) < 5;)
4.{
5. if (count($a) == 3)
6. print $a;
7.}
8.?>

a) ArrayArrayArrayArrayArrayArray….infinitely
b) (“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)…infinitely
c) hihellobyehihellobyehihellobyehihellobyehihellobyehihellobye…..infinitely
d) no output
View Answer
Answer: a

You might also like