0% found this document useful (0 votes)
10 views3 pages

21quiz On Python (3A & 3B)

The document is a quiz on the basics of Python programming, consisting of multiple choice questions, true or false statements, fill in the blanks, and coding problems. It covers topics such as variable names, data types, syntax, and basic programming functions. The quiz is structured into four sections, testing both theoretical knowledge and practical coding skills.

Uploaded by

Santusht
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)
10 views3 pages

21quiz On Python (3A & 3B)

The document is a quiz on the basics of Python programming, consisting of multiple choice questions, true or false statements, fill in the blanks, and coding problems. It covers topics such as variable names, data types, syntax, and basic programming functions. The quiz is structured into four sections, testing both theoretical knowledge and practical coding skills.

Uploaded by

Santusht
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/ 3

JIMS Engineering Management Technical Campus, Greater Noida

Affiliated to Guru Gobind Singh Indraprastha University, Delhi


Approved by AICTE, BCI and NCTE
ISO 9001:2015 Certified Institution

Quiz on Basics of Python Programming

Section A: Multiple Choice Questions (MCQs)

Choose the correct option for each question.

1.​ Which of the following is a valid variable name in Python?​


a) 3variable​
b) variable_name​
c) variable-name​
d) class

2.​ Which function is used to get the length of a list in Python?​


a) size()​
b) length()​
c) len()​
d) count()

3.​ What does the following code print?​


print(type([1, 2, 3]))​
a) <class 'set'>​
b) <class 'list'>​
c) <class 'tuple'>​
d) <class 'dict'>

4.​ Which of the following is a mutable data type in Python?​


a) Tuple​
b) String​
c) List​
d) Integer

5.​ What is the purpose of syntax in programming?

a.​ To execute programs faster


b.​ To define the rules for the structure of a programming language
c.​ To optimize memory usage
d.​ To allow multiple languages to be used in one program
JIMS Engineering Management Technical Campus, Greater Noida
Affiliated to Guru Gobind Singh Indraprastha University, Delhi
Approved by AICTE, BCI and NCTE
ISO 9001:2015 Certified Institution

Section B: True or False

6. Write True or False for each statement.

A.​ Python is a case-sensitive language.


B.​ Tuples are mutable, while lists are immutable.
C.​ Indentation is optional in Python code blocks.
D.​ The break statement is used to exit a loop prematurely.
E.​ Strings in Python are immutable.
F.​ A Python dictionary can have duplicate keys.
G.​ Python supports method overloading like Java or C++.
H.​ The is operator compares the values of two objects, not their memory locations.
I.​ In Python 3, the range() function returns a list.

Section C: Fill in the Blanks

7. Fill in the blanks with the correct answers.

A.​ A ______ is a collection of key-value pairs in Python.


B.​ The function ______ is used to read input from the user.
C.​ The keyword ______ is used to define a function in Python.
D.​ The operator ** is used for ______ in Python.
E.​ The built-in function ______ returns the largest element in a list.
F.​ The method is used to add an element at the end of a list.
G.​ The function generates a sequence of numbers and is commonly used
with loops.
H.​ The statement is used inside a loop to skip the current iteration and move
to the next one.
I.​ The method is used to reverse the elements of a list in place.
JIMS Engineering Management Technical Campus, Greater Noida
Affiliated to Guru Gobind Singh Indraprastha University, Delhi
Approved by AICTE, BCI and NCTE
ISO 9001:2015 Certified Institution

Section D: Coding Questions

Write the code for each of the following problems.

8. Write a Python function to check if a number is even or odd.

def check_even_odd(num):

# Write your code here

9. Write a program to find the sum of all elements in a list.​


Example: Given [1, 2, 3, 4], the output should be 10.

# Write your program here

10. Write a Python program to reverse a string.​


Example: Input: "hello" Output should be: "olleh"

# Write your program here

11. Write a Python program to find the factorial of a number using a while loop.

# Write your code here

12. Write a Python program to count the number of vowels in a given string.​
Example: Input: "hello world" Output should be: 3

# Write your code here

You might also like