CIS 110 Final Questions

Flashcard maker : Isabel Padilla
what is the best reason to include
height and width attributes on an
tag.
to help the browser render the page faster because it reserves the appropriate space for the image
What is the browser’s action when you configure BOTH a background color and background image for the body selector?
display the background color while the background image loads and before the background image is displayed
When a web page uses graphics for
the main navigation links, provide
accessibility by:
providing text links on the bottom of the
page
A(n) ________ is an image that is
configured so that parts of the image
can be used as one or more hyperlinks.
image map
What is the code below that will
configure a background image
called parchment.gif for a web
page using CSS?
body {background-image:url(parchment.gif); }
what is the code below that uses CSS to eliminate the default border on an image configured as an image?
img {border: 0; }
The theorem that states that any
program logic can be written using only three constructs is called the
________________theorem
Structure
Counted repetition refers to the idea
that an index is _________ and then
tested each time the loop iterates.
incremented
What controls a for loop?
iteration variable
How many iterations will occur in this loop?
for (again = 1; again <=5; again = again + 1) {...}
5
what code iterates 10 times?
) for (i = 1; i <=10; i = i + 1)
What is an example of an infinite loop?
for (i = 1; i <= 4; i = i - 1)
What does + mean in javascript?
addition or concentration
in the line: var rows = new Array(5);
what will result?
the first item in the array will be rows[0]
what is clearTimeout used for?
Cancelling a timer
For the elements of the array to
store an image, they must be
initialized to a(n):
image object
In a for loop, the operation that sets
the variable’s value for the first
iteration of the loop is the:
initialization
What is an indexed base name?
array
What is the standard form of the World-Famous Iteration? (WFI)
) for ( j=0; j
Which is the first step in the program
development cycle?
Analyze the problem
What is not a control structure?
syntax
What is not one of the primary Javascript data types?
float
What data type can only have one of two possible values?
Boolean
What is not an acceptable variable name?
1_Name
What is not an acceptable variable name for a friend?
my friend
If the variable hours = 10, what is the value of the variable salary after the following instruction has been executed:
salary = hours * 8
80
Which tags are used to provide alternate content for users who have disabled scripts in their browsers?
What would be used to have a Javascript function named hello() execute before the user views a web page?
which method allows you to display text on an html page?
write()
Which method will retrieve the contents of an html element?
getElementByld()
Evaluate 8 % 7
1
Given: a = 4 and b = 3, evaluate:
(14 % a ) * a * b / 6 + (b * b)
13
If car = “Honda”, how does the
following expression evaluate:
(car < "Toyota");
true value
If beverage = “tea”, which of
the following is true?
!(beverage != “tea”);
Which is equivalent to (X > 5)
given that X is a numeric variable.
!(X <= 5)
Which of the following will assign the variable named timCall to the sentence:
Tim called, “Lassie, come home!”
var timCall = ‘Tim called, “Lassie, come home!”‘;
Which of the following is NOT a
valid variable name for a dog?
dogs-rule
Given the following code snippet, what will be
displayed on the web page if the user enters 4
at the prompt?
var myNum = prompt(“Enter a number:”);
var result = myNum + myNum;
document.write(result);
44
Given the following code snippet, what will be
displayed on the web page if the user enters 4 at
the prompt?

var myNum = prompt(“Enter a number:”);
var result = myNum * myNum;
document.write(result);

16
Given the following code snippet, what will be
displayed on the web page?

var X = 23;
var Y = 3;
var Z = X + Y;
document.write(Z);

26
Given the following code snippet, what will be
displayed on the web page if the user enters
6.35 at the prompt?
var A = prompt(“Enter a number:”);
document.write(parseFloat(A) + “, “);
document.write(parseInt(A));
a. 6.35NaN
b. 6.35
c. 6.35, 6
d. 6.35, 6.35
6.35, 6
Given the following code snippet, what will be displayed
on the web page if the user enters 55 at the prompt?

var result = “Yes!”;
var multiply = prompt(“What is 5 * 11?”);
result = (parseInt(multiply) == 55)?”Correct”:”Incorrect”;
document.write(result);

correct
What type of loop executes at least once?
post-test
what is the value of x after the following statement executes,
given that initially x = 8:

x*=3;

24
How many times will “bye bye” display after
the following code is executed?
var b = 3; var g = 1;
do
{
document.write(“bye bye”);
g++;
}
while (g > b)
1
What is the result of the following
code snippet?
var car = 4;
var result = isNaN(car);
document.write(result);
True
What is the value of the variable myLetter
after the following statements are executed?

var name = “Santa Claus”;
var myLetter = name.charAt(3);

“t”
What function will generate a random number between 1 and 100, inclusive
. num = (Math.floor(Math.random() * 100) + 1;
Which of the following will display “cost is $23.95”, assuming cost = 23.9487 ?
document.write(“cost is ” + cost.toFixed(2);
In the following statement,
what is the initial condition, given
that y = 600?
for(x = 500; x > y; x++)
x = 500
What is the value of count when the
following loop is exited?

var count = 20;
while( count < 200) count*=3;

540
What will be displayed after the following loop
is exited?

var name = “Liam”;
for(var x = 3; x < 0; x--) document.write(name.charAt(x) + ", ");

m a I L
What is the value of address, given:
myAddress = “123 Duck Street, NW”;
address = myAddress.length;
19
What is the value of street given:
var street = ” “;
myAddress = “123 Duck Street, NW”;
for( var x = 4; x <= 7; x++) street = street + myAddress.charAt(x);
Duck
From language to language, generally an identifier:
starts with a letter and is followed by
letters, numerals, or the underscore
Which of the following is a valid JavaScript variable name?
BR549
In JavaScript, the escape symbol is the:
backslash ()
Which of the following is not
a suitable assignment statement?
length * width = area
The value used for a variable on the right side of an assignment statement is:
the value before the statement is
executed
The first step in solving a programming expression is to process:
the part of the expression inside the
parentheses
In JavaScript, 17%5 is:
2
An if statement must have:
a semicolon at the end of it
How is an empty string written?
“”
string constants/literals are:
surrounded by quotes in Javascript code
Javascript is:
an interpreted
language, meaning that the
program code is executed
directly without compiling
what side programs do not
require users to wait for data
to be sent over the Internet to
a Web server?
client
What code can be inserted directly into an HTML file or placed in a separate text file that is linked to a Web page?
Javascript
What is used to
distinguish JavaScript code
from the text that you want
displayed on a Web page?