Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Which of the following slicing operations will produce the list [10, 15]? t = [19, 1, 20, 10, 15, 35, 50] a) t[10:15] b)

1) Which of the following slicing operations will produce the list [10, 15]? t = [19, 1, 20, 10, 15, 35, 50]

a) t[10:15]

b) t[3:5]

c) t[1:3]

d) t[1:3]

2) When do you have to close the file in Python?

a) after reading the file into the memory

b) after opening the file without specifying the mode

c) after opening file in a write mode

d) after accessing the file with default mode

3) In the following code, y = 90 What is "y"?

a) a keyword

b) a constant

c) a variable

d) a function

4) x = (3, 2, 9) if ??? > x :

a) (1, 0, 20)

b) (2, 15, 330)

c) (0, 1000, 2000)

d) (4, 0, 3)

5)

With following Python code, what will be the value of a?

>>> tup=[3, 'test', 'sample'] >>> a, b, c = tup

a) '3'

b) Will generate a "traceback" error

c) 3

d) [3, 'test', 'sample']

6) In the following Python code, what will end up in the variable y? x = { 'david' : 13 , 'charlene' : 26, 'john': 75} y = x.items()

a) A list of integers

b) A tuple with three integers

c) A list of tuples

d) A list of strings

7)

What character do you add to the "+" or "*" to indicate that the match is to be done in a non-greedy manner?

a) %

b) &

c) ^

d) ?

8)

For the following list, how would you print out 'Sally'?

friends = [ 'Joseph', 'Glenn', 'Sally' ]

a) print(friends[2])

b) print(friends['Sally'])

c) print(friends[3])

d) print(friends[2:1])

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions