Practice midterm-2

Descripción

Computer Science Test sobre Practice midterm-2, creado por Jimit Thakkar el 01/12/2017.
Jimit Thakkar
Test por Jimit Thakkar, actualizado hace más de 1 año
Jimit Thakkar
Creado por Jimit Thakkar hace más de 6 años
367
1

Resumen del Recurso

Pregunta 1

Pregunta
if you wanted a CSS rule to have all paragraphs of class silly to be centered on the page, which CSS rule would you use?
Respuesta
  • silly { text-align: center; }
  • p.silly { align: center; }
  • p
  • p.silly { text-align: center; }
  • p < silly { align: center; }

Pregunta 2

Pregunta
In CSS the selector .par matches
Respuesta
  • all elements whose class is par
  • all elements whose id is par
  • all <p> elements whose id is par
  • all <p> elements whose class is par
  • all<p>elements

Pregunta 3

Pregunta
In PHP, what is the output of the following code $a = 2; $a = $a + 2; $a++; print $a;
Respuesta
  • 8
  • 2
  • 5
  • 6
  • 4

Pregunta 4

Pregunta
In CSS which property is used to control the size of the text?
Respuesta
  • font
  • text-style
  • font-style
  • text-size
  • font-size

Pregunta 5

Pregunta
In CSS a rule has the syntax a { b : c ; }. In this rule the symbol a is known as a
Respuesta
  • value
  • parameter
  • Selector
  • property
  • comment

Pregunta 6

Pregunta
$a = 10; $b = 5; print '$a*$b';
Respuesta
  • 10*5
  • 50
  • you will get an error
  • $a*$b

Pregunta 7

Pregunta
Which of the following is a valid CSS selector ?
Respuesta
  • p { color red }
  • p color red
  • p { color: red; }
  • p color: red;
  • p.color { red; }

Pregunta 8

Pregunta
In PHP, what would be the output of the following code: $a = 10; $b = 10; print "$a * $b";
Respuesta
  • you will get an error
  • 100
  • $a * $b
  • 10*10

Pregunta 9

Pregunta
Where should the reference to a style sheet be placed in an HTML document ?
Respuesta
  • In the <head> section.
  • In the <style> section.
  • In the 'tail> section.
  • In the <body> section.
  • In the <css> section.

Pregunta 10

Pregunta
What is the order of priority (from highest to lowest) that styles are applied to an element?
Respuesta
  • inline style, embedded style, externally linked style, default html style style sheet, the browser default
  • default html style, embedded style, inline style, externally linked style Incorrect
  • embedded style, inline style, externally linked style, default html style
  • externally linked style, embedded style, inline style, default html style
  • externally linked style, default html style, embedded style, inline style

Pregunta 11

Pregunta
In CSS, considering the CSS Box Model, would be the final width of an element with the following id? #item { width: 100px; border: 5px; margin: 5px; padding: 0px; }
Respuesta
  • 100
  • 110
  • 105
  • 120
  • 90

Pregunta 12

Pregunta
In CSS the selector p matches
Respuesta
  • all <p> elements whose class is p
  • all elements whose id is p
  • all <p> elements whose id is p
  • all elements whose class is p
  • all <p> elements

Pregunta 13

Pregunta
The following PHP code has an error. What line is this error on? 0: $a = 10 + 1; 1: $b = "10" 2: if ($a <> $b) 3: { 4: print "Not equal"; 5: } 6: else 7: { 8: $b++; 9: }
Respuesta
  • 0
  • 1
  • 4
  • 2

Pregunta 14

Pregunta
Considering the CSS box model, what is the final width of an element of this class: .item { width: 100px; margin: 10px; padding-left: 10px; padding-right: 0px; }
Respuesta
  • 120
  • 130
  • 150
  • 100

Pregunta 15

Pregunta
Which of the following would change the background colour for all <h1> elements to white?
Respuesta
  • h1.all { background-color: white }
  • header1 { background-color: white }
  • .h1 { background-color: white }
  • h1 { background-color: white }

Pregunta 16

Pregunta
In CSS which property is used to control the background color?
Respuesta
  • color
  • backgroung-color
  • background-colour
  • bgcolor

Pregunta 17

Pregunta
In CSS to apply color: red to h1 and h2 you could use the rule(s)
Respuesta
  • h1.h2 { color : red; }
  • h1:h2 { color : red; }
  • h1, h2 { color : red; }
  • h1 { color : red; } h2 { color : blue; }
  • h1 { red : color; } h2 { red : color; }

Pregunta 18

Pregunta
In CSS which property is used to control the text color of an element?
Respuesta
  • text-color
  • background-color
  • foreground-color
  • text-colour
  • color

Pregunta 19

