stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
PLAY WITH PYTHON Flashcards | StudBud
Explore
/
PLAY WITH PYTHON
PLAY WITH PYTHON
25 terms
·
StudBud Administration
·
255 plays
UNIT II & III
Flashcards
25 cards
F
Practice quiz
P
Host live
L
Questions
25
Answers
1
What data type is the object below ? L = [1, 23, ‘hello’, 1].
dictionary
tuple
list
array
2
Consider the expression given below. The value of X is: X = 2+9*((3*12)-8)/10
28.4
27.2
30.8
30.0
3
Is Python case sensitive when dealing with identifiers?
no
yes
none of the above
machine dependent
4
What is the order of precedence in python? i) Parentheses ii) Exponential iii) Multiplication iv) Division v) Add & sub
ii,i,iv,iii,v,vi
ii,i,iii,iv,v,vi
i,ii,iii,iv,vi,v
i,ii,iii,iv,v,vi
5
Mathematical operations can be performed on a string. State whether true or false.
False
True
6
Following set of commands are executed in shell, what will be the output? >>>str="hello" >>>str[:2]
lo
he
hello
olleh
7
Carefully observe the code and give the answer. def example(a): a = a + '2' a = a*2 return a example("hello")
hello2 hello2hello2
cannot perform mathematical operation on strings
8
Operators with the same precedence are evaluated in which manner?
Right to Left
Left to Right
9
Which of the following is an invalid statement?
a b c = 1000 2000 3000
abc = 1,000,000
a,b,c = 1000, 2000, 3000
a_b_c = 1,000,000
10
Which of the following is an invalid variable?
my_string_1
_a
1st_string
foo
11
What is the output of this expression, 3*1**3?
27
9
3
1
12
Select all options that print hello-how-are-you
print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
print(‘hello’, ‘how’, ‘are’, ‘you’)
print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
print(‘hello-‘ + ‘how-are-you’)
13
What is the answer to this expression, 22 % 3 is?
7
0
1
5
14
What is the value of the following expression: 8/4/2, 8/(4/2)
(4.0, 4.0)
(4.0. 1.0)
(1.0, 4.0)
(1.0, 1.0)
15
Which one of these is floor division?
/
%
None of the mentioned
//
16
What is the output of the following expression:
print
(4.00/(2.0+2.0))
Error
1.0
1
1.00
17
The value of the expression: 4 + 3 % 5
0
7
2
4
18
The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same. State whether true or false.
True
False
19
All keywords in Python are in
lower case
upper case
20
The expression 2**2**3 is evaluates as: (2**2)**3. State whether this statement is true or false.
True
False
21
The output of the snippet of code shown below? bool(‘False’) bool()
False False
True True
True False
False True
22
What is the average value of the code that is executed below ? g1 = 80 g2 = 90 avg = (g1 + g2)/2
85.1
85.0
23
The expression Int(x) implies that the variable x is converted to integer. State whether true or false.
True
False
24
Evaluate the expression given below if A= 16 and B = 15. A % B // A
0
0.0
1
1.0
25
Which is the correct operator for power(xy)?
x^y
x^^y
x**y