Business 104 Quiz 1

Ace your homework & exams now with Quizwiz!

message = ("Hello," + "Dolly"); What is the value of message? (Include the quotation marks.)

"Hello,Dolly"

Type the illegal character in this statement var P2_a%88$;

%

Type the modulus operator

%

Enter the operators, in this order, for addition, subtraction, multiplication, and division. Don't type spaces between them.

+-*/

What is the value of orderTotal? var merchTotal = 100; var shippingCharge = 10; var orderTotal = merchTotal + shippingCharge;

110

What is the value of num? var num = 20 % 6;

2

alert("33" + 3); What message displays in the alert box?

333

var x = 50; var y = --x; What is the value of y?

49

var x = 50; var y = x++; What is the value of y?

50

Write a statement that displays an alert. The message is a string concatenated with a variable.

alert("Hi, " + userName);

Write an alert that displays the concatenation of the two parts of "Woo hoo"

alert("Woo " + "hoo");

Code an alert that displays the result of a math operation on 2 numbers.

alert(2*2);

Code an alert that displays the result of any mathematical operation on 2 variables. Make up the variable names.

alert(profit - cost);

This statement has already been coded. var bestMan = "Charlie"; Assign the variable a new string value.

bestMan = "Ralph";

The variable boogieWoogie has already been declared. Assign to it the value of another variable, woogieBoogie

boogieWoogie = woogieBoogie;

Assign to the variable caseQty, which has already been declared, the value 144

caseQty = 144;

What is it called when you combine two or more strings, using the plus sign?

concatenation

This statement... userName = "buddy5000" ; ...is correct only if the variable has already been _________.

declared

Assign to a variable the remainder when the value represented by a variable is divided by a number. The first variable has been declared beforehand. Make up the variable names.

leftOver = num % 3;

What kind of operation can be done on a number variable that, in one particular case, can't be done on a string variable?

math

What is the name of the arithmetic operator that gives you the remainder when one number is divided by another? (one word)

modulus

Increment a variable. In a second statement, display its new value in an alert

num++; alert(num);

You can assign a string to a variable. You can also assign a _________.

number

Write a statement that assigns to a variable the concatenation of a string with a number. The variable has been declared beforehand.

pro = "haha" + 11;

Assign to a variable the value represented by one variable subtracted from the value represented by another variable. The first variable has been declared beforehand. Make up all the variable names.

profit = price - cost;

If a number is enclosed in quotes, it's a

string

In one word, if it is enclosed in quotation marks, what is it?

string

What is a keyword that declares a variable?

var

Declare a variable using nothing but all of the legal characters that aren't alphabet characters or numbers. Don't repeat any of them.

var _$;

In a single statement, declare a legally-named variable and assign a number to it.

var _1 = 7;

Declare a variable whose name is the combination of 3 characters, in this order: a legal first character that is not a letter, a character that would be illegal as a first character, and a character that would be legal anywhere in the name.

var _1h;

Declare a variable that combines a number, an alphabet letter, and one of the legal characters that are neither an alphabet letter nor a number. Assign to the variable a string consisting of another legal character that is neither an alphabet letter nor a number. Display the variable's value in an alert, specifying the variable, not the value, as the message.

var _1h; _1h = "$"; alert(_1h);

Declare a variable whose name is your first and last names combined, in camelCase. Assign the variable your first and last names, as a string. Code an alert, specifying the variable, not the string, as the message.

var adrianaWilcoxon; adrianaWilcoxon = "Adriana Wilcoxon"; alert(adrianaWilcoxon);

Declare a variable, in camelCase, that combines the two syllables boo and hoo.

var booHoo;

Write a statement that concatenates two variables and assigns the result to a third variable. The third variable hasn't been declared beforehand.

var combo = firstPart + secondPart;

Write a statement that assigns to a variable the concatenation of the two parts of "Oh yeah" (no period at the end). The second part is "yeah" The variable hasn't been declared beforehand.

var expression = "Oh " + "yeah";

Assign numbers to 2 new variables. Code an alert that displays the result of a math operation on the variables.

var first = 7; var second = 9; alert(first * second);

