Practice midterm-2

Descrição

Computer Science Quiz sobre Practice midterm-2, criado por Jimit Thakkar em 01-12-2017.
Jimit Thakkar
Quiz por Jimit Thakkar, atualizado more than 1 year ago
Jimit Thakkar
Criado por Jimit Thakkar quase 7 anos atrás
368
1

Resumo de Recurso

Questão 1

Questão
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?
Responda
  • silly { text-align: center; }
  • p.silly { align: center; }
  • p
  • p.silly { text-align: center; }
  • p < silly { align: center; }

Questão 2

Questão
In CSS the selector .par matches
Responda
  • 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

Questão 3

Questão
In PHP, what is the output of the following code $a = 2; $a = $a + 2; $a++; print $a;
Responda
  • 8
  • 2
  • 5
  • 6
  • 4

Questão 4

Questão
In CSS which property is used to control the size of the text?
Responda
  • font
  • text-style
  • font-style
  • text-size
  • font-size

Questão 5

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

Questão 6

Questão
$a = 10; $b = 5; print '$a*$b';
Responda
  • 10*5
  • 50
  • you will get an error
  • $a*$b

Questão 7

Questão
Which of the following is a valid CSS selector ?
Responda
  • p { color red }
  • p color red
  • p { color: red; }
  • p color: red;
  • p.color { red; }

Questão 8

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

Questão 9

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

Questão 10

Questão
What is the order of priority (from highest to lowest) that styles are applied to an element?
Responda
  • 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

Questão 11

Questão
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; }
Responda
  • 100
  • 110
  • 105
  • 120
  • 90

Questão 12

Questão
In CSS the selector p matches
Responda
  • 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

Questão 13

Questão
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: }
Responda
  • 0
  • 1
  • 4
  • 2

Questão 14

Questão
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; }
Responda
  • 120
  • 130
  • 150
  • 100

Questão 15

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

Questão 16

Questão
In CSS which property is used to control the background color?
Responda
  • color
  • backgroung-color
  • background-colour
  • bgcolor

Questão 17

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

Questão 18

Questão
In CSS which property is used to control the text color of an element?
Responda
  • text-color
  • background-color
  • foreground-color
  • text-colour
  • color

Questão 19

Questão
The difference between serif and sans-serif fonts is that
Responda
  • 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

Questão 20

Questão
Which of the following is not a valid variable in PHP?
Responda
  • $1name
  • $name
  • $_name1
  • $name1
  • $Name

Questão 21

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

Questão 22

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

Questão 23

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

Questão 24

Questão
In CSS the selector #p matches
Responda
  • 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

Questão 25

Questão
The background of a given HTML element can be manipulated with
Responda
  • you cannot change the background of an element
  • only background-image
  • background-color, background-image
  • only background-color

Questão 26

Questão
In CSS which property is used to control the horizontal alignment of text in an element?
Responda
  • text-align
  • alignment
  • center-align
  • center
  • align

Questão 27

Questão
$a = 2 + 3 * 5 + 10; print $a;
Responda
  • 27
  • 23510
  • 35
  • 20

Questão 28

Questão
It is possible to define CSS in
Responda
  • 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

Questão 29

Questão
Which of the following is the correct HTML to refer to an external style sheet style.css ?
Responda
  • <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>

Questão 30

Questão
What does CSS stand for?
Responda
  • Cascading Style Sheets
  • Computer Style Sheets
  • CSS does not stand for anything
  • Computer Symbol Sheets
  • Cascading Symbols and Symptoms

Questão 31

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

Questão 32

Questão
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
Responda
  • a { color : white ; hover : true ;}
  • a:link { color : white ; }
  • a { color : white ; hover-dwell : true ;}
  • a { hover-color : white ;}
  • a:hover { color : white ; }

Questão 33

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

Questão 34

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

Questão 35

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

Questão 36

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

Questão 37

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

Questão 38

Questão
In CSS the selector p matches
Responda
  • 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

Questão 39

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

Questão 40

Questão
In CSS which property is used to control the background color?
Responda
  • colour
  • background-color
  • color-background
  • bgcolor
  • color

