1.7-1.9 questions Flashcards
Which of the following is NOT true about variables?
- Variable names can be words: such as temperature or height.
- The value stored by a variable cannot be changed after it is assigned.
- Variables are a name for a spot in the computer’s memory.
- The value stored by a variable can be changed after it is assigned.
- The value stored by a variable cannot be changed after it is assigned.
Assume the user types in 7 and 10. What is output by the following?
num1 = input(“Enter a number: “)
num2 = input(“Enter a number: “)
print(num1 + num2)
17
710
No output, there is an error.
71
710
Which command converts a number to a string?
num()
int()
str()
word()
str()
Which of the following is true about strings?
- They do not let the user type in letters, numbers and words
- They cannot be stored to a variable
- An input (unless otherwise specified) will be stored as a string
- They are used for arithmetic calculations
- An input (unless otherwise specified) will be stored as a string
What is wrong with the following code?
num1 = int(input(“Enter a number: “))
num2 = int(input(“Enter a number: “))
num3 = int(input(“Enter a number: “))
print(“The average is: “ + (num1 + num2 + num3)/3)
- The last line should be print(“The average is: (num1 + num2 + num/3))
- It needs a int() command
- It needs a str() command
- The variables should be 1num, 2num, 3num
it needs a str() command
Which of the following lines of code correctly inputs a number?
- n = input(“Enter a value: “)
- n = str(input(“Enter a value: “))
- n = int(input(“Enter a value: “))
- n = num(input(“Enter a value: “))
- n = int(input(“Enter a value: “))
\_\_\_\_\_\_\_\_\_\_\_\_\_ data is what is translated to digital format so it can be stored in a computer. Digital Binary Secondary Analog
Analog
Using a microphone to record a sound on your computer is an example of:
- analog to digital conversion
- main memory
- output
- digital to analog conversion
analog to digital conversion