COP 2500C Quizzes

¡Supera tus tareas y exámenes ahora con Quizwiz!

What is the correct HTML element for inserting a line break?

<br />

Choose the correct HTML element for the largest heading:

<h1>

What is the correct HTML for inserting an image?

<img src="image.gif" alt="myImage">

What is the correct HTML for referring to an external style sheet?

<link rel="stylesheet" type="text/css" href="mystyle.css">

Every statement using the keyword 'if' must also include the keyword 'else'.

False

Is the following statement true or false? 22 === "22"

False

JavaScript is the same as Java.

False

The external JavaScript file must contain the <script> tag.

False

The 'do while' loop evaluates the condition _________ performing the loop body the first time.

after

How do you write "Hello World" in an alert box?

alert("Hello World");

Which is the correct CSS syntax?

body {color: blue;}

How do you write an 'if' statement in JavaScript?

if (i == 5)

Adding to the value of a variable is called:

incrementing

How do you call a function named "myFunction"?

myFunction()

What is the return value of the prompt method if the user doesn't enter anything?

null

What does the code below display in the alert box? <script> var test = 1; alert(typeof test); </script>

number

Which event occurs when the user clicks on an HTML element?

onclick

What is the correct CSS syntax for making all the <p> elements bold?

p {font-weight:bold;}

What is the keyword you can use to have your function return the value "hello" to whatever called it?

return "hello";

Which HTML attribute is used to define inline styles?

style

HTML comment start with <!-- and end with -->

true

What is the result? Number("1") - 1 == 0

true

Which of the following is an object literal?

var area = {length, width}; var area = {length: 15, width: 5};

Which of the following syntax for creating an object called car is correct?

var car = new Object(model,color,make);

How do you declare a JavaScript variable?

var carName;

How does a 'while' loop start?

while (i <= 10)

The general format of the conditional operator, also called a ternary operator, is:

(condition) ? trueValue : falseValue

Which character is used to indicate an end tag?

/

How do you insert a comment that has more than one line in JavaScript?

/* this comment has more than one line */

How do you insert a comment in a CSS file?

/* this is a comment */

How can you add a comment in a JavaScript?

//This is a comment

<html> <head> </head> <body> <script type="text/javascript"> var nunmbers = new Array("3", "4", "5", "6"); var newstring = nunmbers.pop(); nunmbers.shift(); nunmbers.push("1","2", "3"); document.write(nunmbers.slice(2, 4)); </script> </body> </html>

1,2

<script> var txt = ""; var person = ["John", "Doe", "Sarah"]; person[3] = "George"; var person = ["John", "Doe"]; document.write(person.length); </script>

2

<script type="text/javascript"> var result = Math.max(10,20)*Math.min(10,20); document.write(result); </script>

200

<html> <head> </head> <body> <script> var num = 12.2 + 13.3; document.write(Math.floor(num) + " , " + Math.ceil(num) + " , " + Math.round(num) ); </script> </body> </html>

25,26,26

<html> <head> </head> <body> <script type="text/javascript"> var nunmbers = new Array("3", "4", "5", "6"); nunmbers.push("1","2", "3"); document.write(nunmbers + ", "); </script> </body> </html>

3,4,5,6,1,2,3,

<!DOCTYPE html> <html> <body> <script> var sum = new Function("a", "b", "return a + b; "); var sub = new Function("a", "b", "return a - b; "); document.write(sum(2, 3) + sub(2, 3)); </script> </body> </html>

4

Given the expression 6 + 4 / 2 % 2, what operation is done first?

4 / 2

<html> <head> </head> <body> <script type="text/javascript"> var nunmbers = new Array("3", "4", "5", "6"); var newstring = nunmbers.pop(); nunmbers.shift(); nunmbers.push("1","2", "3"); document.write(nunmbers + ", "); </script> </body> </html>

4,5,1,2,3,

In the code below, there are two variables with the same name, 'a". When the function is executed, which one will be alerted to the screen? var a = 5; // Global variable function myFunction() { var a = 7; // Local variable alert(a); }

7

