0% found this document useful (0 votes)
1 views8 pages

Introduction to Python Programming Quiz Assignment

The document is a quiz on Python programming consisting of 20 questions, covering topics such as file extensions, variable names, data types, functions, loops, and exception handling. Each question has four options, and the respondent's email is recorded upon submission. The quiz is designed to assess knowledge of Python programming fundamentals.

Uploaded by

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

Introduction to Python Programming Quiz Assignment

The document is a quiz on Python programming consisting of 20 questions, covering topics such as file extensions, variable names, data types, functions, loops, and exception handling. Each question has four options, and the respondent's email is recorded upon submission. The quiz is designed to assess knowledge of Python programming fundamentals.

Uploaded by

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

Introduction to Python Programming Quiz

Assignment
Total points 20/20

The respondent's email (chethan18ms@gmail.com) was recorded on submission of this


form.

1. What is the correct extension of a Python file? * 1/1

.py

.pt

.pyt

.python

2. Which of the following is a valid variable name in Python? * 1/1

2name

name2

@name

name-2
3. What is the data type of True in Python? * 1/1

string

int

bool

float

4. What will be the output of print(2 ** 3)? * 1/1

5. Which keyword is used to create a function in Python? * 1/1

func

define

function

def
6. What is the output of print(type("5"))? * 1/1

int

str

float

bool

7. What will be the result of 10 // 3? * 1/1

3.33

3.0

8. Which of the following is used to import a module in Python? * 1/1

include

import

require

using
9. What will len("Python") return? * 1/1

Error

10. What is the correct way to create a list? * 1/1

list = {1, 2, 3}

list = [1, 2, 3]

list = (1, 2, 3)

list = <1, 2, 3>

11. How do you create a for loop in Python? * 1/1

for i in range(5):

foreach i in range(5):

loop i in range(5):

for(i=0; i<5; i++)


12. Which of the following is used to handle exceptions in Python? * 1/1

try-except

do-catch

throw-catch

try-catch

13. What is the correct way to define a dictionary? * 1/1

dict = [“a”:1, “b”:2]

dict = (“a”:1, “b”:2)

dict = {“a”:1, “b”:2}

dict = <“a”:1, “b”:2>

14. What does range(5) return? * 1/1

[0, 1, 2, 3, 4]

[1, 2, 3, 4, 5]

[5, 4, 3, 2, 1]

[0, 1, 2, 3, 4, 5]
15. What will be the output of the following code? * 1/1
x = [1, 2, 3]
print(x[1])

Error

16. What does the __init__() the method do in Python? * 1/1

Initializes the class for use

This function is called when a new object is instantiated

Initializes all the data attributes to zero when called

None of the above

17. In Python, a class is ___________ for a concrete object. * 1/1

Blue print

distraction

instance

none
18. Which of the following makes a function impure? * 1/1

Using return

Modifying global variables

Using parameters

Calling another function

19. What is the default mode in which a file is opened using open()? * 1/1

'r' (read)

'w' (write)

'a' (append)

'x' (exclusive creation)

20. What will happen if you try to open a non-existing file in 'r' mode? * 1/1

Creates a new file

Appends content

Raises a FileNotFoundError

Opens an empty file

This content is neither created nor endorsed by Google. - Contact form owner - Terms of Service - Privacy Policy

Does this form look suspicious? Report

Forms

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy