stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Python Basics Quiz Flashcards | StudBud
Explore
/
Python Basics Quiz
Python Basics Quiz
35 terms
·
StudBud Administration
·
68 plays
Python quiz on Inputs, functions and If statements #python #ifelse #inputs #pythonfunctions #syntax
Flashcards
35 cards
F
Practice quiz
P
Host live
L
Questions
35
Answers
1
What would the output of this code be if the user entered the value 70?
Pass
Fail
Distinction
Merit
2
Which function will convert a number to a string?
int()
float()
num()
str()
3
Mathematical operations can be performed on a string. State whether true or false.
False
True
4
When i don't know how many times my program will loop, it is a.......
FOR Loop
WHILE Loop
5
What will be the output of print(1 or None)
None
1
None of the above
Error
6
In python, what key word makes the same steps repeat over and over again?
if
loop
repeat
while
7
What is the correct python syntax for inputting a string?
store = input()
store = string (input())
store = int (input())
store = str (input())
8
Which statement uses the correct python syntax?
print (Hello World!)
primt ("Hello World!")
Print("Hello World!")
print("Hello World!")
9
Which of the following is a keyword?
d) pass
b) assert
a) eval
c) nonlocal
10
Which command will correctly ask the user for their age?
input("How old are you?") = age
age = int(input("How old are you?"))
age = input("How old are you?")
input = print("How old are you?")
11
What is the output of this expression, 3*1**3?
27
1
3
9
12
In the example below, what are the names of the variables used?
name & input
game & input
print & name
name & game
13
input does what?
enters data
None of the above
enters input data fromm user
display output
14
What is a variable?
It stores data that can be altered
A special type of program
It holds information that we can change
3.14 is an example of a variable
15
How many time could this question be answered incorrectly before the lives become 0?
3
6
Inifinite
2
16
Which of the following is true for variable names in Python?
underscore is only special characters allowed in variable declaration
a) unlimited length
b) all private members must have leading and trailing under
none of the mentioned
17
Which of these tests whether the variable x is the same as 'Hello'?
x == "Hello"
x != "Hello"
x = "Hello"
x <> "Hello"
18
Syntax are rules that programming languages have to follow to work?
True
False
19
What is the result of this command? print ("5" + "3")
53
"5"+"3"
"8"
8
20
Which decision statement will be triggered if the variable x is less than 20?
if x < 20:
if x <> 20:
if x == 20:
if x > 20:
21
In the example below, what does the operator == means?
Equal Equal
Equal to
Not Equal
22
What effect does the # character have in the code?
Tells Python to ignore that line
It does nothing, Python ignores this character.
Tells Python that this is a really important line of code.
it's becomes a comment
23
If the user enters 11 what will be the output?
no output
syntax error
Wow double figures
24
Data stored in a computer program which changes; is
stored
in a....
print
input
string
variable
25
What is the correct python syntax for storing an integer value?
store = input()
store = str (input())
store = integer (input())
store = int (input())
26
Can variables store different types of data?
False
True
27
myName = input("what is your name?") - what is myName in this line?
Function
String
Variable
Method
28
A price, such as 3.95 should be saved as which type of variable?
Decimal
Float
Integer
String
29
What does input allows you to do?
It prompts you to enter data
It converts one data type to another (e.g str to int)
It allows users to change the program
30
What is a list in python?
lots of print statements in the same place in the code is called a list
a variable that can hold many values
lots of variables in the same place in the code is called a list
31
What would the outcome of this program be?
38
50
22
Nothing,it will cause an error
32
= sign means?
we use this sign in if or elif statement (e.g if pet="dog":)
we use this sign when making a variable
I don't know
33
When i do know how many times i want my program to loop, it is a.........
while Loop
for Loop
34
What is the output of -12//7
1
Error
None
2
35
Which of the following is an invalid statement?
abc = 1,000,000
a,b,c = 1000, 2000, 3000
a_b_c = 1,000,000
a b c = 1000 2000 3000