Computation and Computer Fundamentals, CSI 2334 Full Set

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

How can the code segment ensure the movie API returns a valid movie with ID 456? let movie= { }; const response await fetch("/api/movie/456"); Check value of response.ck Add a try-catch block Check value of movie Check if response.json ()) returns null

Check value of response.ok

What type of position does not scroll with the document

Fixed

Which HTML container is commonly used to house copyright information on a webpage

Footer

The variable magic is a function findPower (strength, potion) { magic strength + potion; return magic; } findPower (50, 75); console.log(magic); local object global object local variable global variable

Global variable

The _____ attribute tells the browser where to go when a link is clicked

Href

An example of a false value is ___

If("")

In a typical Node.js file structure, where is a Mongoose model stored? In the same place as server.js In a separate directory for models In the same place as public HTML files. In separate directory for database code

In a separate directory for models

______ loops never stop executing

Infinite

Which CSS styling overrides the others when there is a style declaration conflict

Inline style

RaceForm uses a single object to maintain the state of all widgets. What XXX and YYY values are missing from the React component's return value? Answers are XXX/YYY format. 0. function RaceForm() { const [inputs, setInputs] = useState( { shirtSize: "Large" }); function handleChange (event) { const name = event.target.name; const value = event.target.value; setInputs (values => ({...values, [name]: value})); return ( <form> ); <p> <label htmlFor="shirtSize">Shirt size?</label> <select id="shirtSize" name="shirtSize" value={XXX} onChange={YYY}> <option value="Small">Small</option> <option value="Medium">Medium</option> <option value="Large">Large</option> </select> </p> <input type="submit" value="Register" /> </form> inputs.shirtSize / handleChange(event) inputs.shirtSize / handleChange shirtSize / handleChange shirtSize /setSize(şhirtSize)

Inputs.shirtSize / handleChange

Document databases store documents in _______ format with many levels of nesting. XML JSON Ajax O SQL

JSON

