Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

N341 Midterm 2023 with 100% correct questions and answers

Beoordeling
-
Verkocht
-
Pagina's
11
Cijfer
A+
Geüpload op
16-02-2023
Geschreven in
2022/2023

A script is a series of steps that a computer can follow to achieve a goal true Scripts are made up of _____ instructions step-by-step A browser uses different parts of the script - depending on how the user interacts with the web page true Once a script begins to run, the entire sequence must finish. Neither the user nor the programmer can influence it. false When developing a script, the programmer should typically follow what iterative process? Define the goal, design the script, code each step When learning a new computer language, it's important to learn both the vocabulary and syntax true Using a flowchart is a bad way to work out how the tasks of a script fit together to achieve the desired goal false Computers use data to create simplified models of objects in the human world true property ... method ... event ... Web browsers are actually software programs that are built using ______ and ______ ... The browser sees a web page as an object that contains other objects. The page's URL or the page's title would be an example of _____ ... write() adds new content to the web page. This is an example of _____ ... All major browsers include a JavaScript interpreter that translates your code into instructions the computer can understand. true The Document Object Model is a tree-like structure that the browser constructs when rendering a web page. true structure or content of the page html style or presentation of the page css interactivity or behavior of the page javascript Which of the following files are written as plain text? (html, css javascript) all of them The Document Object Model is a tree-like structure that the browser constructs when rendering a web page. true structure or content of the page html style or presentation of the page css interactivity or behavior of the page JavaScript Which of the following files are written as plain text? (html, css, javascript) all of them For separation of layers, which is the preferred method for using JavaScript with your html page? Link to an external file. When JavaScript is used to change the appearance of a web page, the original html file is also changed. False The following html code: scrpt src="js/webPageB"/scrpt links to a JavaScript file from an html page. Using the scrpt tag to include JavaScript inside an html file can affect the loading time of the page. True Each individual instruction in a script is known as a statement. Statements should end in a ____. This allows both the human and the computer to understand the code. semicolon Sections of statements called code blocks are surrounded by _____. This creates a group of statements and helps to make scripts more readable. { curly braces } Writing comments inside a script is a way to explain what the code is doing. The JavaScript interpreter carefully reads each comment to get detailed information. False Single-line comments begin with two forward slash characters. They are usually used to provide short descriptions of what the code is doing. True Multi-line comments start with / and end with /. These comments can span many lines and are often used to describe how the script works. True Computers use _____ to store data for use in computations or for later reference. variables Two essential steps to using variables are to declare them and to assign them a value. True Three data types that JavaScript uses are numeric, string, and Boolean The following line of code sets a variable to a numeric value: intQuantity = 7; Check each line of code that correctly sets strMessage to a string value: strMessage = 'Sally said, "hello!" '; strMessage = "Sally said, "hello!" "; The following line of code sets a variable to a Boolean value: blnIsBlue = true; In JavaScript, the _____ keyword is used to declare variables. var ... ... ... ... The following rules apply when giving a variable a name. The name must not contain a dash or a period. All variables are case sensitive. The name must not start with a number. _____ is a list of values. It is helpful for storing a list of related items. An Array ... ... The following line of code is an example of _____. strColors = ['red', 'white', 'blue']; an array literal ... ... ... ... The following line of code is an example of _____. var strColors = new Array('red', 'white', 'blue'); an array constructor In the following lines of code, the value of strMyFavoriteColor is _____. var strColors = new Array('red', 'white', 'blue'); strMyFavoriteColor = strColors[0]; red ... ... Operators and expressions allow programmers to create a single value from one or more values. True ... ... Which of the following is NOT a type of JavaScript operator? (Assignment operator, Comparison operator, Sign operator, Arithmetic operator, Logical operator, String operator) Sign operator ... ... In JavaScript, what does the operator ++ do? It adds one to the current number. ... ... In the following example, intTotal = 2+4*10; Multiplication happens before addition. ... ... In JavaScript, what does the operator + do? (2 answers) It concatenates two strings. It adds two numbers. ... ... A series of statements that have been grouped together to form a specific task is called _____. a function The response that a function provides when it is called is a _____. return value If different parts of a script need to perform the same task, writing a function will _____. (3 answers) keep the code shorter, make the script easier to read, avoid unnecessarily repetitive code A function that appears where the interpreter expects to see an expression is called a _____ . function expression The location of a variable declaration will affect where it can be used within the code. This is known as the variable's _____. scope A variable that is declared outside a function can be used anywhere in the script. It is called a _____ variable and has _____ scope. global; global Using global variables can lead to errors and slowly performing scripts because _____. (2 answers) global variables use more memory than local variables global variables can have naming collisions with other scripts Objects _____. (4 answers) have variables that become known as properties group together a set of variables and functions have functions that become known as methods create a model of something you would recognize from the real world Within an object, the value of a property can be a _____. Number, another object, String, Boolean, Array Properties and methods of an object are accessed using _____. dot notation var myPhone {}; uses _____ to create a _____. literal notation; empty object var myPhone = new Object(); uses _____ to create a _____. constructor notation; empty object var myPhone = new Phone(ꞌmobileꞌ, ꞌ2ꞌ, 200); uses _____ to create a _____. constructor notation; instance of an object In JavaScript, the following code will _____. var intSize = 5; intSize += 3; will add 3 to intSize. The keyword this ______? (3 answers) usually refers to the object in which the function operates. refers to the window object when used in a global context has a value that changes in different situations. To organize your data, you can either use an array or use an object to group a set of related values. If the order of the items is important, it is better to use an _____. array When creating lots of objects with similar functionality, it is good to use _____. constructor notation An array can be a list of numbers or strings, but not a list of objects. False Browser Object Model window location, scrolling distance, and alert() method Document Object Model page title, last modification date, getElementById() method Global JavaScript Objects String, number, math, and date objects var strMessage = 'Hello World'; (2 answers) strMessage can use the built-in properties and methods of the String object. strMh returns the length of the message - which is 11. The Math object _____. (3 answers) has a method that generates a random number is used with the name of the Math object followed by the needed property or method. For example, numTwo = M(4); is a global object To use the built-in Date object in JavaScript, it is necessary to create an instance of the Date object using the constructor method. True When evaluating a condition with a comparison operator, the result will be a _____. boolean is equal to == is not equal to != strict equal to === strict not equal to !== greater than less than greater than or equal to = less than or equal to = logical AND && logical OR || logical NOT ! var intA = 1; // first operand in the condition var intB = 2; // second operand in the condition var intC = 3; // third operand in the condition if (!(intA intB)) { doStuff(); } // end if In the example above, doStuff() will _____. never be called var intA = 1; // first operand in the condition var intB = 2; // second operand in the condition var intC = 3; // third operand in the condition var intD = 4; // fourth operand in the condition if ( (intA intB) || (intC intD) ) { doStuff(); } // end if else { doDifferentStuff(); } //end else In the example above, _____. (2 answers) the condition (intC intD) is not checked, doStuff() is always called. The break keyword tells the JavaScript interpreter _____ . (2 answers) that is has finished with a switch statement, to go to the first line of code that appears after a loop or switch statement A switch statement works like a series of if statements. The difference is that the switch statement performs more quickly. true 3 statements about type coercion: It creates a need for using strict equality operators, It can lead to unexpected values in your code, It can lead to errors. Which of the following is a falsy value? ("false", any number that is not zero, "0", strings with content, a variable with no value assigned to it) a variable with no value assigned to it Which of the following is a truthy value? ( 0, a variable with no value assigned to it, empty value, NaN (Not a Number), "false") "false" A unary operator returns a result using just one operand. true for loop code needs to be run a specific number of times while loop code needs to be run an unknown number of times do while loop code needs to be run at least once Two keywords that are often used with loops are: break; continue Which loop has the statements in the code block before the condition? do while The Document Object Model (DOM) _____. (3 answers) specifies how JavaScript can change the html page, specifies how the browser should make a model of the html page, is a tree-like structure What are the main types of DOM nodes? Document node, Element nodes, Attribute nodes, Text nodes To access the elements on the DOM tree, JavaScript can be used to select _____. (4 answers) an individual node by element id, multiple nodes by tag name, using CSS selector syntax, multiple nodes by class Once an element node or group of nodes is selected, the attributes, the child elements, and the text content can be changed. true After a DOM query, if your script needs to use the result more than once, it is a good idea to store the location of the element(s) in a variable. This is known as caching the selection. true A DOM query can return either one element or a collection of nodes. true All JavaScript element selection methods are supported equally well in every major browser. false To apply the same code to numerous elements in a NodeList _____ is a powerful technique. First, it is necessary to determine how many items are in the NodeList. This is done with the _____ . looping through; length property of the Nodelist Once an element node is selected, it is possible to select other nodes related to it. This is called traversing the DOM. New elements can be selected based on their relationship as a parent, sibling, or child of the originally selected element. true Some browsers treat whitespace between elements as a text node. So, a DOM query can return different elements in different browsers. true innerHTML gets/sets text and markup but has security risks textContent gets/sets text only from the containing element There are two very different approaches to changing content on a DOM tree: _____ property and DOM manipulation. _____ easily targets individual nodes in the DOM tree, whereas _____ is better suited to updating entire fragments. innerHTML, DOM manipulation, innerHTML Which two of the following steps must be completed to add an element to the page using DOM manipulation? Create the element - createElement() Add the element to the DOM - appendChild() () easy way for beginners to learn to add content to a page using this technique after the page has loaded can cause it to overwrite the entire page HTML can be used to add lots of new markup using less code than other options simple way to remove all content from one element (by assigning it a blank string) DOM Manipulation best technique to use when changing one element that has many siblings does not affect event handlers if many changes are needed, it needs more code and is slower than other methods Cross-Site Scripting Attacks (XSS) involve an attacker placing malicious code into a site. Using the innerHTML property to allow user input is one way to enable these attacks. XSS can allow an attacker to _____. (6 answers) access the user's login information access form data access the site's cookies post unwanted content spread malicious code make purchases with the user's account _____ events occur when the user interacts with the browser's UI rather than the web page. User Interface _____ events occur when the user interacts with the keyboard. Keyboard _____events occur when the user interacts with the mouse, trackpad, or touchscreen. Mouse _____ events occur when the user interacts with a form element. Form _____ events occur when the DOM structure has been changed by a script. Mutation _____ events occur when an element gains or loses focus. Focus When an event has occurred, it is said to _____. Events are said to _____ a function or script. When it is indicated which event will cause a response on a selected node, it is said to _____ an event to a DOM node. fire or raise; trigger; bind Event handling involves three steps. Put these steps in the order they must appear in the code. select an element node; bind an event to the node; specify the code that is to run HTML attribute; Old technology - DO NOT USE HTML Event Handler does not work with IE8 or earlier; can attach multiple functions to an event DOM Level 2 Event Listener strong support in all major browsers; can only attach a single function to an event Traditional DOM Event Handler Event listeners are not supported in some older browsers, so it is necessary to provide fallback code if support for those browsers is necessary. true When an event occurs, the event object tells _____. (3 answers) information about the event the type of event that was fired information about the element that triggered the event The process of creating a single listener on a parent event is called _____. event delegation The preventDefault() method of the event object changes the default behavior of an element. This can be used to keep the user on the page after clicking on a link. true Which of the following are focus & blur events? focusin, focusout, blur, focus Which of the following are keyboard events? keyup, keydown, keypress, input Event used to check the values a user has entered into a form before sending it to the server submit Event used when the status of form elements have been altered change Event used with ˂input˃ and ˂textarea˃ elements input

Meer zien Lees minder
Instelling
N341
Vak
N341









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
N341
Vak
N341

Documentinformatie

Geüpload op
16 februari 2023
Aantal pagina's
11
Geschreven in
2022/2023
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$16.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Arthurmark Chamberlain College Of Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
45
Lid sinds
4 jaar
Aantal volgers
39
Documenten
1422
Laatst verkocht
7 maanden geleden

3.7

9 beoordelingen

5
5
4
0
3
2
2
0
1
2

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen