Coding

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What would be printed to the console with the following code

"Kryptonite"

Which of the following is the correct way to join together two strings?

"good " + "morning"

function longerString(string1, string2) { if (string2.length > string1.length) { return string2; } else { return string1; } } var longer = longerString("Amy","Magdalene"); console.log(longer);

'Magdalene'

Which of the following expressions returns true?

(8 % 2) === 0

function lessThan(num1, num2) { if (num1 < num2) { console.log(num1); } else { console.log(num2); } } lessThan(65,22);

(num1, num2)

What property can we access in order to get the number of elements contained within an array?

.length

Which of the following CSS code snippets would apply a blue background color to the textbox <div> and red text to paragraph1?

.textBox { background-color: blue; } #paragraph1 { color: red; }

An array is a __ list.

0-indexed

Review the snippet of code: var birthdate = "01/01/1970"; birthdate = "01/01/1971"; console.log(birthdate); What is printed to the console?

01/01/1971

function lessThan(num1, num2) { if (num1 < num2) { console.log(num1); } else { console.log(num2); } } lessThan(65,22); What will be the result printed to the console?

22

var num1 = 143; var num2 = 280; if (num1 > num2) { console.log(num1); } else { console.log(num2); }

280

var arr = [1,2,3]; arr.push(4); arr[0] = 5; console.log(arr.length); What will be printed to the console by this code?

4

<body> <h1> I'm a header. </h1> </body>

<body> is the parent of <h1>

Which pair of HTML tags are responsible for containing all visible content on an HTML page?

<body></body>

Which HTML tags are used to create sections of content?

<div></div>

Which pair of tags is responsible for containing information about an HTML page that will not be visible?

<head></head>

What is the proper syntax to add an id to a <p> element?

<p id="specialText"> </p>

What is the proper way to create an HTML paragraph tag?

<p> I'm a paragraph. </p>

CSS is recognized in an HTML file using which tags?

<style> </style>

Which of the following are operators that compare two values and return a Boolean?

> >= < <= === !=

if ("Maria".length ___ "Sanjay".length){ console.log("This is true"); } else { console.log("This is false"); } If .length tells us the length of the string it's attached to, which operator should be used in the condition such that This is false is printed to the console?

>=

A conditional statement will execute code based on what kind of value?

A Boolean

What is a Boolean (pronounced Boo-lee-in)?

A true or false value

Which of the following is the definition of a Function?

An encapsulated, re-usable block of code that performs a set of tasks and returns a value

function add(num1, num2) { return num1 + num2; } var sum = add(2,4);

Arguments

What does CSS stand for?

Cascading Style Sheets

var condition = true; if (condition) console.log("it happened!"); What is missing from this code?

Curly braces {} around console.log("it happened")

HTML is responsible for what in a website?

Defining the structure and content

Why are For-Loops used?

Executing a block of code a specific number of times. Simplifying repetitive code ( D.R.Y. ) Looping through an Array's elements

Objects use a _______ to iterate over its keys.

For-in Loop

What would be the result printed to the console?

Gaudin

var lang = "es"; if (lang != "es") { console.log("Hello, World"); } else { console.log("Hola, Mundo"); }

Hola, Mundo

What does HTML stand for?

Hypertext Markup Language

Which of the following is the best definition of Iteration?

Iteration is the process of accessing values in an Array using a Loop

function sayHello(name) { console.log("Hello " + name + ". How are you?"); } What will be printed to the console by this code?

Nothing, there is no function call.

Key-value pairs in an object are called [__].

Properties

CSS is responsible for what in building a website?

Style

What is the result of adding the following Strings "1" + "2"

The String "12"

Consider the following code snippet: for (var i = 10; i >= 0; i--) {} 1) How many times will the loop run? 2) What will the values of i be?

The loop will run 11 times and i will be the values: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0

Consider the for loop below: for (var i = 0; i < 5; i++){} 1) How many times will the loop run? 2) what will the values of i be?

The loop will run 5 times and i will be the values: 0, 1, 2, 3, 4

Consider the following code snippet: for (var i = 0; i <= 10; i += 2) {); 1) How many times will the loop run?2) What will the values of i be?

The loop will run 6 times and i will be the values: 0, 2, 4, 6, 8, 10

What is the result printed to the console?

This is the key: momThis is the value: "Wendy"This is the key: dadThis is the value: "Jon"

hich of the following statements will return the last element in an array called arr.

arr[arr.length - 1];

What Array method allows us to add a new element to the end of an Array.

array.push(elementToAdd);

In order to access individual elements of an array, you must use what kind of notation?

bracket notation

Arrays fall under the [blank] data type category, unlike numbers and strings that are [blank].

complex,simple

How do you properly log the String "Hello World" to the console?

console.log("Hello World");

Consider the following code: var names = ["Ash", "Misty", "Brock", "Jessie", "James"]; Which of the following prints Jessie to the console?

console.log(names[3]);

Which of the following loops creates an infinite loop?

for (var i = 0; i < 10; i--) { }

Consider the following array: var names = ['ben', 'taylor', 'kendall', 'edem', 'daniel']; Which of the following for loops would correctly iterate over every index within the Array names?

for (var i = 0; i < names.length -; i++) {}

Consider the array below: var fruit = ['apple', 'banana', 'cherry']; Which of the following loops properly demonstrates iteration?

for (var i = 0; i <= 2; i++) { var element = fruit[i]; }

var friends = ["Maggie", "Ben", "Aaron", "Max", "John"]; How would you update "Ben" to "Amaya" in the Array above?

friends[1] = "Amaya"

What is the correct syntax for creating a CSS style rule that makes all h1 tags have blue text?

h1 { color: blue; }

[blank] are unique labels for HTML elements while [blank] are general labels for HTML elements

ids, classes

What would replace ??? in order to print out each value of the object?

key

An object is a collection of [__].

key-value pairs

var weather = "sunny"; if (weather === "cloudy") { var message = "nice day if you're a duck!"; } else if (weather === 'sunny') { var message = "nice day, eh?"; } console.log(message); What will be printed to the console?

nice day, eh?

function getSum(num1, num2) { var sum = num1 + num2; }; var mySum = getSum(5,3); What would you add to the body of this function to make it produce as output the sum of num1 and num2?

return num1 + num2;

function sayHello() { console.log("hello"); }

sayHello();

Consider the following array: var scores = [92, 76, 91, 88, 100]; How should you properly access the value 76 in the scores array?

scores[1]

[blank] are used to choose which HTML element to style and [blank] determine how the element looks.

selectors, properties

Given an array named states, how would you access the first element in the states array?

states[0];

Keys in an object are of what data type?

string

Which of the following would add the property with the key universe and the value "DC" to the superman object?

superman["universe"] = "DC";

What is the result of the following expression? ((1 + 2) * 3) === 9

true

var day = 'monday'; day = 'tuesday'; console.log(day); What will be printed to the console?

tuesday

Which of the following Variable names demonstrates camel case?

var myName;

What is the proper way to declare a new variable for the string "John Doe"?

var name = "John Doe";


Kaugnay na mga set ng pag-aaral

Finances (FINANCIAL INSTITUTIONS)

View Set

Respiration: Carbon Dioxide Transport

View Set

Some more spinal and ICP Questions

View Set

Mental Health: Chapter 19: Addiction

View Set

course 1 final practice exam: attempt 4

View Set

3740 IMMUNOLOGIC FUNCTION (31 - 34)

View Set

Chapter 41: Community & Home Nursing

View Set

Applications and application forms

View Set