Pregunta
The difference between serif and sans-serif fonts is that
Respuesta
  • serif fonts have small lines at the end of some characters while sans-serif do not
  • sans-serif fonts have small lines at the end of some characters while serif do not
  • sans-serif fonts are monospaced while serif have variable width
  • serif fonts are monospaced while sans-serif have variable width
  • sans-serif fonts can be used without paying a royalty, while a royalty must be paid for serif fonts

Pregunta 20

Pregunta
Which of the following is not a valid variable in PHP?
Respuesta
  • $1name
  • $name
  • $_name1
  • $name1
  • $Name

Pregunta 21

Pregunta
In PHP what is the value of $a $s = "Hello World"; $a = $s[7];
Respuesta
  • "o"
  • you will get an error
  • "Hello"
  • "W"
  • 7

Pregunta 22

Pregunta
In PHP, what will be the output of the following code $a = "hello "; $b = "world "; $c = 10; print $a . $c . $b ;
Respuesta
  • you will get an error
  • hello 10 world
  • 10
  • hello world
  • hello

Pregunta 23

Pregunta
[HTML] In PHP, what is the output of the following code: $a = 10; $b = "10"; if ($a == $b) { print "hello "; } print "world";
Respuesta
  • hello
  • world
  • $a
  • $b
  • hello world

Pregunta 24

Pregunta
In CSS the selector #p matches
Respuesta
  • all <p> elements
  • all elements whose class is p
  • all elements whose id is p
  • all <p> elements whose id is p
  • all <p> elements whose class is p

Pregunta 25

Pregunta
The background of a given HTML element can be manipulated with
Respuesta
  • you cannot change the background of an element
  • only background-image
  • background-color, background-image
  • only background-color

Pregunta 26

Pregunta
In CSS which property is used to control the horizontal alignment of text in an element?
Respuesta
  • text-align
  • alignment
  • center-align
  • center
  • align

Pregunta 27

Pregunta
$a = 2 + 3 * 5 + 10; print $a;
Respuesta
  • 27
  • 23510
  • 35
  • 20

Pregunta 28

Pregunta
It is possible to define CSS in
Respuesta
  • only inline
  • only in external style sheets and internal style sheets
  • only in external style sheets
  • only in internal style sheets
  • external style sheets, internal style sheets, and inline

Pregunta 29

Pregunta
Which of the following is the correct HTML to refer to an external style sheet style.css ?
Respuesta
  • <style "style.css\">
  • <link rel="stylesheet" type="text/css" href="style.css">
  • <style> style.css</style>
  • <css rel="stylesheet" type="text/css" href="style.css">
  • <css> style.css</css>

Pregunta 30

Pregunta
What does CSS stand for?
Respuesta
  • Cascading Style Sheets
  • Computer Style Sheets
  • CSS does not stand for anything
  • Computer Symbol Sheets
  • Cascading Symbols and Symptoms

Pregunta 31

Pregunta
In PHP what is the data type of the variable $c? $a = "10"; $b = "20"; $c = $a * $b;
Respuesta
  • array
  • float
  • string
  • boolean
  • integer

Pregunta 32

Pregunta
CSS enables links to be styled differently depending on what state they are in. To set the hover colour for a link to be white, one would code a CSS rule
Respuesta
  • a { color : white ; hover : true ;}
  • a:link { color : white ; }
  • a { color : white ; hover-dwell : true ;}
  • a { hover-color : white ;}
  • a:hover { color : white ; }

Pregunta 33

Pregunta
In CSS, which property would be used to allow an image to be positioned on the right?
Respuesta
  • clear: right
  • float: right
  • align: righ
  • overflow: hidden

Pregunta 34

Pregunta
In CSS, what is the range for the R, G, B when specifying a color using rgb(R, G, B) ?
Respuesta
  • 1-256
  • 0xFFFFFF
  • 0-255
  • 1-100
  • 0-1

Pregunta 35

Pregunta
In PHP what is the data type of the variable $c? $a = 10; $b = 1.238; $c = $a * $b;
Respuesta
  • String
  • array
  • float
  • integer
  • boolean

Pregunta 36

Pregunta
In CSS a rule has the syntax a { b : c ; }. In this rule the symbol a is known as a
Respuesta
  • parameter
  • Selector
  • value
  • comment
  • property

Pregunta 37

Pregunta
In PHP, what would be the output of the following code: $a = 10; $b = 10; print "$a * $b";
Respuesta
  • 100
  • 10*10
  • $a*$b
  • you will get an error

Pregunta 38

Pregunta
In CSS the selector p matches
Respuesta
  • all <p> elements
  • all elements whose class is p
  • all elements whose id is p
  • all <p> elements whose id is p
  • all <p> elements whose class is p

Pregunta 39

Pregunta
Which of the following would change the background colour for all <h1> elements to white?
Respuesta
  • h1.all { background-color: white }
  • h1 { background-color: white }
  • header1 { background-color: white }
  • .h1 { background-color: white }

