Practice midterm-2

Beschreibung

Computer Science Quiz am Practice midterm-2, erstellt von Jimit Thakkar am 01/12/2017.
Jimit Thakkar
Quiz von Jimit Thakkar, aktualisiert more than 1 year ago
Jimit Thakkar
Erstellt von Jimit Thakkar vor mehr als 6 Jahre
367
1

Zusammenfassung der Ressource

Frage 1

Frage
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?
Antworten
  • silly { text-align: center; }
  • p.silly { align: center; }
  • p
  • p.silly { text-align: center; }
  • p < silly { align: center; }

Frage 2

Frage
In CSS the selector .par matches
Antworten
  • 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

Frage 3

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

Frage 4

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

Frage 5

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

Frage 6

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

Frage 7

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

Frage 8

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

Frage 9

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

Frage 10

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

Frage 11

Frage
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; }
Antworten
  • 100
  • 110
  • 105
  • 120
  • 90

Frage 12

Frage
In CSS the selector p matches
Antworten
  • 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

Frage 13

Frage
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: }
Antworten
  • 0
  • 1
  • 4
  • 2

Frage 14

Frage
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; }
Antworten
  • 120
  • 130
  • 150
  • 100

Frage 15

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

Frage 16

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

Frage 17

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

Frage 18

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

Frage 19

Frage
The difference between serif and sans-serif fonts is that
Antworten
  • 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

Frage 20

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

Frage 21

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

Frage 22

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

Frage 23

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

Frage 24

Frage
In CSS the selector #p matches
Antworten
  • 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

Frage 25

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

Frage 26

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

Frage 27

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

Frage 28

Frage
It is possible to define CSS in
Antworten
  • 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

Frage 29

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

Frage 30

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

Frage 31

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

Frage 32

Frage
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
Antworten
  • a { color : white ; hover : true ;}
  • a:link { color : white ; }
  • a { color : white ; hover-dwell : true ;}
  • a { hover-color : white ;}
  • a:hover { color : white ; }

Frage 33

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

Frage 34

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

Frage 35

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

Frage 36

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

Frage 37

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

Frage 38

Frage
In CSS the selector p matches
Antworten
  • 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

Frage 39

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

Frage 40

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

Frage 41

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

Frage 42

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

Frage 43

Frage
Which of the following HTML elements defines the title of a document?
Antworten
  • <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>

Frage 44

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

Frage 45

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

Frage 46

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

Frage 47

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

Frage 48

Frage
Which of the following correctly creates a hyperlink?
Antworten
  • <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>

Frage 49

Frage
The tag <!-- DOCTYPE html --> is interpreted by your browser as ....
Antworten
  • 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.

Frage 50

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

Frage 51

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

Frage 52

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

Frage 53

Frage
The 'C' in W3C stands for:
Antworten
  • Consortium
  • Corporation
  • Committee
  • Control
  • Central

Frage 54

Frage
It is important that your web pages follow web standards so that
Antworten
  • 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.

Frage 55

Frage
meta tags in the header section of a web page
Antworten
  • 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.

Frage 56

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

Frage 57

Frage
Which protocol provides multiplex?
Antworten
  • Transmission Control Protocol
  • Hypertext Transport Protocol
  • Data Layer Protocol
  • Internet Protocol

Frage 58

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

Frage 59

Frage
The syntax template for a basic html page will ...
Antworten
  • 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>

Frage 60

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

Frage 61

Frage
Which is not a valid URL format?
Antworten
  • 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

Frage 62

Frage
HTML is intended to ...
Antworten
  • 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.

Frage 63

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

Frage 64

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

Frage 65

Frage
In HTML comments start with ... and end with ...
Antworten
  • 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 */

Frage 66

Frage
In HTML, paragraphs start with ... and end with ....
Antworten
  • 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>

Frage 67

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

Frage 68

Frage
Which of the following is correct HTML5 for displaying an image?
Antworten
  • <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">

Frage 69

Frage
Are the Internet and WWW the same thing?
Antworten
  • No
  • Yes

Frage 70

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

Frage 71

Frage
Which is not a valid IP address format?
Antworten
  • 200.43.33.34
  • 128.0.44.1
  • 56.0.267.34
  • 1.21.44.129

Frage 72

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

Frage 73

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

Frage 74

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

Frage 75

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

Frage 76

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

Frage 77

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

Frage 78

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

Frage 79

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

Frage 80

Frage
meta tags in the header section of a web page
Antworten
  • 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.

Frage 81

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

Frage 82

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

Frage 83

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

Frage 84

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

Frage 85

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

Frage 86

Frage
In PHP file I/O, file() does what?
Antworten
  • 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

Frage 87

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

Frage 88

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

Frage 89

Frage
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"; }
Antworten
  • found
  • no output
  • this will cause an error
  • not found

Frage 90

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

Frage 91

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

Frage 92

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

Frage 93

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

Frage 94

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

Frage 95

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

Frage 96

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

Frage 97

Frage
In HTML forms, the HTML element label does what?
Antworten
  • 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

Frage 98

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

Frage 99

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

Frage 100

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

Frage 101

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

Frage 102

Frage
In PHP, $a[] = "hello" does what?
Antworten
  • 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

Frage 103

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

Frage 104

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

Frage 105

Frage
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
Antworten
  • var z = x.length();
  • var z = length(x);
  • var z = x.length;
  • var z = 3;
  • var z = x.len;

Frage 106

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

Frage 107

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

Frage 108

Frage
In JavaScript single line comments start with
Antworten
  • //
  • /
  • ##
  • #
  • C

Frage 109

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

Frage 110

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

Frage 111

Frage
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?
Antworten
  • 5
  • 3
  • 4
  • 1
  • 2

Frage 112

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

Frage 113

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

Frage 114

Frage
In JavaScript multiple line comments are surround with
Antworten
  • // and //
  • /* and *
  • ## and ##
  • // and */
  • /* and //

Frage 115

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

Frage 116

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

Frage 117

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

Frage 118

Frage
What does DOM stand for?
Antworten
  • Direct Object Manipulation
  • Document Object Model
  • Document Object Module
  • Detailed Object Map

Frage 119

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

Frage 120

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

Frage 121

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

Frage 122

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

Frage 123

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

Frage 124

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

Frage 125

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

Frage 126

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

Frage 127

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

Frage 128

Frage
When does the global event "window.onload" get called?
Antworten
  • 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.

Frage 129

Frage
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?
Antworten
  • allParas[i].style.backgroundColor = "silver";
  • allParas[i].backgroundColor = "silver";
  • allParas.style.backgroundColor = "silver";
  • allParas.backgroundColor = "silver";

Frage 130

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

Frage 131

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

Frage 132

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

Frage 133

Frage
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;
Antworten
  • 3
  • 0
  • 2
  • 1
  • There is no error in this code.

Frage 134

Frage
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>?
Antworten
  • No
  • Yes

Frage 135

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

Frage 136

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

Frage 137

Frage
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?
Antworten
  • no
  • yes

Frage 138

Frage
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?
Antworten
  • 5
  • 0
  • 3
  • 4

Frage 139

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

Frage 140

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

Frage 141

Frage
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");
Antworten
  • 2
  • 3
  • 1
  • 0

Frage 142

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

Frage 143

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

Frage 144

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

Frage 145

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

Frage 146

Frage
When does the global event "window.onload" get called?
Antworten
  • 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.

Frage 147

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

Frage 148

Frage
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>
Antworten
  • 3
  • 1
  • <ul>
  • 4

Frage 149

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

Frage 150

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

Frage 151

Frage
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>
Antworten
  • 2
  • 0
  • 1
  • 4
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

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