IT Specialist INF-306 Actual Free Exam Questions & Community Discussion
The following code adds items to the groceries array from the other arrays. Line numbers are for reference only.
01 < body >
02 < p id= " list " > < /p >
03 < script >
04 var groceries = [];
05 var dairy = [ " Milk " , " Eggs " , " Cheese " , " Ice Cream " ];
06 var beverages = [ " Juice " , " Water " , " Soda " , " Coffee " ];
07 var fruits = [ " Apples " , " Bananas " , " Grapes " , " Oranges " , " Strawberries " ];
08 var vegetables = [ " Broccoli " , " Carrots " , " Lettuce " , " Spinach " , " Tomatoes " ];
09 var meats = [ " Beef " , " Chicken " , " Pork " ];
10
11 function addVegetables() {
12 groceries = groceries.concat(vegetables);
13 }
14
15 function addFruits() {
16 groceries = groceries.concat(fruits);
17 }
18
19 function addOther() {
20 groceries.push(meats[1]);
21 groceries.push(dairy[3]);
22 }
23
24 fruits.shift();
25 addVegetables();
26
27 groceries.shift();
28 addFruits();
29
30 groceries.pop();
31 groceries.shift();
32
33 addOther();
34 document.getElementById( " list " ).innerHTML = groceries;
You need to debug the code on the left to determine how many items are in the groceries array at the specified breakpoints.
Evaluate the code and answer the questions by selecting the correct option from each drop-down list.
Note: You will receive partial credit for each correct answer.

01 < body >
02 < p id= " list " > < /p >
03 < script >
04 var groceries = [];
05 var dairy = [ " Milk " , " Eggs " , " Cheese " , " Ice Cream " ];
06 var beverages = [ " Juice " , " Water " , " Soda " , " Coffee " ];
07 var fruits = [ " Apples " , " Bananas " , " Grapes " , " Oranges " , " Strawberries " ];
08 var vegetables = [ " Broccoli " , " Carrots " , " Lettuce " , " Spinach " , " Tomatoes " ];
09 var meats = [ " Beef " , " Chicken " , " Pork " ];
10
11 function addVegetables() {
12 groceries = groceries.concat(vegetables);
13 }
14
15 function addFruits() {
16 groceries = groceries.concat(fruits);
17 }
18
19 function addOther() {
20 groceries.push(meats[1]);
21 groceries.push(dairy[3]);
22 }
23
24 fruits.shift();
25 addVegetables();
26
27 groceries.shift();
28 addFruits();
29
30 groceries.pop();
31 groceries.shift();
32
33 addOther();
34 document.getElementById( " list " ).innerHTML = groceries;
You need to debug the code on the left to determine how many items are in the groceries array at the specified breakpoints.
Evaluate the code and answer the questions by selecting the correct option from each drop-down list.
Note: You will receive partial credit for each correct answer.

Correct Answer:

Explanation:
Line 26 drop-down: 5
Line 29 drop-down: 8
Line 32 drop-down: 6
The groceries array starts empty. Line 24 runs fruits.shift(), which removes " Apples " from the fruits array.
This leaves four fruits, but it does not add anything to groceries. Line 25 calls addVegetables(), which executes groceries = groceries.concat(vegetables);. Since vegetables contains five items, groceries contains 5 items at line 26. Line 27 then executes groceries.shift(), removing the first item from groceries and reducing the count to 4. Line 28 calls addFruits(), which appends the four remaining fruits, increasing the array count to 8; therefore, line 29 is 8. Line 30 executes groceries.pop(), removing the last item and reducing the count to
7. Line 31 executes groceries.shift(), removing the first item and reducing the count to 6. Therefore, line 32 is
6. The addOther() function on line 33 has not executed yet at the line 32 breakpoint. References/topics:
JavaScript arrays, debugging breakpoints, concat(), shift(), pop(), push(), array item counting.
You are drawing on the canvas defined by the white square.

At which x, y coordinate is the upper-left corner of the filled square?