Pregunta 40

Pregunta
In CSS which property is used to control the background color?
Respuesta
  • colour
  • background-color
  • color-background
  • bgcolor
  • color

Pregunta 41

Pregunta
Which of the following is a valid CSS selector ?
Respuesta
  • p.color { red; }
  • p color: red;
  • p color red
  • p { color: red; }
  • p { color red }

Pregunta 42

Pregunta
Which of the following will cause you to open the link in a new tab or browser window?
Respuesta
  • <a href="http:www.cse.yorku.ca" target="_blank">
  • <a href="http:www.cse.yorku.ca" target="_top">
  • <a href="http:www.cse.yorku.ca" target="_new">
  • <a href="http:www.cse.yorku.ca" target="new">
  • <a href="http:www.cse.yorku.ca" target="/">

Pregunta 43

Pregunta
Which of the following HTML elements defines the title of a document?
Respuesta
  • <title text="This is a title">
  • <head>This is a title</head>
  • <title>This is a title</title>
  • <meta>This is a title</meta>
  • <html>This is a title</html>

Pregunta 44

Pregunta
How could you output the following text in HTML?: <p> This is an example of a paragraph tag </p> in HTML
Respuesta
  • <p> <<p>> his is an example of a paragraph tag <<\p>> in HTML </p>
  • <p> "<p> This is an example of a paragraph tag </p> in HTML" </p>
  • <p> \<p\> his is an example of a paragraph tag \</p\>" in HTML </p>
  • <p> &lt;p&gt; This is an example of an paragraph tag &lt;/p&gt; in HTML </p>

Pregunta 45

Pregunta
Which of the following HTML tags are classified as empty or void tags? Choose the most complete answer
Respuesta
  • <hr>
  • No HTML tags are allowed to be empty or void. Incorrect
  • <hr>, <br> and <img>
  • <br> and <p>
  • <hr>, <br> and <p>

Pregunta 46

Pregunta
The syntax of HTML requires that the name and value of an element's attribute be separated by:
Respuesta
  • an equal sign.
  • a semicolon.
  • a tab.
  • one or more spaces.
  • a comma.

Pregunta 47

Pregunta
Every HTML element has a parent element except:
Respuesta
  • <meta>
  • <br/>
  • <head>
  • <html>
  • <body>

Pregunta 48

Pregunta
Which of the following correctly creates a hyperlink?
Respuesta
  • <a href="http:www.yorku.ca">EECS</a>
  • <a name="http:www.yorku.ca">EECS</a>
  • <a url="http:www.yorku.ca">EECS</a>
  • <a "http:www.yorku.ca">EECS</a>
  • <a link="http:www.yorku.ca">EECS</a>

Pregunta 49

Pregunta
The tag <!-- DOCTYPE html --> is interpreted by your browser as ....
Respuesta
  • this is a comment, the browser ignores it.
  • this page is written using a word processor.
  • this page is written using HTML syntax.
  • this page was intentionally left blank.
  • this page has an associated CSS.

Pregunta 50

Pregunta
How would you insert a copyright symbol into a web page?
Respuesta
  • <copyright>
  • <copyright />
  • <symbol tag="copyright" />
  • <sym tag="copyright" />
  • &copy;

Pregunta 51

Pregunta
Which tag is not associated with tables in HTML?
Respuesta
  • <row>
  • <td>
  • <tr>
  • <table>
  • <th>
  • <caption>

Pregunta 52

Pregunta
Which of the following characters is used to indicate the end of a tag?
Respuesta
  • ^
  • *
  • >
  • <
  • #

Pregunta 53

Pregunta
The 'C' in W3C stands for:
Respuesta
  • Consortium
  • Corporation
  • Committee
  • Control
  • Central

Pregunta 54

Pregunta
It is important that your web pages follow web standards so that
Respuesta
  • they will render properly over a range of different browsers and devices.
  • they will be approved by Google.
  • they will be more efficient to compress and transfer across the web.

Pregunta 55

Pregunta
meta tags in the header section of a web page
Respuesta
  • supports caching that otherwise would not be possible
  • enable the browser to render your page more efficiently.
  • enable the server to transmit your page more efficiently.
  • provide valuable information to search engines and browsers about the structure and content of your document.
  • support global name search and replace.

Pregunta 56

Pregunta
The WWW is attributed to which person?
Respuesta
  • Bill Gates
  • Tim Cerf
  • Vincent Cerf
  • Tim Berners-Lee

Pregunta 57

Pregunta
Which protocol provides multiplex?
Respuesta
  • Transmission Control Protocol
  • Hypertext Transport Protocol
  • Data Layer Protocol
  • Internet Protocol

Pregunta 58

Pregunta
Which of the following characters is used to indicate the start of a tag?
Respuesta
  • <
  • >
  • *
  • #
  • ^

