Font size
WorksheetsJavaScript Input and Variables Quiz
Total questions: 20
Worksheet time: 58mins
What is the proper function to call to print to the screen?
write
println
post
How will the output look in the following programs?
The code snippet will print Hello World on a single line.
The code snippet will print Hello on the first line and World on the second line.
The code snippet will print an error because of the extra space after the letter o.
The code snippet requires only one println.
What keyword do you need to use to define a variable in JavaScript?
println
var
float
int
A naming convention where the first letter is lower case, and each subsequent start of a word is upper case
capitalization
variable
upperCase
lowerCamelCase
What is the output to the console to the following JavaScript program?
1
2
3
1
2
.3
1
2
.03
1
2
0.03
What are the different variable types that can be used in Javascript?
Booleans, Numbers, Strings
Booleans, Int, Float
Strings, Booleans, Int
Strings, Int, Doubles
How would you create a variable named myPet and give it the value “Your Name”?
(a)
How would you create a variable named digNum and give it the value 33?
(a)
How would you print out the value stored inside of a variable named totAmount?
(a)
What variable type will you use for the number 56.43?
String
Int
Float
Boolean
What variable type will you use for true or false statement?
String
Int
Float
Boolean
What function do you need to call to ask the user of the program to enter text?
readLine
readln
text
println
To ask the user of the program for the number 8, which function should you use?
readLine
readInt
readFloat
readNumber
To ask the user of the program for the number 10.00, which function should you use?
readLine
readInt
readFloat
readNumber
What are the JavaScript functions we can use to get input from the user?
readLine(), readFloat(), readInt()
readLine, readFloat, readInt
readLine<>, readFloat<>, readInt<>
readLine{}, readFloat{}, readInt{}
Which program snippet will read the age from the user?
var age = readInt("What is your age:");
println(age);
var age = readLine("What is your age:");
println(age);
var age = readFloat("What is your age:");
println(age);
var age = readNum("What is your age:");
print(age);
How will the output look in the following programs?
Hello bulldog, nice to meet you!
Hello Alexander, nice to meet you!
Hello name, nice to meet you!
Syntax Error
What is the output to console for the following JavaScript program?
Our Sales Tax is 8%
Our Sales Tax is .08%
Our Sales Tax is%
Syntax Error
What is the output to the console in the following JavaScript program?
123
1
2
3
12
3
1
23
What is the output to the console to the following JavaScript program?
7
8
.09
7
8
0.09
num1 num2 num3
15.09
