0% found this document useful (0 votes)
12 views3 pages

PYTHON Test 2

interview test 2

Uploaded by

dkhan9935
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

PYTHON Test 2

interview test 2

Uploaded by

dkhan9935
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Naresh i Technologies, HYDERABAD

26. In python we do not specify types; it is directly interpreted by the compiler, so consider the
following operation to be performed.
1.>>>x = 13 ? 2 objectives is to make sure x has a integer value, select all that apply (python 3.xx)
a) x = 13 // 2
b) x = int(13 / 2)
c) x = 13 % 2
d) All of the mentioned
27. What error occurs when you execute?
apple = mango
a) SyntaxError
b) NameError
c) ValueError
d) TypeError
28. Carefully observe the code and give the answer.
1.def example(a):
2. a = a + '2'
3. a = a*2
4. return a
5.>>>example("hello")

a) indentation Error
b) cannot perform mathematical operation on strings
c) hello2
d) hello2hello2
29. What dataype is the object below ?
L = [1, 23, ‘hello’, 1].
a) list
b) dictionary
c) array
d) tuple
30. In order to store values in terms of key and value we use what core datatype.
a) list
b) tuple
c) class
d) dictionary
31. Which of the following results in a SyntaxError ?
a) ‘”Once upon a time…”, she said.’
b) “He said, ‘Yes!'”
c) ‘3\’
d) ”’That’s okay”’
32. The following is displayed by a print function call:
1.tom
2.dick
3.harry

Prepared By Subba Raju Data Scientist


Naresh i Technologies, HYDERABAD

Select all of the function calls that result in this output


a) print(”’tom
\ndick
\nharry”’)
b) print(”’tomdickharry”’)
c) print(‘tom\ndick\nharry’)
d) print(‘tom
dick
harry’)
33. What is the average value of the code that is executed below ?
1.>>>grade1 = 80
2.>>>grade2 = 90
3.>>>average = (grade1 + grade2) / 2
a) 85
b) 85.1
c) 95
d) 95.1
34. Select all options that print
hello-how-are-you
a) print(‘hello’, ‘how’, ‘are’, ‘you’)
b) print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
c) print(‘hello-‘ + ‘how-are-you’)*
d) print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
35. What is the return value of trunc() ?
a) int
b) bool
c) float
d) None
36. What is the output of print 0.1 + 0.2 == 0.3?
a) True
b) False
c) Machine dependent
d) Error
37. Which of the following is not a complex number?
a) k = 2 + 3j
b) k = complex(2, 3)
c) k = 2 + 3l
d) k = 2 + 3J
38. What is the type of inf?
a) Boolean
b) Integer
c) Float
d) Complex
39. What does ~4 evaluate to?

Prepared By Subba Raju Data Scientist


Naresh i Technologies, HYDERABAD

a) -5
b) -4
c) -3
d) +3
40. What does ~~~~~~5 evaluate to?
a) +5
b) -11
c) +11
d) -5
41. Which of the following is incorrect?
a) x = 0b101
b) x = 0x4f5
c) x = 19023
d) x = 03964
42. What is the result of cmp(3, 1)?
a) 1
b) 0
c) True
d) False
43. Which of the following is incorrect?
a) float(‘inf’)
b) float(‘nan’)
c) float(’56’+’78’)
d) float(’12+34′)
44. What is the result of round(0.5) – round(-0.5)?
a) 1.0
b) 2.0
c) 0.0
d) None of the mentioned
45. What does 3 ^ 4 evaluate to?
a) 81 b) 12 c) 0.75 d) 7
46. The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same. State whether true or false.
a) True b) False
47. The value of the expression:
4+3%5
a) 4 b) 7 c) 2 d) 0
48. Evaluate the expression given below if A= 16 and B = 15.
A % B // A
a) 0.0 b) 0 c) 1.0 d) 1
49. Which of the following operators has its associativity from right to left?
a) + b) // c) % d) **
50. What is the value of x if: x = int(43.55+2/2)
a) 43 b) 44 c) 22 d) 23

Prepared By Subba Raju Data Scientist

You might also like