• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 2 pages
Exam (elaborations)

Python Essentials | Part 1 Summary Test-Questions and Answers

Document preview thumbnail
Preview 1 out of 2 pages

Python Essentials | Part 1 Summary Test-Questions and Answers 1. Which of the following lines incorrectly. invokes the function defines as: def fun (a, b, c=0) : - ANSWER-fun ( 2. What is the output of the following snippet? list = [x * x for x in range (5) ] def fun (1st) : del 1st [1st [2] ] return 1st print (fun (list) ) - ANSWER-[ ] 3. How many elements does the 1st list contain? 1st = [i for i in range (-1, -2) ] - ANSWER-One, Two, Three, Zero 4. What is the output of the following snippet? dct = {} dct [ '1' ] = (1, 2) dct [ '2' ] = (2, 1) for x in () : print (dct [x] [1] ,enf="") - ANSWER-12 or (1,2) or 21 or (2,1) 5. Assuming that the "tuple" is a correctly created tuple, the fact that tuples are immutable means that the following instruction: tuple [1] = tuple [0] - ANSWER- 6. The following snippet: def func(a, b) : return b ** a print (func (b=2, 2) ) - ANSWER- 7. What is the output of the following piece of code? print ("a", "b", "c", sep="sep") - ANSWER- 8. An operator able to check whether two values are not equal is coded as: - ANSWER- 9. What is the output of the following snippet? dct = { 'one' : 'two', 'three' : 'one, 'two' : 'three' } v =v dct ['three'] for k in range (len(dct) ) : v = dct [v]

Content preview

Python Essentials | Part 1 Summary Test-Questions and Answers 1. Which of the following lines incorrectly. invokes the function defines as:
def fun (a, b, c=0) : - ANSWER-fun (
2. What is the output of the following snippet?
list = [x * x for x in range (5) ]
def fun (1st) : del 1st [1st [2] ] return 1st
print (fun (list) ) - ANSWER-[ ]
3. How many elements does the 1st list contain?
1st = [i for i in range (-1, -2) ] - ANSWER-One, Two, Three, Zero
4. What is the output of the following snippet?
dct = {}
dct [ '1' ] = (1, 2)
dct [ '2' ] = (2, 1)
for x in dct.keys () : print (dct [x] [1] ,enf="") - ANSWER-12 or (1,2) or 21 or (2,1)
5. Assuming that the "tuple" is a correctly created tuple, the fact that tuples are immutable means that the following instruction:
tuple [1] = tuple [0] - ANSWER-
6. The following snippet:
def func(a, b) : return b ** a print (func (b=2, 2) ) - ANSWER-
7. What is the output of the following piece of code?
print ("a", "b", "c", sep="sep") - ANSWER-
8. An operator able to check whether two values are not equal is coded as: - ANSWER-
9. What is the output of the following snippet?
dct = { 'one' : 'two', 'three' : 'one, 'two' : 'three' }
v =v dct ['three'] for k in range (len(dct) ) : v = dct [v]

Document information

Uploaded on
March 28, 2024
Number of pages
2
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
$8.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
386
Last sold
-




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions