Exam 1: Python Programming: Output and Data Types

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What is the output of the following program : I = 0 While i < 3: Print i Print i+1

Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
Verified

C

What is the output of the following program? From math import sqrt L1 = [x**2 For x in range(10)].pop() L1 + = 19print(sqrt(L1), end = " ") L1 = [x**2 for x in reversed(range(10))].pop() L1 + = 16 Print(int(sqrt(L1)))

Free
(Multiple Choice)
4.8/5
(45)
Correct Answer:
Verified

C

What is the output of the following code? Def foo(k): K[0] = 1 Q = [0] Foo(q) Print(q)

Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
Verified

B

What is the output of the expression : 3*1**3

(Multiple Choice)
4.7/5
(46)

What is the output of the following program : Print '{0:-2%}'.format(1.0 / 3)

(Multiple Choice)
4.8/5
(37)

What is the output of the following program? T = (1, 2, 3, 4, 5, 6, 7, 8) Print(T[T.index(5)], end = " ") Print(T[T[T[6]-3]-6])

(Multiple Choice)
4.9/5
(31)

What is the output of the following? X = ['ab', 'cd'] Print(len(list(map(list, x))))

(Multiple Choice)
4.7/5
(39)

What is the output of the following program : Print 0.1 + 0.2 == 0.3

(Multiple Choice)
4.9/5
(34)

What will be displayed by the following code? Def f(value, values): V = 1 Values[0] = 44 T = 3 V = [1, 2, 3] F(t, v) Print(t, v[0])

(Multiple Choice)
4.8/5
(48)

What is the output of the following piece of code? #mod1 Def change(a): B=[x*2 for x in a] Print(b) #mod2 Def change(a): B=[x*x for x in a] Print(b) From mod1 import change From mod2 import change #mains=[1,2,3] Change(s)

(Multiple Choice)
4.8/5
(35)

Which of these is not a core data type?

(Multiple Choice)
4.9/5
(35)

Which of the following formatting options can be used in order to add „n? blank spaces after a given string „S??

(Multiple Choice)
4.9/5
(40)

What is the output of the following program? Data = [2, 3, 9] Temp = [[x for x in[data]] For x in range(3)] Print (temp)

(Multiple Choice)
4.7/5
(34)

What is the output of the following program : Print 'abcefd'.replace('cd', '12')

(Multiple Choice)
4.8/5
(43)

Which function overloads the >> operator?

(Multiple Choice)
4.8/5
(37)

What is the output of the following program? D = dict() For x in enumerate(range(2)): D[x[0]] = x[1] D[x[1]+7] = x[0] Print(D)

(Multiple Choice)
4.8/5
(30)

What is the output of the following program? D = dict() For i in range (3): For j in range(2): D[i] = j Print(D)

(Multiple Choice)
4.8/5
(38)

What is the output of the following program? Import sys L1 = tuple() Print(sys.getsizeof(L1), end = " ") L1 = (1, 2)print(sys.getsizeof(L1), end = " ") L1 = (1, 3, (4, 5)) Print(sys.getsizeof(L1), end = " ") L1 = (1, 2, 3, 4, 5, [3, 4], 'p', '8', 9.777, (1, 3)) Print(sys.getsizeof(L1))

(Multiple Choice)
4.9/5
(35)

What is the output of the following program : Print 'cd'.partition('cd')

(Multiple Choice)
4.8/5
(29)

Suppose t = (1, 2, 4, 3), which of the following is incorrect?

(Multiple Choice)
4.7/5
(34)
Showing 1 - 20 of 48
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)