Question No: 171 – (Topic 4)
You are developing an application that processes order information. Thousands of orders are processed daily. The application includes the following code segment. (Line numbers are included for reference only.)
The application must:
-> Display the number of orders processed and the number of orders remaining
-> Update the display for every 25th record processed
You need to develop the application to meet these requirements. Which line of code should you insert at line 04?
if (!(counter % 25))
if (counter == 25)
if (counter gt;gt; 25 == 0)
if (counter lt;lt; 25 == 0)
Answer: A Explanation: %
(Modulus) Computes the integer remainder of dividing 2 numbers.
gt;gt; (Sign-propagating right shift) Shifts the first operand in binary representation the number of bits to the right specified in the second operand, discarding bits shifted off.
lt;lt; (Left shift) Shifts its first operand in binary representation the number of bits to the left specified in the second operand, shifting in zeros from the right.
Question No: 172 – (Topic 4)
You need to create a web worker and instantiate it from main.html. Where should you place the web worker code?
In the myApp.js file
In the main.html file
In a separate executable file
Explanation: Spawning a dedicated worker
Creating a new worker is simple. All you need to do is call the Worker() constructor, specifying the URI of a script to execute in the worker thread (main.js):
var myWorker = new Worker(quot;worker.jsquot;); Reference: Using Web Workers
Question No: 173 – (Topic 4)
You develop a webpage with a standard input control by using HTML5.
The input control must display the text Enter your given name, as shown below:
When a user selects the input control, the text must disappear. You need to create the input control.
Which input control should you use?
lt;input name=quot;GivenNamequot; value=quot; Enter your given namequot; /gt;
lt;input name =quot;GivenNamequot; default=quot; Enter your given namequot; /gt;
lt;input name=quot;GivenNamequot; text=quot; Enter your given namequot; /gt;
lt;input name=quot;GivenNamequot; placeholder=quot; Enter your given namequot; /gt;
Explanation: The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a sample value or a short description of the expected format).
The short hint is displayed in the input field before the user enters a value.
The placeholder attribute works with the following input types: text, search, url, tel, email, and password.
Reference: HTML lt;inputgt; placeholder Attribute
Question No: 174 – (Topic 4)
You develop an HTML5 webpage that contains the following HTML markup:
Users must receive a message after they click the Submit button if the text entered into the favoriteColor text box is fewer than 2 characters or greater than 10 characters.
You need to implement the testLength() function. Which code segment should you use?
Explanation: Use three arguments: element, min, max. Compare element.value with min and max.
Question No: 175 HOTSPOT – (Topic 4)
You are creating a custom CSS3 style.
You have the following requirements to complete the style:
-> Box1 has a red outline.
-> Box1 contains box2, and box2 must remain inside box1
-> Box2 must have a green to black gradient.
-> Box2 must be surrounded by white space.
The style resembles the following diagram:
You need to add the CSS3 code to the styles.
How should you complete the relevant code? (To answer, select the appropriate code segment in each drop-down list in the answer area.)
border: 1px solid #f00; a red border 1 pixel thick.
background-image: linear-gradient(to bottom, green,black); Linear Gradients (goes down/up/left/right/diagonally).
Starts at the top with green and goes to bottom with black.
margin: 10px 10px 10px 10px;
The CSS margin properties define the space around elements.
The top, right, bottom, and left margin can be changed independently using separate properties.
will not display any border
Radial Gradients (defined by their center).
Question No: 176 – (Topic 4)
You are developing a customer contact form that will be displayed on a page of a company#39;s website. The page collects information about the customer.
If a customer enters a value before submitting the form, it must be a valid email address. You need to ensure that the data validation requirement is met.
What should you use?
lt;input name=quot;emailquot; type=quot;inputquot; required=quot;requiredquot;/gt;
lt;input name=emailquot; type=quot;urlquot; required=quot;emailquot;/gt;
lt;input name=quot;emailquot; classquot; emailquot;/gt;
lt;input name=quot;emailquot; type=quot;emailquot;/gt;
Explanation: The lt;input type=quot;emailquot;gt; is used for input fields that should contain an e- mail address.
Depending on browser support, the e-mail address can be automatically validated when submitted.
Some smartphones recognize the email type, and adds quot;.comquot; to the keyboard to match email input.
Reference: HTML Input Types
Question No: 177 DRAG DROP – (Topic 4)
You are developing a corporate website for a company. The website uses a style sheet to enforce corporate image standards. Users report that the website is not properly rendering the styles.
You create a web page to test the styles by using the following code.
You need to verify how the style will be displayed.
In which order will the results be displayed? (To answer, drag the appropriate style from the list of styles to the correct location or locations in the work area.)
Question No: 178 – (Topic 4)
You are developing a web application by using HTML5.
You have the following requirements.
-> The color of a menu item must change when a user hovers over the item.
-> The color of the menu item must change back to its original color after five seconds.
You need to ensure that the animation is applied to all menu items. Which CSS3 code should you use?
The transition-property property specifies the name of the CSS property the transition effect is for (the transition effect will start when the specified CSS property changes).
Tip: A transition effect could typically occur when a user hover over an element.
Note: Always specify the transition-duration property, otherwise the duration is 0, and the transition will have no effect.
CSS3 transition-property Property
Question No: 179 – (Topic 4)
You are creating a custom function. You pass an object named testObj to the function as a parameter. You do not use inheritance through the functions.
The function must establish whether testObj inherits from another object named parentObj. You need to ensure that the function performs as required.
Which method or operator should you add to the function?
Explanation: The isPrototypeOf() method tests for an object in another object#39;s prototype chain.
Question No: 180 DRAG DROP – (Topic 4)
You have the following markup:
You need to add a dashed border programmatically to the div. You write the following code.
How should you complete the code? To answer, drag the appropriate code elements to the correct targets in the answer area. Each code can be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.