Module quiz: Basic Programming with Python Quiz Answers
In this article i am gone to share Coursera Course: Programming in Python by Meta Week 2 | Module quiz: Basic Programming with Python Quiz Answers with you..
Module quiz: Basic Programming with Python Quiz Answers
Question 1)
Which of the following is not a sequence data-type in Python?
- String
- Tuples
- List
- Dictionary
Question 2)
For a given list called new_list, which of the following options will work: new_list = [1,2,3,4] Select all that apply.
- new_list[4] = 10
- new_list.extend(new_list)
- new_list.insert(0, 0)
- new_list.append(5)
Question 3)
Which of the following is not a type of variable scope in Python?
- Local
- Global
- Enclosing
- Package
Question 4)
Which of the following is a built-in data structure in Python?
- Queue
- Tree
- LinkedList
- Set
Question 5)
For a given file called ‘names.txt’, which of the following is NOT a valid syntax for opening a file:
- with open(‘names.txt’, ‘r’) as file:
print(type(file)) - with open(‘names.txt’, ‘w’) as file:
print(type(file)) - with open(‘names.txt’, ‘rb’) as file:
print(type(file)) - with open(‘names.txt’, ‘rw’) as file:
print(type(file))
Question 6)
Which among the following is not a valid Exception in Python?
- ZeroDivisionException
- FileNotFoundError
- IndexError
- LoopError
Question 7)
For a file called name.txt containing the lines below:
First line Second line And another !
What will be the output of the following code:
with open('names.txt', 'r') as file: lines = file.readlines()print(lines) with open('names.txt', 'r') as file: lines = file.readlines() print(lines)
- [‘First line\n’,
‘Second line\n’,
‘And another !’]
Question 8)
State TRUE or FALSE:
*args passed to the functions can accept the key-value pair.
- True
- False