Pregunta 59

Pregunta
The syntax template for a basic html page will ...
Respuesta
  • Use <head> ... </head> tags to identify the author of the page.
  • Surround the page with <html> ... </html> tags.
  • Properly indent material within the page so that it is readable.
  • Surround the page with <head> ... </head> tags.
  • Begin with <html> and end with </body>

Pregunta 60

Pregunta
Which group is in charge of deciding top-level domain names?
Respuesta
  • W3C
  • ICANN
  • IETF
  • Google

Pregunta 61

Pregunta
Which is not a valid URL format?
Respuesta
  • http://yorku.ca
  • http://130.63.236.137/index.html
  • http://yorku.ca:80
  • http://www.textpad.com/download/index.html
  • 1Wh8RzcQZr4
  • http://www.youtube.com/watch?v

Pregunta 62

Pregunta
HTML is intended to ...
Respuesta
  • provide an efficient representation to download material from the web.
  • provide neither appearance nor structure to a document.
  • provide both appearance and structure to a document.
  • provide the appearance of a document but not specify its structure.
  • provide structure and content to a document but not specify its appearance.

Pregunta 63

Pregunta
Text that is be emphasized should be surrounded with
Respuesta
  • <emphasize> and </emphasize>
  • <em> and </em>
  • <i> and </i>
  • <b> and </b>
  • <font size="large"> and </font>

Pregunta 64

Pregunta
Which of the following tags starts a numbered list?
Respuesta
  • <list type="numbered">
  • <list>
  • <ol>
  • <ul>
  • <numbered>

Pregunta 65

Pregunta
In HTML comments start with ... and end with ...
Respuesta
  • they start with <comment> and end with </comment>
  • they start with /** and end with **/
  • they start with <!-- and end with -->
  • they start with // and end with a carriage return
  • they start with /* and end with */

Pregunta 66

Pregunta
In HTML, paragraphs start with ... and end with ....
Respuesta
  • start with <center> and end with </p>
  • start with <p> and end with <li>
  • start with <br> and end with </br>
  • start with <p> and end with </p>
  • start with <p> and end with <ol>

Pregunta 67

Pregunta
In HTML the following heading tags are permitted
Respuesta
  • <head>
  • <h1> through <h6>
  • <h1> through <h9>
  • <heading>, <subheading>, <subsubheading>
  • <heading>, <subhead>, <subsubhead>

Pregunta 68

Pregunta
Which of the following is correct HTML5 for displaying an image?
Respuesta
  • <img file="image gif" alt="an image">
  • <img src="image.gif" alt="an image">
  • <img src="image.gif">
  • <image src="image.gif" alt="an image">
  • <image alt="image.gif">

Pregunta 69

Pregunta
Are the Internet and WWW the same thing?
Respuesta
  • No
  • Yes

Pregunta 70

Pregunta
If some text is preceded by <p><em> then it must be proceeded by:
Respuesta
  • </p em>
  • </p></em>
  • </em></p>
  • </em /p>
  • any of the above.

Pregunta 71

Pregunta
Which is not a valid IP address format?
Respuesta
  • 200.43.33.34
  • 128.0.44.1
  • 56.0.267.34
  • 1.21.44.129

Pregunta 72

Pregunta
Which of the following tags starts a bulleted list?
Respuesta
  • <bulleted>
  • <ol>
  • <list>
  • <ul>
  • <list type="bulleted">

Pregunta 73

Pregunta
Which of the following tags creates a definition list?
Respuesta
  • <dl>
  • <nl>
  • <ol>
  • <ul>
  • <li>

Pregunta 74

Pregunta
Which HTML element will not ignore spaces in text content
Respuesta
  • <h1>
  • <a>
  • <code>
  • 'p"
  • <pre>

Pregunta 75

Pregunta
Tags that are not directly displayed on the page are written in the _____ section.
Respuesta
  • <title>
  • <head>
  • <html>
  • <p>
  • <body>

Pregunta 76

Pregunta
Which of the following is true about block and inline elements in HTML?
Respuesta
  • Block elements represent blocks of text. All other entries are in-line elements.
  • Block elements generally represent a relatively large portion of a page and may contain other tags within it. Inline elements generally represent smaller portions of a page and are contained within a block element.
  • Block elements generally represent a relatively large poriton of a page, but cannot contain other elements wihtin them. Inline elements generally represent smaller portions of a page and are contained within nesting elements.
  • Block elements are the building blocks of html documents and must be contained within inline elements.
  • Block elements, nested elements, and inline elements must all be contained within meta elements.

Pregunta 77

Pregunta
What is the correct HTML element for inserting a line break?
Respuesta
  • <h1>
  • <br>
  • <p>
  • <paragraph>
  • <break>

Pregunta 78

Pregunta
Which of the following is not an HTML element?
Respuesta
  • DOCTYPE
  • html
  • img
  • table
  • body