What is output to the console? } function getSum(scores) { if (!Array.isArray (scores)) { throw new TypeError("Array error"); } }. if (scores.length != 2) { throw new RangeError("Length error"); } return scores [0] + scores[1]; try { let sum = getSum([50, 60, 70]); console.log(sum); } catch (ex) { console.log(ex.message); Array error Length error RangeError. 110

Length Error

Adding a target="_blank" attribute to a link results in a link that opens in the same browser window link that opens in a new browser window blank page that opens in the same browser window blank page that opens in a new browser window

Link that opens in a new browser window

The variable findCost has function musicTix(people, price) { var findCost = people price; return findCost; a reference error local scope global scope block scope

Local scope

Which font shorthand is correct? bold 18px Times New Roman <p>Use the font shorthand on this paragraph</p> P { P:{ } font-shorthand: bold 18px Times New Roman; shorthand: bold 18px "Times New Roman" font-properties: bold 18px. "Times New Roman"; P'{ }, font: bold 18px "Times New Roman";

P'{ }, font: bold 18px "Times New Roman";

____ creates space inside the border, while Content, margin Margin, padding Padding, margin Content, padding creates space outside the border.

Padding, margin

A user authentication token is extracted from the _____ object's _______ header from within the router.get() method's callback function in an Express server. request, X-Auth response, X-Auth O request, Token response, Token

Request, X-Auth

What is used to import a module into a Node.js program

Require()

PHP runs on the ________, while JavaScript runs on the client-side, server-side front-end, database-side server-side, client-side front-end, back-end

Server-side, client-side

What information does the jwt-simple module's encode() and decode() methods need to encode and decode a JWT

Servers secret key

Why might a programmer add an empty array as the second argument to useEffect()? Ex: (useEffect (() => {}, []); To indicate the function argument returns an array To prevent the function argument from changing any state variables So the function argument is called only once So the function argument is called after every component render

So the function argument is called only once

What tag is used to provide alternate file formats for playing audio files

Source

Which React Bootstrap component is typically used to indicate that the user must wait for an action to complete? Spinner Tabs Waiter Dropdown

Spinner

Which file created by running create react app contains the call to reactDOM.createRoot() and Root.render()

Src/index.js

In JavaScript, 5 + "5" evaluates to

String

Given the instruction sequence below, which instruction executes after the jal instruction? 20 sw $t0, 0($12) 24 addi $t0,$t0, 5 28 jal CalcEq 32 sw $t0, 0($12) CalcEq: 80 add $t1,$t0, $10 84 addi $t1,$t1, 5 68 jr $ra addi $t1, $t1, 5 sw $t0, 0($t1) Jal CalcEq add $t1, $t0, Ste Support

add $t1, $t0, $t0

Given the following register file contents, what is the instruction sequence that writes $t1 with the sum of 5, 10, and 15? $t1 $12 $13 Register file 20 15 10 addi $t1, $t1, 5 add $t1, $t2, $t3 add $t1, $t1, 5 add $t1, $t2, $t3 add $t1, $t2, $t3 add $t1, $t1, 5 add $t1, $t2, $t3 addi $t1, $t1, 5

add $t1, $t2, $t3 addi $t1, $t1, 5

What Mongoose method call correctly deletes the employee with ID 123? 1 await Employee.deleteone({id: 123 }); Employee.deleteOne (123).exec(); Employee.find({id: 123 }).deleteOne(); await Employee.deleteOne({_id: 123 }).exec();

await Employee.deleteone({id: 123 });

Which code segment correctly uses the margin shorthand to assign the values to a div? bottom: 15px top: 10px left: 5px right: 20px div { } margin: 15px 10px 5px 20px; ¹ div { } margin: 10px 5px 20px. 15px; div { margin: 10px 15px 5px 20px; div { margin: 18px 20px 15px 5px;

div { margin: 18px 20px 15px 5px;

Assuming the following (<div id="div1" ><p id="p1">Click Me </p></div>, what event listener declaration pair would result in the given message sequence: "You clicked on the p element." "You clicked the div element." document.getElementById("p1").addEventListener("click", function() { alert("You clicked on the p element."); }); document.getElementById("div1").addEventListener("click", function() { alert ("You clicked on the div element."); });

document.getElementById("p1").addEventListener("click", function() { alert("You clicked on the p element."); }); document.getElementById("div1").addEventListener("click", function() { alert ("You clicked on the div element."); });

Which variable declaration format is correct? favBand let: "Linkin Park"; favBand let = "Linkin Park"; let favBand "Linkin Park"; let favBand: "Linkin Park";

let favBand "Linkin Park"

Given a memory location stored in $t2, which of the following instructions loads the content of the memory to register $t0? lw $t2, e($te) lw $zero, 0($2) lw $te, e($t2) lw $t2, 0($zero)

lw $te, e($t2)

Given the following register file contents, which instruction sequence writes $t1 with the result of 25 - 4 * 5? St1 $12 $13 Register file 4 5 25 mul $t0, 4, 5 sub $t1, 25, $t0 mul $t0, $t1, $t2 sub $t1, $t3, $t0 sub $t0, $t3, St1 mul $t1, $t1, St2 sub $t0, 25, 2 mul $t1, 4, 5

mul $t0, $t1, $t2 sub $t1, $t3, $t0

Given the following register file contents, which instruction sequence writes $t1 with the result of 25 - 4* 5? $t1 $12 $13 [0] Register file 4 5 25 sub $t0, 25, 2 mul $t1, 4, 5 sub $t0, $t3, $t1 mul $t1, $t1, $t2 mul $t0, $t1, $t2 sub $t1, $t3, $te mul $te, 4, 5 sub $t1, 25, $te

mul $t0, $t1, $t2 sub $t1, $t3, $te

Which of the following native instruction sequences is equivalent to the pseudoinstruction Ste, $t1, St2 mult $te, $t1 mfh) $12 Kult Sto, Sti nflo Sta mult $t1, $t2 mflo ste mult $t1, $t2 mfhi Sto

mult $t1, $t2 Mflo $t0

Which XXX assigns a click event handler to the React component's button? 0 <button XXX> Click Me </button> click="clickHandler" onclick={clickHandler} Oonclick="clickHandler" click={clickHandler}

onclick={clickHandler}

Which of the following instruction sequences is equivalent to the instruction ble $te, $t1, BLabel slt $t2, $t1, $te bne $t2, $zero, BLabel slt $t2, $t1, $te beq $t2, $zero, BLabel slt $t2, $t0, $t1 beq $t2, $zero, Blabel slt $t2, $te, $t1 bne $t2, Szero, BLabel

slt $t2, $t1, $te beq $t2, $zero, BLabel

Which of the instruction sequences is equivalent to the following expression? if ($te > 0) $t1= $t + 1 $t1= $t1 - 1 else 0) slt $t2, $t0, Szero beq $t2, $zero, True addi $t1, $t1, -1 j End True: addi $t1, $t1, 1 End: slt $t2, $zero, $t0 beq $t2, $zero, True addi $t1, $t1, -1 j End True: addi $t1, $t1, 1 End: slt $t2, $t0, $zero bne $t2, Szero, True addi $t1, St1, -1 j End True: addi $t1, $t1, 1 End: slt $t2, Szero, $te bne St2, Szero, True addi $t1, $t1, -1 j End True: addi $t1, $t1, 1 End:

slt $t2, Szero, $te bne St2, Szero, True addi $t1, $t1, -1 j End True: addi $t1, $t1, 1 End:

Which return statement is correct if the return value is "I will make an apple and blueberry pie."? let fruitPie A return fruitPie("apple", "blueberry"); function (a, b) { } "I will make an + (a, b) + pie." "I will make an 11 + a + and "I will make an (a) and (b) pie." "I will make an + + b + WE EX + and + "b" pie.' pie.'

"I will make an" + a + "and" + b + "pie."

Given the autos collection, what MongoDB condition sets all sold fields to true? 0 db.autos.updateMany ({ price: {$gte 13500} }, { }) sold = true sold: true $set: { sold: true } $inc: [sold: true }

$set:{sold:true}

Determine the result of the following binary floating-point multiplication: 1.1x25x1.1x23

1.0010x29

Given the following data memory (DM) contents and assuming $t1 holds 416, what is the value of $t0 after executing the instruction sequence? Iw $t0, 4(511) 400 404 408 412 416 25 5 10 20 Data memory (DM) 25 20 15 10 5

10

Given the following data memory (DM) contents and assuming $t1 holds 416, what is the value of $t0 after executing the instruction sequence? lw $t0, -4($t1) 400 404 408 412 416 20 25 10 Data memory (DM) 25 20 15 10 5

10

What is the two's complement representation of -4?

1100

Which addition will result in an overflow? 1111 +0111 0101 + 0010 1001 +0100 0011 +0001

1111 +0111

Given the following register file contents, what will be the value of $t2 after executing the instruction sequence? add $t2, $t2, $t1 addi $t3, $t2, 5 addi $t2, $t2, -3 $t1 $12 $13 O 5 17 15 12 Register file 10 5 8

12

For 1010.112, normalizing yields 1.01011. Identify the biased exponent of the given example.

130

What are the values of $t0 and $t1 after executing the instruction sequence below? $t0 = 16 addi $10, Szero, 5 20 jal CalcEq 24 addi $10, $t1, 5 28 32 jEnd jul CalcEq 80 84 88 CalcEq: addi $11, $t0, 5 jr Sra End 15, 20 20,25 20,20 15,15 . $t1 =

15,20

What are the values of $t0 and $t1 after executing the instruction sequence below? $t0 = 16 addi $t0, $zero, 5 20 jal CalcEq 24 addi $t0,$t1,5 28 32 jal CalcEq End CalcEq: addi $t1,$t0, 5 80 84 jr $ra 88 End: © 20, 20 20, 25 15, 15 15, 20 $t1

15,20

Given the following register file contents, what will be the value of $t3 after executing the instruction sequence? 0 slt $t2, $t3, $t1 addi $t3, $t2, 2 $t1 $12 $13 3 2 0 1 Register file 2 4 6

2

Given the register file below, what is the value in register $t4 after executing the following instructions? 0 Add $t2 = $t2 + $t6 Add $t6= $t5 + $t2 Add $t4 = $t6 + $t1 $zero $t0 St1 $12 $13 $14 $15 $16 26 22 16 11 Register file 8 6 7 5 3 0 O k

22

Given that the main portion of the program cails SubroutineA, and SubroutineA calls SubroutineB that takes 1 argument and returns 1 value. What stack frame size must be allocated in SubroutineA before calling SubroutineB? Assume the program stack is used for all subroutine arguments and return values. 2 01 3

3

For instruction beq $t0, $t1, Label, the beq instruction's address is 24. What is Label's address if the machine instruction's 16-bit immediate field is 0..0010? C.40 28 32 36 hs

36

Determine the number of pixels per square inch if there are 600 pixels per inch in an image

360000

Given the following data memory (DM) and register file contents, determine the value of $t2 after executing the instruction Load $t2 DM[1002] 1000 1001 1002 -$zero $t1 $12 $13 880 42 1002 37 Data memory DM 88 42 37 Register file 0 37 1002 880

37

Given the following data memory (DM) contents and assuming $t0 holds 7004, what is the offset value of the lw instruction if the content at address 7008 is being accessed? 7000 7004 7008 0 4 07008 1 ($10) Data memory (DM) 25 20 15

4

What is the decimal equivalent of the hexadecimal number 2A

42

Given the following flowchart and y= 2, how many times the block labeled Check will be executed? Start: Checkc End:( tot 10 03 tot = 0 x=y 06 4 Calc: tot - tot +x x=x+1

5

How many grid items are in this grid layout? 0 dy { 'display: grid; grid-template-areas: "head head" "nav article" "foot aside"; 4 5 3

5

Given a system with memory alignment, which value of $t5 results in successful execution of the instruction sw $t0, 0($t5)? 5234 5214 5213 5224 W

5224

Given the following data memory (DM) contents and assuming $t2 holds 2208, what is the value of $t3 after executing the instruction sequence? lw $t1, 0($t2) lw $t3, 0($t1) Data memory (DM) 2200 80 I 2204 60 2208 2204 2212 40 80 2204 60 40

60

Given stack: 7, 5, 3, 1 (top is 7). What is $t0 after the following push and pop operations? Push 9 to stack Pop stack to $10 Pop stack to $10 Push 11 to stack 11 7

7

Given stack: 7, 5, 3, 1 (top is 7). What is $t0 after the following push and pop operations? Push 9 to stack Pop stack to $t0 Pop stack to $t0 Push 11 to stack 5 7 11 10/10 pts 4

7

What XXX is missing so the Movie component below displays the movie's title attribute? Ex: <Movie title="Simon Birch" rating="PG" /> should display "Simon Birch is a great movie!". 0 function Movie (props) { return ( <p> </p> ); <cite>XXX</cite> is a great movie! { props.title}). this.props.title <title/> {title}.

{ props.title}

Given $t1 = 8, $t2 = 5, $t3 = 7, and $t4 = 3, what is the instruction sequence that stores the values of 3 + 7 in both register $t5 and the memory location DM[1005]? Add $t5= $t2+ $t3 Store DM[1005] to $t5 Add $t5= $t2 + $t3 Store $t5 to DM[1005] Add $t5 $t4 + $t3 Store $t5 to DM[1005] Add $t5 $t4 + $t3 Store DM[1005] to $t5

Add $t5 $t4 + $t3 Store $t5 to DM[1005]

Fill in the blank to eliminate the owner property from the Pokémon object

Delete

A template engine can create_________ web pages by replacing ______ in a template with specific values. dynamic, variables static, variables ? dynamic, functions static, functions N*

Dynamic, variables

What is one purpose of npm? Updates and installs packages for a Node.js project Compiles a Node.js project into a single JavaScript file O Loads packages as a Node.js project is running Contains JSON that lists the Node.js project information

Updates and installs packages for a Node.js project

What default object is used when no object prefix appears before a property or method call?

Window

What default object is used when no object prefix appears before a property or method call? Ex: alert("Hello"); navigator console document window

Window

x = 4 ** 4 is the same as X = 44 X = 4*4 4 X = 4 * 4 1 4 X = 4 + 4 + 4 + 4

X = 4*4*4*4

OR Given the following machine instruction, what register is used as the destination register? 000000 00000 01101 01100 00000 100000 w $10, 0($11): SW S10, 0($11): eddi $10, $11, 15: add $t0, $11, $12: sub $10, $11, $12: 100011 01001 01000 0000000000000000 101011 01001 01000 0000000000000000 001000 01001 01000 0000000000001111 000000 01001 01010 01000 00000 100000 000000 01001 01010 01000 00000 100010 mult $t1,$t2: 000100 01001 01010 00000 00000 011000 mfio $10: 000000 00000 00000 01000 00000 010010 JJLabel: 000010 00000000000000000000000101 $14 Szero -$10 Szero: 00000 $10: 01000 $11: 01001 11 $12: 01010 $13: 01011 $14: 01100 $15: 01101 $16: 01110

$t4

The universal selector is specified with ____

*

Identify the decimal equivalent of the binary value of 0.011

.375

Which of the following is a valid example of an Express route with a route parameter name and accompanying URL that specifies a car's make? :/cars/make, http://localhost/cars/ford /cars/:make, http://localhost/cars/ford /cars:make, http://localhost/cars-ford /:make/cars, http://localhost/cars/ford

/cars/:make, http://localhost/cars/ford

Which special character is used so e &lessthan; 4 e &lt; 4 e &less; 4 0 &<; 4 is not treated as part of the following tag? <p>0 < 4</p>

0 &less; 4

Which is true? A single 0 or 1 is called a bit Eight bytes are called a nibble A single 0 or 1 is called a byte Eight bits are called a nibble

A single 0 or 1 is called a bit

Given the instruction sequence below, which instruction executes after the jal instruction? 20 sw $t0, 0($12) 24 addi $t0,$t0, 5 28 Jal CalcEq 32 sw $t0, 0($12) CalcEq: add $t1, $10, $10 addi $t1,$t1, 5 80 84 88 jr Sra. sw $to, e($t1) jal Calciq add $t1, $te, sto addi $t1, $t1, 5 Support

Add $t1,$t0,$t0

An Express server is listening on port 3000 with an API endpoint of /api/comicbooks. If a GET request is sent to http://localhost:3000/api/comicbooks, what is output to the console? 0 const Comicbook require("../models/comicbook"); const router = require("express"). Router(); router.get("/", function(req, res) { let query = = {}; }); if (req.query.publisher) { query = { publisher: req.query.publisher }; Comicbook.find(query, function(err, comicbooks) { if (err) { console.log("error"); }); } else { } console.log(comicbooks); All comic books from the database missing a publisher An empty array All comic books from the database Error message Ch

All comic books from the database

Which attribute displays text when an image cannot be viewed

Alt

If a web browser supports only ogg file format, which sound clip will be downloaded? <audio controls> <source src="audio.mp4">< source src="audio.ogg"><source src="audio.mp3"> </audio> audio.mp4 audio.ogg audio2.ogg audio.mp3

Audio.ogg

When styling elements of a web form which setting is defined for radio buttons and not checkboxes

Border-radius

The instruction, Load $t5 with DM[5150], falls into which instruction category? data transfer arithmetic logic unit branch data memory

Data transfer

What operation does the following machine instruction perform? 000000 01011 01110 01001 00000 100010 lw $10, 0(511): sw $10, 0($11): add $10, $11, 15: add $t0, $11, $12: sub $t0, $11, $12: mult $11, $12: mflo $10: JJLabel: mflo Ⓒadd sub mult 100011 01001 01000 0000000000000000 101011 01001 01000 0000000000000000 001000 01001 01000 0000000000001111 000000 01001 01010 01000 00000 100000 000000 01001 01010 01000 00000 100010 000100 01001 01010 00000 00000 011000 000000 00000 00000 01000 00000 010010 000010 00000000000000000000000101 Szero: 00000 $10: 01000 $11: 01001 $12: 01010 $13: 01011 $14: 01100 $15: 01101 $16: 01110

Sub

What happens when the following command executes in the MongoDB Shell? db-movies.insertone({ name: "What About Bob?", The MongoDB Shell prompts for an _id before adding the document. The document is added to the collection with no_id. The document is not added to the collection without an_id. The document is added to the collection with a generated_id. year: 1991

The document is added to the collection with a generated _id

What will the webpage contain after executing the JavaScript? DOCTYPE html> html> <title>DOM Example</title> <body> <p id="ex" hidden>Paragraph with ID</p> <p name="ex" hidden>Paragraph with name</p> <p class="ex" hidden>Paragraph with class</p> <p type="ex" hidden>Paragraph with type</p> <span id="example"></span> <script> let elements </script> = document.getElementById("example").innerHTML "The paragraph is : "+ elements[0].innerHTML; </body> </html> document.querySelectorAll(".ex"); The paragraph is : Paragraph with name The paragraph is: Paragraph with ID The paragraph is : Paragraph with class The paragraph is: Paragraph with type

The paragraph is: Paragraph with class

Which of the following statements about assembler is NOT true? The target address is always known when a jump instruction is translated into machine instruction. A pseudoinstruction must be translated into native instructions before being translated into machine instructions. A symbol table is used to store addresses of the labels in a program. The number of the machine instructions is at least the same as the number of assembly instructions. घ

The target address is always known when a jump instruction is translated into machine instruction.

Why might a React app use the React Router's Link component? To define the components for the app's various Routes. To create a link that reloads the webpage. To create a link that matches a Route. To link multiple Routes together.

To create a link that matches a Route

A Vehicle component and Truck component are both implemented in modules. If the Vehicle's return statement uses Truck, then which statement is true? Truck.js should export Truck, and Vehicle.js should export Vehicle. Truck.js should export Truck, and Vehicle.js should import Truck. O Truck.js should import Vehicle and export Truck. O Vehicle.js should import Truck from Truck.js and export Truck. M

Truck.js should export Truck, and Vehicle.js should import Truck.

Which of the instruction sequences is equivalent to the following expression? if ($t1 - $t2) $t3 $t3 1 bne $t1, $t2, L1 L1: beq $t1, $t2, L1 L1: addi $t3, $t3, -1 L1:beq $t1, St2, L1 sub $t3, $t3, 1 addi $t3, $t3, -1 11: bne $t1, $t2, L1 sub $t3, $t3, 1

beq $t1, $t2, L1 L1: addi $t3, $t3, -1 L1:

Which element properly follows the developer guidelines to assign a concise boolean value to an attribute? <button type="submit" hidden="true">Submit</button> <button type="submit" hidden=0>Submit</button> <button type="submit" hidden>Submit</button> <button type="submit" hidden=true>Submit</button>

button type="submit" hidden>Submit</button

456 Which Date method changes the time from 12 noon to 4 pm? let change Time changeTime.setHours (4); changeTime.setHours (16); changeTime = new Hours (16); changeTime new Hours (4); B new Date(2020, 5, 2, 12);

changeTime.setHours (16);

What is the correct format for logging "My favorite food is pizza."? let favFood "pizza"; console.log("My favorite food is" favFood.) console.log("My favorite food is + favFood + ".") 20 Ell console.log("My favorite food is + "favFood.") console.log("My favorite food is favFood.")

console.log("My favorite food is + favFood + ".")

Which of the following uses a "good practice" representation of a 'toy' model using Mongoose? const Toy const toy = const toy = const Toy = mongoose.model("toy", toySchema); mongoose.model("Toy", toySchema); mongoose.model("toy", toySchema); mongoose.model("Toy", toySchema);

const Toy = mongoose.model("Toy", toySchema);

Replace the grid-column and grid-row declarations using grid-area. #grid-item-x { }, grid-column: 2 / 4; grid-row: 3 / 5; grid-area: 3/2/5/4; grid-area: 2/4/3/5; grid-area: 3/5/2/4: grid-area: 2/3/4/5;

grid-area: 3/2/5/4;

If an Express server is started with the code below, what URL accesses the static file exam.html? const express const app = express(); app.use(express.static("test")); app.listen (2020); = require("express"); http://localhost:2020/test/exam.html http://localhost:2020/exam.html http://localhost/exam.html http://localhost/2020/exam.html

http://localhost:2020/exam.html

Which two elements do not require a closing tag

img, br

Which element properly follows the developer guidelines? <input type-password> <input type="password"> <input type="password"/> O<input type='password'>

input type="password"

A React component's submit event handler usually calls event.preventDefault() in order to capture any changes made to the form before submitting the form validate user input before submitting form data save the state of multiple inputs stop the browser from submitting form data in an HTTP request

stop the browser from submitting form data in an HTTP request

Which of the following instruction sequences is equivalent to $t4 = $t3-($t2 - $t1)? sub $t4, $t3, $t2 sub $t4, $t2, St1 sub $t4, $t3, $t2 sub $t4, $t4, St1 sub $t4, $t2, $t1 sub $t4, $t3, $t4 sub St4, St2, Sti sub St4, St4, $t3

sub $t4, $t2, $t1 sub $t4, $t3, $t4


Ensembles d'études connexes

P2T3 - Questions CNS Anti-seizure Medication

View Set