In a single statement, declare the variable firstLegalChar and assign it a string. The string consists entirely of the first character on the keyboard in the top row that's legal in a variable name, as long as the character doesn't come first.

var firstLegalChar = "1";

In the first statement declare a variable and assign it a number. In the second statement, change the value of the variable by adding it together with a number.

var friends = 30; friends = friends + 10;

In a single statement, declare the variable largeNum and assign it the result of 1,000 multiplied by 2,000.

var largeNum = 1000 * 2000;

Assign to a variable the remainder when one number is divided by another. The variable hasn't been declared beforehand. Make up the variable name.

var leftOver = 10 % 3;

Rewrite this using camelCase var Nameofband;

var nameOfBand;

In a single statement, increment the variable num and assign its new value to a second variable, newNum, which hasn't been declared beforehand.

var newNum = ++num;

In a single statement subtract 1 from a variable and assign the new value to another variable, which hasn't been declared beforehand.

var newNum = --num;

In a single statement add 1 to a variable and assign its original value to another variable, which hasn't been declared beforehand.

var newNum = num++;

In a single statement, decrement num and assign its original value to newNum, which hasn't been declared beforehand.

var newNum = num--;

Declare a variable and assign it a string. Then code an alert, specifying the variable, not the string, as the message.

var nickName = "Ana"; alert(nickName);

Declare a variable and assign it a string that's nothing but the name of the variable. Then code an alert, specifying the variable, not the string, as the messgae.

var nickName = "nickName"; alert(nickName);

Declare an undefined variable in a statement. In a second statement assign it a string.

var nickName; nickName = "Adriana";

Assign a string to a variable that has already been declared

var nickname = "Adriana";

In a single statement, declare the variable nickname and assign the string "Satchmo" to it.

var nickname = "Satchmo";

Assign a number value to a variable. Increment the variable using minimal code while assigning its incremented value to a second variable. Display the value of the second variable in an alert.

var num = 10; var newNum = ++num; alert(newNum);

Declare a variable and assign it a number. Then code an alert, specifying the variable, not the number, as the message.

var num = 7; alert(num);

Declare a variable and assign it a number. Double the variable's value by adding the variable to itself. Display the variable's value in an alert, specifying the variable, not the number, as the message.

var num = 7; num = num + num; alert(num);

Assign a number value to a variable. Increment the variable using minimal code. Display the new value in an alert.

var num = 7; num++; alert(num);

Assign to the variable num the result of dividing 9 by the value represented by the variable qty. The variable num hasn't been declared beforehand.

var num = 9 / qty;

Rewrite this statement so the variable can be used in a math operation var num = "9";

var num = 9;

Assign to a variable the result of adding a number to itself, for example 2 + 2. The variable hasn't been declared beforehand. Make up the variable name.

var number = 2 + 2;

Assign the sum of 2 numbers to a variable, which hasn't been declared beforehand

var number = 2 + 7;

In a single statement declare a variable and assign a number to it.

var number = 4;

Declare the variable numberAsString and assign the number 3 to it as a string.

var numberAsString = "3";

Write a statement that assigns to scribe the concatenation of the first and last names of England's greatest playwright. The variable hasn't been declared beforehand.

var scribe = "William" + "Shakespeare";

In one statement declare a variable. In a second statement assign it the sum of 2 numbers.

var sum; sum = 2 + 7;

Declare the variable teamName

var teamName;

In a single statement declare a legally- named variable and assign to it the sum of 2 other legally-named variables

var total = cost + profit;

In a single statement declare a variable and assign to it the sum of 2 other variables.

var total = cost + profit;

What is a thing you create that refers to a value?

variable

What is the long version of x++?

x = x + 1;

Code the short form of x = x + 1;

x++;

If x has a value of 100, what is the fastest way to reduce it to 99 with a math expression?

x--;

Using minimal code, decrement x

x--;


Related study sets

Module 01: Training Principles Assessment

View Set

Chapter Quiz #2 Types of Life Policies

View Set

Lesson 4: Immigration and Demographic Change

View Set

sole proprietorship advantages and disadvantages

View Set

personal finance chapter 3-4 managing your money/budgeting

View Set