Pregunta 79

Pregunta
Which server is used to help determine the IP address of yorku.ca
Respuesta
  • Apache Web Server
  • Domain Name Server
  • Microsoft Internet Information Server (IIS)
  • Google Server

Pregunta 80

Pregunta
meta tags in the header section of a web page
Respuesta
  • support global name search and replace.
  • enable the server to transmit your page more efficiently
  • provide valuable information to search engines and browsers about the structure and content of your document
  • supports caching that otherwise would not be possible.
  • enable the browser to render your page more efficiently.

Pregunta 81

Pregunta
The WWW is attributed to which person?
Respuesta
  • Bill Gates
  • Tim Cerf
  • Tim Berners-Lee
  • Vincent Cerf

Pregunta 82

Pregunta
In PHP, what is the output of the following code? $a = "a|b|c|d|e|f|g"; $c = explode("|", $a); print $c[1];
Respuesta
  • b
  • a
  • |
  • d
  • a|b|c|d|e|f|g

Pregunta 83

Pregunta
In PHP file I/O what does the function file_get_contents() do?
Respuesta
  • returns a single string with the entire contents of the file
  • returns an array of strings where each string is a line in the file
  • writes data to a file
  • checks to see if a file exists

Pregunta 84

Pregunta
In HTML forms, input type="____" is a submit button?
Respuesta
  • submitbutton
  • submit
  • text
  • value="submit"

Pregunta 85

Pregunta
In PHP, what would be the output of the following? $nickname = array("Robert" => "Bob", "Michael" => "Mike", "Abdelraham" => "Abdo", "Yaoling" => "Yaoyoa"); print $nickname["Robert"];
Respuesta
  • Abdo
  • Mike
  • Yaoyao
  • Bob

Pregunta 86

Pregunta
In PHP file I/O, file() does what?
Respuesta
  • returns an array of strings where each string is a line in the file
  • writes data to a file
  • returns a single string with the entire contents of the file
  • checks to see if a file exists

Pregunta 87

Pregunta
In HTML forms, what is the CSS selector for an input type="text"?
Respuesta
  • .input text
  • input .text
  • input[type="text"]
  • input["type=text"]
  • ["type=text"]

Pregunta 88

Pregunta
In PHP, what would be the value of the variable $c? $a = array("red", "green", "blue", "yellow"); $c = count($a);
Respuesta
  • 3
  • yellow
  • 5
  • 4

Pregunta 89

Pregunta
In PHP, what is the output of the following code? $a = array("Abdel", "Didi", "Justin", "Trump"); if (in_array("Ford", $a)) { print "found"; } else { print "not found"; }
Respuesta
  • found
  • no output
  • this will cause an error
  • not found

Pregunta 90

Pregunta
Which line of the following PHP code has an error? 0: $c = rand(1,10); 1: if ( c == 5 ) 2: { 3: print " $color "; 4: }
Respuesta
  • 2
  • 0
  • 4
  • 1
  • 3

Pregunta 91

Pregunta
What variable in PHP is used to access data passed via the post method in HTML forms?
Respuesta
  • $_POST
  • $POST
  • $_DATA
  • $GET
  • $_GET

Pregunta 92

Pregunta
What are the results of the following boolean expressions? 1) 5 < 4 2) 10 > 5 3) 5 == 20
Respuesta
  • 1) true , 2) true, 3) true
  • 1) true, 2) false, 3) false
  • 1) false, 2) false, 3) false
  • 1) false, 2) true, 3) false

Pregunta 93

Pregunta
In HTML forms, input type="____" is a radio button?
Respuesta
  • radio button
  • radio
  • check
  • rad
  • radiobutton

Pregunta 94

Pregunta
Which file I/O function writes a data to a file in PHP?
Respuesta
  • file()
  • file_get_contents()
  • file_put_contents()
  • printfile()
  • file_write_contents()

Pregunta 95

Pregunta
In PHP, what is the value of the variable $c? $a = array("red", "green", "yellow"); $b = "hello"; $c = $b . " " . strtoupper($a[1]);
Respuesta
  • hello RED
  • HELLO GREEN
  • hello GREEN
  • hello RED GREEN YELLOW
  • HELLO RED

Pregunta 96

Pregunta
What variable in PHP is used to access data passed via the URL?
Respuesta
  • $_GET
  • $GET
  • $_POST
  • $POST
  • $_DATA

Pregunta 97

Pregunta
In HTML forms, the HTML element label does what?
Respuesta
  • specifics the URL for the data to be sent to
  • associates text with an UI input
  • creates a label icon
  • creates a text input
  • creates a box around some UI

Pregunta 98

Pregunta
Using HTML forms, the tag <form method="___"> transmits data from the form using the URL?
Respuesta
  • put
  • post
  • get
  • url

Pregunta 99