When executed, what value will be alerted to the screen? function myFunction() { var a = 10; if (a > 5) { a = 7; } alert(a); }

7

When the code below is executed, it will pop up three alerts. In order, what are they? var a = 6; function test() { var a = 7; function again() { var a = 8; alert(a); //first } again(); alert(a); //second } test(); alert(a); //third

8; 7; 6

How can you open a link in a new tab / browser window?

<a href="url" target="_blank">

How do you make a numbered list?

<ol>

What is the correct syntax for referring to an external script called "xxx.js"?

<script src="xxx.js">

Inside which HTML element do we put the JavaScript?

<script>

Which HTML tag is used to define an internal style sheet?

<style>

Which HTML element defines the title of a document?

<title>

Which operator is used to assign a value to a variable?

=

A loop contained inside another loop is called:

A nested loop

Where is the correct place to insert a JavaScript?

Both the <head> section and the <body> section are correct

What does CSS stand for?

Cascading Style Sheets

What are JavaScript Core objects

Date, Time, String

What does HTML stand for?

Hyper text markup language

Where in an HTML document is the correct place to refer to an external style sheet?

In the <head> section

What happens when a browser encounters a function?

It bypasses it without executing any of the code contained within the function

<script> var txt = ""; var person = ["John", "Doe", "Sarah"]; person[3] = "George"; var person = ["John", "Doe"]; for (var i = 0; i < 4; i++) { txt += person[i] + " "; } document.write(txt); </script>

John Doe undefined undefined

What do functions not do?

Make your code run faster

What is wrong with the following alert box? alert("Hello <br /> World!")

The <br /> tag will be displayed between 'Hello' and 'World'

Who is making the web standards?

The World Wide Web Consortium

What is the output of the following HTML code? <html> <head> <title>User-defined objects</title> <script> var toy = new Object(); toy.name = "Lego"; toy.color = "red"; </script> </head> <body> <script> toy.color = "green"; document.write("<b>The toy is a " + toy.name + " and it is " + toy.color); toy.color = "blue"; document.write("</b>"); </script> </body> </html>

The toy is a Lego and it is green.

<!DOCTYPE html> <html> <body> <script> var str = "This is a practice test for Midterm Exam"; var res = str.replace("a", "?"); document.write(res); </script> </body> </html>

This is ? practice test for Midterm Exam

<!DOCTYPE html> <html> <body> <script> var str = "This is a practice test for Midterm Exam"; var res = str.replace("Midterm", "Final"); document.write(res); </script> </body> </html>

This is a practice test for Final Exam

A Boolean expression is a condition that can be evaluated as true or false.

True

Function names are case sensitive.

True

JavaScript is case-sensitive.

True

The core objects are consistent across different implementations and platforms.

True

What will the following code return: Boolean(10>9)?

True

Which CSS property is used to change the text color of an element?

color

The three properties of an Array object are

constructor, length, prototype

What is the correct JavaScript syntax to change the content of the HTML element below? <p id="demo">This is a demonstration.</p>

document.getElementById("demo").innerHTML = "Hello World!";

To dynamically create the Array object no keyword is needed.

false

How does a 'for' loop start?

for (i = 0; i <= 5; i++)

Which of these functions takes two arguments?

function getMaximum(a, b)

How do you create a function in JavaScript?

function myFunction()

How do you add a background color for all <h1> elements?

h1 {background-color:#FFFFFF;}

How do you write an 'if' statement for executing some code if "i" is NOT equal to 5?

if (i != 5)


Conjuntos de estudio relacionados

Ch. 1 Intro to Nursing - Taylor's (8th)

View Set

Chapter 29: Management of Patients with Nonmalignant Hematologic Disorders

View Set

TERM 4 Ch 12 Assessment and Care of Patients with Acid-Base Imbalances

View Set

رياضيات أول ثانوي الباب الخامس

View Set

ANTH 1050 Exam III Chapters 8-11

View Set

The Origin of Life - Study Guide

View Set

PEDS pharm & fluid calculations quiz

View Set

Intro to computer programming Test #1

View Set