Questão 41

Questão
Which of the following is a valid CSS selector ?
Responda
  • p.color { red; }
  • p color: red;
  • p color red
  • p { color: red; }
  • p { color red }

Questão 42

Questão
Which of the following will cause you to open the link in a new tab or browser window?
Responda
  • <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="/">

Questão 43

Questão
Which of the following HTML elements defines the title of a document?
Responda
  • <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>

Questão 44

Questão
How could you output the following text in HTML?: <p> This is an example of a paragraph tag </p> in HTML
Responda
  • <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>

Questão 45

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

Questão 46

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

Questão 47

Questão
Every HTML element has a parent element except:
Responda
  • <meta>
  • <br/>
  • <head>
  • <html>
  • <body>

Questão 48

Questão
Which of the following correctly creates a hyperlink?
Responda
  • <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>

Questão 49

Questão
The tag <!-- DOCTYPE html --> is interpreted by your browser as ....
Responda
  • 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.

Questão 50

Questão
How would you insert a copyright symbol into a web page?
Responda
  • <copyright>
  • <copyright />
  • <symbol tag="copyright" />
  • <sym tag="copyright" />
  • &copy;

Questão 51

Questão
Which tag is not associated with tables in HTML?
Responda
  • <row>
  • <td>
  • <tr>
  • <table>
  • <th>
  • <caption>

Questão 52

Questão
Which of the following characters is used to indicate the end of a tag?
Responda
  • ^
  • *
  • >
  • <
  • #

Questão 53

Questão
The 'C' in W3C stands for:
Responda
  • Consortium
  • Corporation
  • Committee
  • Control
  • Central

Questão 54

Questão
It is important that your web pages follow web standards so that
Responda
  • 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.

Questão 55

Questão
meta tags in the header section of a web page
Responda
  • 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.

Questão 56

Questão
The WWW is attributed to which person?
Responda
  • Bill Gates
  • Tim Cerf
  • Vincent Cerf
  • Tim Berners-Lee

Questão 57

Questão
Which protocol provides multiplex?
Responda
  • Transmission Control Protocol
  • Hypertext Transport Protocol
  • Data Layer Protocol
  • Internet Protocol

Questão 58

Questão
Which of the following characters is used to indicate the start of a tag?
Responda
  • <
  • >
  • *
  • #
  • ^

Questão 59

Questão
The syntax template for a basic html page will ...
Responda
  • 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>

Questão 60

Questão
Which group is in charge of deciding top-level domain names?
Responda
  • W3C
  • ICANN
  • IETF
  • Google

Questão 61

Questão
Which is not a valid URL format?
Responda
  • 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

Questão 62

Questão
HTML is intended to ...
Responda
  • 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.

Questão 63

Questão
Text that is be emphasized should be surrounded with
Responda
  • <emphasize> and </emphasize>
  • <em> and </em>
  • <i> and </i>
  • <b> and </b>
  • <font size="large"> and </font>

Questão 64

Questão
Which of the following tags starts a numbered list?
Responda
  • <list type="numbered">
  • <list>
  • <ol>
  • <ul>
  • <numbered>

Questão 65

Questão
In HTML comments start with ... and end with ...
Responda
  • 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 */

Questão 66

Questão
In HTML, paragraphs start with ... and end with ....
Responda
  • 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>

Questão 67

Questão
In HTML the following heading tags are permitted
Responda
  • <head>
  • <h1> through <h6>
  • <h1> through <h9>
  • <heading>, <subheading>, <subsubheading>
  • <heading>, <subhead>, <subsubhead>

Questão 68

Questão
Which of the following is correct HTML5 for displaying an image?
Responda
  • <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">

Questão 69

Questão
Are the Internet and WWW the same thing?
Responda
  • No
  • Yes

Questão 70

Questão
If some text is preceded by <p><em> then it must be proceeded by:
Responda
  • </p em>
  • </p></em>
  • </em></p>
  • </em /p>
  • any of the above.

Questão 71

Questão
Which is not a valid IP address format?
Responda
  • 200.43.33.34
  • 128.0.44.1
  • 56.0.267.34
  • 1.21.44.129