Pregunta
In HTML forms, which UI tag does not require a close tag?
Respuesta
  • <form>
  • <input>
  • <textarea>
  • <select>

Pregunta 100

Pregunta
In PHP, what would be the output of the following? $a = "hello world"; print $a[0];
Respuesta
  • l
  • you will get an error
  • h
  • hello

Pregunta 101

Pregunta
What is the output of the following PHP code? $a = "string"; $a = strtoupper($a); print $a[4];
Respuesta
  • STRING
  • I
  • i
  • N
  • n

Pregunta 102

Pregunta
In PHP, $a[] = "hello" does what?
Respuesta
  • this will cause a syntax error in PHP
  • appends the string "hello" to the end of the array
  • sets all array elements to "hello"
  • puts the string "hello" at the beginning of the array

Pregunta 103

Pregunta
In JavaScript, which of the following is not a valid comparison operator?
Respuesta
  • ===
  • !=
  • >=
  • =!=
  • ==
  • !==

Pregunta 104

Pregunta
Consider the following JavaScript code snippet var q = 1 + 2 + parseInt("3"); After this executes, what value does q have?
Respuesta
  • 33
  • 6
  • 123
  • "123"

Pregunta 105

Pregunta
In JavaScript, after executing var x = "hello"; then if you wanted to have var z have the value of the number of characters in x, you could use
Respuesta
  • var z = x.length();
  • var z = length(x);
  • var z = x.length;
  • var z = 3;
  • var z = x.len;

Pregunta 106

Pregunta
In JavaScript, after executing var x= "hello"; then if you wanted to have var z contain a string of the last character in x, you could use
Respuesta
  • var z = x.charAt(4);
  • var z = 'h';
  • var z = x.charAt(3);
  • var z = x.charAt(-1);
  • var z = "h";

Pregunta 107

Pregunta
Which variables below a global variable? var i=0; function foo() { var a = 10; var b = 20; var c = a*10 + b; }
Respuesta
  • b
  • a
  • i
  • c

Pregunta 108

Pregunta
In JavaScript single line comments start with
Respuesta
  • //
  • /
  • ##
  • #
  • C

Pregunta 109

Pregunta
In JavaScript, after executing var x = 2; var z = 1; if (x == 4) { z = 6; } else { z = 3; } then z has the value
Respuesta
  • 3
  • infinity
  • 4
  • 1
  • 6

Pregunta 110

Pregunta
In JavaScript, after executing var x = 4; var z = 1; if (x > 0) { z = 2; } then z has the value
Respuesta
  • 4
  • 0
  • 1
  • 2

Pregunta 111

Pregunta
In JavaScript, how many times does the code for(var x=0;x<5;x++) alert("hi"); cause an alert box to appear on the screen?
Respuesta
  • 5
  • 3
  • 4
  • 1
  • 2

Pregunta 112

Pregunta
What global event is called once the HTML page has loaded?
Respuesta
  • HTML.pageLoad
  • window.onload
  • document.pageLoaded
  • window.load
  • document.onload

Pregunta 113

Pregunta
In JavaScript, which of the following is interpreted as being false in a logical expression
Respuesta
  • NaN
  • 123
  • 3.1415
  • true
  • "hello world"

Pregunta 114