At which x, y coordinate is the upper-left corner of the filled square?
Correct Answer: D
Vote an answer
Explanation: Only visible for EduDump members. You can sign-up / login (it's free).
Which CSS property defines the sides of an element where other floating elements are not allowed?
Correct Answer: A
Vote an answer
Explanation: Only visible for EduDump members. You can sign-up / login (it's free).
You need to display the following user interface:
Motorcycle
Truck
Boat
Car
Bicycle
Complete the markup by selecting the correct option from each drop-down list.

Motorcycle
Truck
Boat
Car
Bicycle
Complete the markup by selecting the correct option from each drop-down list.

Correct Answer:

Explanation:
First drop-down: datalist
Second drop-down: vehicles
Third drop-down: < /datalist >
The correct element is < datalist > because the interface requires a text input that provides selectable suggestions while still allowing the user to type. The < input > element uses list= " vehicles " , so it must be connected to a < datalist > element whose id is exactly vehicles. The id cannot be vehicle, because vehicle is already the input element's own identifier and does not match the value used by the list attribute. The < option
> elements inside the datalist define the suggested values: Motorcycle, Truck, Boat, Car, and Bicycle. ul, ol, and li are list-markup elements and do not create input suggestions. select would create a fixed dropdown list, but it would not match the editable input-with-suggestions behavior shown. The closing tag must match the opening datalist element, so the final selection is < /datalist > .
You want to display a message box showing the user ' s current latitude and longitude as identified by the user' s browser.
Complete the code by selecting the correct option from each drop-down list.
Note: You will receive partial credit for each correct selection.

Complete the code by selecting the correct option from each drop-down list.
Note: You will receive partial credit for each correct selection.

Correct Answer:

Explanation:
First drop-down: navigator.geolocation
Second drop-down: navigator.geolocation
Third drop-down: getCurrentPosition(showLocation)
The correct API object is navigator.geolocation because browser-based geographic location is exposed through the Geolocation API, not through window.location. window.location represents the current page URL and navigation state; it does not provide latitude or longitude. The first selection checks whether the browser supports geolocation by evaluating navigator.geolocation. Inside the block, the same object must be used to request the user's current position. The correct method is getCurrentPosition(showLocation), which requests the device's current location and passes a position object to the callback function when the location is available. The callback then reads position.coords.latitude and position.coords.longitude and displays those values with alert(). The alternatives that pass window.location are incorrect because they provide page- location information rather than geographic coordinates. The alternatives that call showLocation(...) directly are also incorrect because the browser must first retrieve the actual position object. References/topics:
Geolocation API, navigator.geolocation, getCurrentPosition(), callback functions, latitude and longitude.
You need to implement media queries for the responsive layout of a new website.
Low-resolution wireframes for the desktop, tablet, and mobile layouts are shown.

Low-resolution wireframes for the desktop, tablet, and mobile layouts are shown.

Correct Answer:

Explanation:

Responsive layouts use CSS media queries to apply different style rules according to the viewport width or device characteristics. In this scenario, the three wireframes represent desktop, tablet, and mobile breakpoints.
The desktop layout should use @media only screen and (min-width: 1025px) because desktop screens are the widest target group and begin above the tablet maximum width. The tablet layout should use @media only screen and (min-width: 481px) and (max-width: 1024px) because it covers the middle range between mobile and desktop. The mobile layout should use @media only screen and (min-width: 285px) and (max-width:
480px) because it targets the smallest viewport range shown in the available choices. The option @media only screen and (max-width: 1025px) and (min-width: 1920px) is logically invalid because a viewport cannot simultaneously be at least 1920 pixels wide and no more than 1025 pixels wide. References/topics: responsive web design, CSS media queries, viewport breakpoints, mobile layout, tablet layout, desktop layout.
Which markup segment uses the output element to display the combined value of two input elements in HTML5?
Correct Answer: B
Vote an answer
Explanation: Only visible for EduDump members. You can sign-up / login (it's free).
0
0
0
10