Questão 72

Questão
Which of the following tags starts a bulleted list?
Responda
  • <bulleted>
  • <ol>
  • <list>
  • <ul>
  • <list type="bulleted">

Questão 73

Questão
Which of the following tags creates a definition list?
Responda
  • <dl>
  • <nl>
  • <ol>
  • <ul>
  • <li>

Questão 74

Questão
Which HTML element will not ignore spaces in text content
Responda
  • <h1>
  • <a>
  • <code>
  • 'p"
  • <pre>

Questão 75

Questão
Tags that are not directly displayed on the page are written in the _____ section.
Responda
  • <title>
  • <head>
  • <html>
  • <p>
  • <body>

Questão 76

Questão
Which of the following is true about block and inline elements in HTML?
Responda
  • 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.

Questão 77

Questão
What is the correct HTML element for inserting a line break?
Responda
  • <h1>
  • <br>
  • <p>
  • <paragraph>
  • <break>

Questão 78

Questão
Which of the following is not an HTML element?
Responda
  • DOCTYPE
  • html
  • img
  • table
  • body

Questão 79

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

Questão 80

Questão
meta tags in the header section of a web page
Responda
  • 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.

Questão 81

Questão
The WWW is attributed to which person?
Responda
  • Bill Gates
  • Tim Cerf
  • Tim Berners-Lee
  • Vincent Cerf

Questão 82

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

Questão 83

Questão
In PHP file I/O what does the function file_get_contents() do?
Responda
  • 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

Questão 84

Questão
In HTML forms, input type="____" is a submit button?
Responda
  • submitbutton
  • submit
  • text
  • value="submit"

Questão 85

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

Questão 86

Questão
In PHP file I/O, file() does what?
Responda
  • 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

Questão 87

Questão
In HTML forms, what is the CSS selector for an input type="text"?
Responda
  • .input text
  • input .text
  • input[type="text"]
  • input["type=text"]
  • ["type=text"]

Questão 88

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

Questão 89

Questão
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"; }
Responda
  • found
  • no output
  • this will cause an error
  • not found

Questão 90

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

Questão 91

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

Questão 92

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

Questão 93

Questão
In HTML forms, input type="____" is a radio button?
Responda
  • radio button
  • radio
  • check
  • rad
  • radiobutton

Questão 94

Questão
Which file I/O function writes a data to a file in PHP?
Responda
  • file()
  • file_get_contents()
  • file_put_contents()
  • printfile()
  • file_write_contents()

Questão 95

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

Questão 96

Questão
What variable in PHP is used to access data passed via the URL?
Responda
  • $_GET
  • $GET
  • $_POST
  • $POST
  • $_DATA

Questão 97

Questão
In HTML forms, the HTML element label does what?
Responda
  • 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

Questão 98

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

Questão 99

Questão
In HTML forms, which UI tag does not require a close tag?
Responda
  • <form>
  • <input>
  • <textarea>
  • <select>

Questão 100

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

Questão 101

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

Questão 102

Questão
In PHP, $a[] = "hello" does what?
Responda
  • 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

Questão 103

Questão
In JavaScript, which of the following is not a valid comparison operator?
Responda
  • ===
  • !=
  • >=
  • =!=
  • ==
  • !==

Questão 104

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

Questão 105

Questão
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
Responda
  • var z = x.length();
  • var z = length(x);
  • var z = x.length;
  • var z = 3;
  • var z = x.len;

Questão 106

Questão
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
Responda
  • var z = x.charAt(4);
  • var z = 'h';
  • var z = x.charAt(3);
  • var z = x.charAt(-1);
  • var z = "h";

Questão 107

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

Questão 108

Questão
In JavaScript single line comments start with
Responda
  • //
  • /
  • ##
  • #
  • C

Questão 109

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

Questão 110

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

Questão 111

Questão
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?
Responda
  • 5
  • 3
  • 4
  • 1
  • 2

Questão 112

Questão
What global event is called once the HTML page has loaded?
Responda
  • HTML.pageLoad
  • window.onload
  • document.pageLoaded
  • window.load
  • document.onload

Questão 113

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

