stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Python programming test #3 Flashcards | StudBud
Explore
/
Python programming test #3
Python programming test #3
27 terms
·
StudBud Administration
·
4 plays
Imported from external platform
Flashcards
27 cards
F
Practice quiz
P
Host live
L
Questions
27
Answers
1
Which of the following is true when a is 4 and b is 8?
a > b or a == b
a < b and a != b
b <= a or a > b
a < b and a == b
2
Which is a float in Python?
"Hello World"
3
"99"
5.0
3
Comments in Python start with
&
\
#
%
4
Consider the following code: if (90 < = x <= 100) It should be rewritten as:
Nothing, the if statement is correct
if (90 < = x and x <= 100):
if (90 < = x and <= 100):
if (90 < = x <= 100):
5
The else happens when the if condition is
either
none of the options
false
true
6
What’s the output of this Python code?
0
6
12
4
7
What does the % do in Python?
Returns the remainder of division
Returns the answer as an integer
Returns the answer as a decimal
Returns the whole number of division
8
The command to display an output in Python is:-
output()
display()
run()
print()
9
Which of these comparison if statements are correct?
if Number1 = Number2:
if (Number1 = Number2):
if Number1 == Number2:
if Number1 == Number2
10
What are the four different data types?
integer, float,number,boolean
integer, float,number,letters
integer, float,string,boolean
number, float,Boolean,string
11
What data type is 10 an example of?
Number
Character
Integer
Float
12
Write the code to test if the number 33 is stored in the variable var1:
if (“var1” == 33):
if (var1 == 33):
if ( var1 == "33"):
if (str(var1) == 33):
13
Precise set of rules for how to solve a problem is called a(n)
Instructions
Algorithm
Operating System
Variable
14
In python 3 what does // operator do ?
returns remainder
Float division
same as a**b
Integer division
15
definition of logical operators in python?
operators that are used to perform mathematical operations like addition
is the operator that is used to assign values to variables
statement that can either be true or false
compares the values of two operands and returns True or False
16
What is the symbol for exponent in python
^
**
*
^^
17
What are some data types in Python
strings, integers and floats
decimals and integers
letters, integers, and decimals
strings and numbers
18
What module must be imported for random numbers to work?
random
randint
seed
pow
19
The pow function return a "float" data type.
FALSE
TRUE
20
What does
==
mean in python?
Absolute value
Round to nearest integer
Equal to
Not equal to
21
What is a function in Python?
A mathematical expression that can be evaluated.
Any block of statements.
A statement of the form x = x + 4.
A named sequence of statements.
22
In Python this symbol is used to...
Telephone Operator
Assign something to a variable
A sign mint opera ray tore
Equality checker
23
All of the following are variable rules in python except which?
start your variables with a number or symbol
variables are case sensitive
variables may only contain letters, numbers and underscores
variables must start with a letter or an underscore
24
For if statements to work in Python you must ________________
use them with input commands
indent their code
add an else to them
make decisions about them
25
which of these is a simple data type
boolean
bool
boolen
0/1
26
what are else statements in python?
Compound statements contain (groups of) other statements
statement which allows code to be executed repeatededly if true
excute a block of code repeatedly within a range or a list
the block of code that executes if the conditional is false
27
The following code can be rewritten as: if 75 <= y <= 100:
if 75 <= y and <= 100):
if (75 <= y and <= 100):
if (75 <= y and y <= 100):
if (75 <= y <= 100):