Question No: 2 HOTSPOT – (Topic 1)

You are developing a web page that will be accessed from various types of devices.

You have the following requirements:

-> The appropriate display resolution must be selected dynamically based on the device connecting to the page.

-> Mobile devices with a maximum width of 480 pixels must be able to use the page.

You need to ensure that the page displays correctly on any device.

How should you build the code? (To answer, select the appropriate options from the drop- down lists in the answer area.)

Answer:

Explanation:

The @media rule is used to define different style rules for different media types/devices. CSS Syntax

@media not|only mediatype and (media feature) { CSS-Code;

}

Media type: Screen

Used for computer screens.

Incorrect:

Not size: there is no media type size.

Question No: 3 – (Topic 1)

You are developing a web page that will be divided into three vertical sections. The main content of the site will be placed in the center section. The two outer sections will contain advertisements.

You have the following requirements:

-> The main content section must be set to two times the width of the advertising sections.

-> The layout must be specified by using the CSS3 flexible box model.

You need to ensure that the visual layout of the page meets the requirements. Which CSS3 property should you use?

box-orient

box-flex-group

box-flex

box-direction

Answer: C Explanation: box-flex Values: 0 | Any integer

The flexibility ratio for this child. If a child had 1 and its sibling had 2, any additional space in the parent box would be consumed twice as much by the sibling. It defaults to 0 which is inflexible.

Question No: 7 – (Topic 1)

You are developing a web page that enables customers to upload documents to a web server. The page includes an HTML5 PROGRESS element named progressBar that displays information about the status of the upload.

The page includes the following code. (Line numbers are included for reference only.)

An event handler must be attached to the request object to update the PROGRESS element on the page.

You need to ensure that the status of the upload is displayed in the progress bar. Which line of code should you insert at line 03?

Question No: 9 HOTSPOT – (Topic 1)

You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a string that identifies the data type of the object.

You have the following requirements:

-> The function must return quot;Numberquot; if the object is a number.

-> The function must return quot;Stringquot; if the object is a string.

-> The function must return quot;Unknownquot; if the object is neither a number nor a string.

You need to implement the function to meet the requirements.

How should you build the code segment? (To answer, select the appropriate options from the drop-down lists in the answer area.)

Answer:

Explanation:

* Use the switch statement to select one of many blocks of code to be executed.

Syntax switch(expression) { case n:

code block break; case n: code block break; default:

default code block

}

This is how it works:

The switch expression is evaluated once.

The value of the expression is compared with the values of each case. If there is a match, the associated block of code is executed.

Object.prototype.constructor

Returns a reference to the Object function that created the instance#39;s prototype. Note that the value of this property is a reference to the function itself, not a string containing the function#39;s name. The value is only read-only for primitive values such as 1, true and quot;testquot;.

Description

All objects inherit a constructor property from their prototype:

var o = {};

o.constructor === Object; // true

var a = [];

a.constructor === Array; // true

var n = new Number(3); n.constructor === Number; // true

* The constructor property is created together with the function as a single property of func.prototype.

Question No: 10 – (Topic 1)

You need to test the value of the following variable in JavaScript. var length = quot;75quot;;

A block of code must execute if the length equals 75 regardless of the data type. You need to use the statement that meets this requirement.

Which lines of code should you use? (Each correct answer presents a complete solution. Choose two.)

if (length = = = 75)

if (length = = 75)

if (length! = 75)

if (length = = quot;75quot;)

Answer: B,D

Explanation: When comparison is made using double-equals operator (==), it will check the values of variable and convert them to a common type and returns true if both are equals. So comparing number with string having the same value will return true.