Pregunta
In JavaScript multiple line comments are surround with
Respuesta
  • // and //
  • /* and *
  • ## and ##
  • // and */
  • /* and //

Pregunta 115

Pregunta
Consider the following HTML code: <div id="myDiv"> <p id="myP"> This is a test.</p> </div> How do you access the paragraph element above in JavaScript?
Respuesta
  • var a='<p id="myP">';
  • var a=document.getElementById("myP");
  • var a=document.getElementById("p);
  • var a=document.getElementById("myDiv);

Pregunta 116

Pregunta
In JavaScript, after executing var x = "2"; var y = "2"; var z = x + y; then the value of z is
Respuesta
  • 22
  • "22"
  • this is invalid and will cause a run time error
  • 4

Pregunta 117

Pregunta
In JavaScript, after executing var x = 10; var z = "" + x; then the value of z is
Respuesta
  • "1","0"
  • 10
  • "10"
  • ""
  • this is invalid and will cause a run time error

Pregunta 118

Pregunta
What does DOM stand for?
Respuesta
  • Direct Object Manipulation
  • Document Object Model
  • Document Object Module
  • Detailed Object Map

Pregunta 119

Pregunta
Which of the following is not a fundamental type in JavaScript?
Respuesta
  • Number
  • Module
  • String
  • Boolean
  • Array

Pregunta 120

Pregunta
What is the proper way to define an array in JS?
Respuesta
  • var a =["a", "b", "c", "d"];
  • var a =("a", "b", "c", "d");
  • var a ="a", "b", "c", "d";
  • var a =array("a", "b", "c", "d");

Pregunta 121

Pregunta
How would you create an alert box with "Hello" in JavaScript?
Respuesta
  • print("Hello")
  • alert("Hello")
  • log("Hello")
  • msgBox("Hello")
  • dialog("Hello")

Pregunta 122

Pregunta
The following code is considered? <button id="ok" onclick="okayClick();">OK</button>
Respuesta
  • obtrusive JavaScript
  • unobtrusive JavaScript

Pregunta 123

Pregunta
Consider the following JavaScript code. What type is the variable p? var p = document.getElementsByTagName("p");
Respuesta
  • an array of element objects
  • a DOM tree
  • a paragraph
  • an element object

Pregunta 124

Pregunta
What does the following JavaScript code do? var myP = document.getElementById("myP"); myP.children[1].style.backgroundColor = "silver";
Respuesta
  • Sets the background color to silver of the third child of element id="myP"
  • Modifies all children of elemetn id="myP"
  • Sets the background color to silver of the first child of element id="myP"
  • Sets the element id="myP" background to silver
  • Sets the second child of element id="myP" background to silver

Pregunta 125

Pregunta
Based on the following JS code which variable is local scoped? var a=10; function myFunc() { var c=document.getElementById("myPar"); }
Respuesta
  • a
  • document
  • both a and c
  • c

Pregunta 126

Pregunta
What does the following JavaScript code snippet do? $("button").stopObserving("mousemove");
Respuesta
  • removes the event handler function named "mousemove"
  • stops the mouse from moving over any buttons
  • removes the event handler function named "mousemove" for element with id="button"
  • removes the event handler function for "mousemove" events for element with id="button"

Pregunta 127

Pregunta
In the Prototype library, the $("p") function is equivalent to?
Respuesta
  • document.getElementsByTagName("p");
  • document.createElement("p");
  • document.getElementByTagName("p");
  • document.getElementById("p");

Pregunta 128

Pregunta
When does the global event "window.onload" get called?
Respuesta
  • As soon as the JS file is linked to the HTML page.
  • When a new window is created by an alert().
  • Only when the browser's refresh button is pressed.
  • After the webpage has been loaded.

Pregunta 129

Pregunta
Consider the following JavaScript code: 0: var allParas = document.getElementsByTagName("p"); 1: for (var i = 0; i < allParas.length; i++) { 2: ??? 3: } What code should be placed on line 2 to make the background color of all p elements silver?
Respuesta
  • allParas[i].style.backgroundColor = "silver";
  • allParas[i].backgroundColor = "silver";
  • allParas.style.backgroundColor = "silver";
  • allParas.backgroundColor = "silver";

Pregunta 130

Pregunta
Are the following two lines of code equivalent? $("button").observe("click", myClick); $("button").onclick = myClick;
Respuesta
  • No
  • Yes

Pregunta 131

Pregunta
In Javascript, if you wanted to set a timer that calls function "myFunc" every second, which statement would you use?
Respuesta
  • setTimeout(myFunc, 1000);
  • setInterval(myFunc, 1000);
  • setInterval(1000, myFunc);
  • setTimeout(myFunc, 1000, REPEAT);
  • setRepeat(myFunc, 1000);

Pregunta 132

Pregunta
Consider the following HTML form object: <input type="text" id="name"> How do you access content the user typed into this text field?
Respuesta
  • $("name").data
  • $("name").innerHTML
  • $("name").submit()
  • $("name").value

Pregunta 133

Pregunta
Assume function myClick is already defined. Which line in the following JavaScript code contains an error? 0: var allPars = document.getElementsByTagName("p"); 1: var myButton = document.getElementById("myButton"); 2: myButton.onclick = myClick; 3: allPars.onclick = myClick;
Respuesta
  • 3
  • 0
  • 2
  • 1
  • There is no error in this code.

Pregunta 134

Pregunta
Consider the following HTML code as a DOM tree: <div id="myDiv"> <h1> Hello </h1> <p> This is a test. </p> <p> This is only <a href=""> a test. </a> </p> <p> There will be one more test. </p> </div> Is the h1 element an ancestor of the element <a>?
Respuesta
  • No
  • Yes

Pregunta 135

Pregunta
Consider the following HTML: 0: <div> 1: <h1> A </h1> 2: <p> B </p> 3: <p> C </p> 4: </div> which statement would return the element at line 3?
Respuesta
  • $("p")
  • getElementById("p")
  • $("h1").children[0]
  • $("div").children[2]

Pregunta 136

Pregunta
Using the Prototype library, which of the following would be used to submit a form?
Respuesta
  • $("myForm").submitForm();
  • document.submit();
  • $("myForm").submit();
  • $("myForm").submit = true;

Pregunta 137

Pregunta
Consider the following HTML code as a DOM tree: <div id="myDiv> <h1> Hello </h1> <p> This is a test. </p> <p> This is only <a myid="a" href=""> a test. </a> </p> <p> There will be one more test. </p> </div> Is the element myid="a" a child of the div element?
Respuesta
  • no
  • yes

Pregunta 138

Pregunta
Consider the following HTML code as a DOM tree: <div id="myDiv> <h1> Hello </h1> <p> This is a test. </p> <p> This is only <a href=""> a test. </a> </p> <p> There will be one more test. </p> </div> How many descendant element nodes does the div have?
Respuesta
  • 5
  • 0
  • 3
  • 4

Pregunta 139

Pregunta
What does the variable "this" refer to in the following JavaScript function: function clickHandler() { this.innerHTML = "clicked"; }
Respuesta
  • it refers to an HTML button element.
  • it refers to document.getElementsByTag("this").
  • it refers to an HTML checkbox element.
  • it refers to the HTML element object that called this function.

Pregunta 140

Pregunta
In JavaScript, does the DOM tree include the head section of the HTML page?
Respuesta
  • no
  • yes

Pregunta 141

Pregunta
Consider the following HTML and JS code. What is the value of pars.length? <body> <p> Paragraph 1 </p> <div id="myDiv"> <p> Paragraph 2 </p> </div> </body> var myDiv=document.getElementById("myDiv"); var pars=document.getElementsByTagName("p");
Respuesta
  • 2
  • 3
  • 1
  • 0

Pregunta 142

Pregunta
How would you create a new DOM node of type <p> in JavaScript?
Respuesta
  • document.createElement("p");
  • $("p").create();
  • document.newParagraph(1);
  • document.createTextNode("<p>");
  • document.getElementById("p");

Pregunta 143

Pregunta
In JavaScript, does the DOM tree include the head section of the HTML page?
Respuesta
  • no
  • yes

Pregunta 144

Pregunta
Consider the following JavaScript code. When will the function "myFunc" be called? window.onload = function() { setTimeout(myFunc, 1500); }
Respuesta
  • After 1.5 seconds after the window.onload event
  • After 3pm on the current day the webpage is being accessed.
  • After 1500 seconds after the window.onload event
  • After 15 seconds after the window.onload event

Pregunta 145

Pregunta
What does the following JavaScript code snippet do? $("button").stopObserving("mousemove");
Respuesta
  • stops the mouse from moving over any buttons
  • removes the event handler function named "mousemove"
  • removes the event handler function for "mousemove" events for element with id="button"
  • removes the event handler function named "mousemove" for element with id="button"

Pregunta 146

Pregunta
When does the global event "window.onload" get called?
Respuesta
  • After the webpage has been loaded.
  • Only when the browser's refresh button is pressed.
  • When a new window is created by an alert().
  • As soon as the JS file is linked to the HTML page.

Pregunta 147

Pregunta
In JavaScript, which of the following provides the X coordinates with respect to the HTML element the mouse is over?
Respuesta
  • event.browserX
  • event.offsetX
  • event.clientX
  • event.screenX

Pregunta 148

Pregunta
When interpreted as a DOM tree, how child nodes does div id="myDiv" have has children? <p> Paragraph 1 </p> <div id="myDiv"> <ul> <li> Item 1 </li> <li> Item 2 </li> <li> Item 3 </li> </ul> </div> <p> Paragraph 2 </p>
Respuesta
  • 3
  • 1
  • <ul>
  • 4

Pregunta 149

Pregunta
Consider the following JS Prototype code. When will the function "myFunc" be called? $("myPar").observe("mouseover", myFunc); $("myPar").observe("keydown", myVar)
Respuesta
  • anytime an event occurs with element id="myPar"
  • when the mouse cursor enters element id="myPar"
  • anytime the mouse cursor moves within the element id="myPar"
  • when a key is pressed down over element id="myPar"

Pregunta 150

Pregunta
In JavaScript, what command can be used to remove a node from the DOM tree?
Respuesta
  • document.removeChild(...)
  • document.killChild(...)
  • document.unappendChild(...)
  • document.deleteChild(...)

Pregunta 151

Pregunta
Consider the following HTML code as a DOM tree. How many children does the <body> element have? <body> <h1> My webpage </h1> <div> <p> Testing. </p> <p> Another paragraph. </p> </div> </body>
Respuesta
  • 2
  • 0
  • 1
  • 4
Mostrar resumen completo Ocultar resumen completo

Similar

Computing Hardware - CPU and Memory
ollietablet123
SFDC App Builder 2
Parker Webb-Mitchell
Data Types
Jacob Sedore
Intake7 BIM L1
Stanley Chia
Software Processes
Nurul Aiman Abdu
Design Patterns
Erica Solum
CCNA Answers – CCNA Exam
Abdul Demir
Abstraction
Shannon Anderson-Rush
Spyware
Sam2
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Data Analytics
anelvr