Questão 114

Questão
In JavaScript multiple line comments are surround with
Responda
  • // and //
  • /* and *
  • ## and ##
  • // and */
  • /* and //

Questão 115

Questão
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?
Responda
  • var a='<p id="myP">';
  • var a=document.getElementById("myP");
  • var a=document.getElementById("p);
  • var a=document.getElementById("myDiv);

Questão 116

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

Questão 117

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

Questão 118

Questão
What does DOM stand for?
Responda
  • Direct Object Manipulation
  • Document Object Model
  • Document Object Module
  • Detailed Object Map

Questão 119

Questão
Which of the following is not a fundamental type in JavaScript?
Responda
  • Number
  • Module
  • String
  • Boolean
  • Array

Questão 120

Questão
What is the proper way to define an array in JS?
Responda
  • 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");

Questão 121

Questão
How would you create an alert box with "Hello" in JavaScript?
Responda
  • print("Hello")
  • alert("Hello")
  • log("Hello")
  • msgBox("Hello")
  • dialog("Hello")

Questão 122

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

Questão 123

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

Questão 124

Questão
What does the following JavaScript code do? var myP = document.getElementById("myP"); myP.children[1].style.backgroundColor = "silver";
Responda
  • 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

Questão 125

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

Questão 126

Questão
What does the following JavaScript code snippet do? $("button").stopObserving("mousemove");
Responda
  • 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"

Questão 127

Questão
In the Prototype library, the $("p") function is equivalent to?
Responda
  • document.getElementsByTagName("p");
  • document.createElement("p");
  • document.getElementByTagName("p");
  • document.getElementById("p");

Questão 128

Questão
When does the global event "window.onload" get called?
Responda
  • 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.

Questão 129

Questão
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?
Responda
  • allParas[i].style.backgroundColor = "silver";
  • allParas[i].backgroundColor = "silver";
  • allParas.style.backgroundColor = "silver";
  • allParas.backgroundColor = "silver";

Questão 130

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

Questão 131

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

Questão 132

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

Questão 133

Questão
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;
Responda
  • 3
  • 0
  • 2
  • 1
  • There is no error in this code.

Questão 134

Questão
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>?
Responda
  • No
  • Yes

Questão 135

Questão
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?
Responda
  • $("p")
  • getElementById("p")
  • $("h1").children[0]
  • $("div").children[2]

Questão 136

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

Questão 137

Questão
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?
Responda
  • no
  • yes

Questão 138

Questão
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?
Responda
  • 5
  • 0
  • 3
  • 4

Questão 139

Questão
What does the variable "this" refer to in the following JavaScript function: function clickHandler() { this.innerHTML = "clicked"; }
Responda
  • 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.

Questão 140

Questão
In JavaScript, does the DOM tree include the head section of the HTML page?
Responda
  • no
  • yes

Questão 141

Questão
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");
Responda
  • 2
  • 3
  • 1
  • 0

Questão 142

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

Questão 143

Questão
In JavaScript, does the DOM tree include the head section of the HTML page?
Responda
  • no
  • yes

Questão 144

Questão
Consider the following JavaScript code. When will the function "myFunc" be called? window.onload = function() { setTimeout(myFunc, 1500); }
Responda
  • 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

Questão 145

Questão
What does the following JavaScript code snippet do? $("button").stopObserving("mousemove");
Responda
  • 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"

Questão 146

Questão
When does the global event "window.onload" get called?
Responda
  • 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.

Questão 147

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

Questão 148

Questão
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>
Responda
  • 3
  • 1
  • <ul>
  • 4

Questão 149

Questão
Consider the following JS Prototype code. When will the function "myFunc" be called? $("myPar").observe("mouseover", myFunc); $("myPar").observe("keydown", myVar)
Responda
  • 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"

Questão 150

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

Questão 151

Questão
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>
Responda
  • 2
  • 0
  • 1
  • 4

Semelhante

Computing Hardware - CPU and Memory
ollietablet123
SFDC App Builder 2
Parker Webb-Mitchell
Intake7 BIM L1
Stanley Chia
Data Types
Jacob Sedore
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