NEW
Font size
WorksheetsLA3.C3: Variables
Total questions: 16
Worksheet time: 8mins
What is the purpose of the line 'name = TextWindow.Read()' in the program?
To display a greeting
To define a variable
To print the user's name
To store the user's input
Which of the following is a valid variable name?
1stVariable
if
variable-name
variable_name
What will be the output of 'TextWindow.WriteLine(number3)' if number1 is 10 and number2 is 20?
200
10
20
30
What does the operation 'TextWindow.Write()' do?
Writes text to a new line
Writes text on the same line
Reads user input
Displays an error message
Which symbol is used for division in the program?
-
*
/
+
What is the result of 'number3 = number1 * number2' if number1 is 10 and number2 is 20?
200
30
10
20
What is the first step in the temperature conversion program?
Display the temperature in Celsius
Get temperature in Fahrenheit from the user
Convert Celsius to Fahrenheit
Calculate the average temperature
What does the parentheses in 'celsius = 5 * (fahr - 32) / 9' indicate?
To perform division first
To perform multiplication first
To perform subtraction first
To perform addition first
Which of the following is NOT a rule for naming variables?
A name can contain letters and digits
A name must start with a letter
A name can contain underscores
A name can be the same as a keyword
What will the output be if the user inputs 'Alice' in the program?
Hello
Hello World
Hello Alice
Alice
What is the purpose of a variable in programming?
To read user input
To display output
To define functions
To store values temporarily
What will 'TextWindow.WriteLine("Hello " + name)' do?
Stores the user's name
Asks for the user's name
Prints 'Hello' followed by the user's name
Prints 'Hello World'
Which operation is used to read a number from the user?
TextWindow.Write()
TextWindow.ReadNumber()
TextWindow.WriteLine()
TextWindow.Read()
What will happen if you run the program multiple times?
It will crash
It will ask for the user's name each time
It will remember the previous name
It will display an error
What is the output of 'number3 = number1 + number2' if number1 is 15 and number2 is 25?
40
15
25
30
What will the output be if the user inputs 'Bob' in the program?
Hello
Hello Bob
Hi Bob
Welcome Bob
