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

QP - Chapter Test Gr8 CS Python Collections and Functions

This document is a Grade VIII Computer Science exam paper focused on Python collections and functions, consisting of multiple-choice questions, assertions, fill-in-the-blanks, true/false statements, and short answer questions. It covers topics such as function definitions, recursion, and the use of built-in functions like pow() and max(). The exam is designed to assess students' understanding of Python programming concepts within a 45-minute timeframe.

Uploaded by

ananyachittal
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 views3 pages

QP - Chapter Test Gr8 CS Python Collections and Functions

This document is a Grade VIII Computer Science exam paper focused on Python collections and functions, consisting of multiple-choice questions, assertions, fill-in-the-blanks, true/false statements, and short answer questions. It covers topics such as function definitions, recursion, and the use of built-in functions like pow() and max(). The exam is designed to assess students' understanding of Python programming concepts within a 45-minute timeframe.

Uploaded by

ananyachittal
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

EKYA SCHOOLS/CMR NATIONAL PUBLIC SCHOOL

GRADE VIII Computer Science


UNIT: Python Collections and Functions

Time: 45 Minutes Maximum Marks: 30


Q1. Read the following Multiple-choice questions and choose the correct answer.

1. Which keyword is used to define a function in Python? 1


def add(a, b):
result = a + b
return result
a) add
b) def
c) result
d) return

Questions No. 2 & 3 are Assertion and Reason types. Each question consists of two statements, 1
namely
Assertion (A) and Reason (R). Select the most suitable option considering the Assertion &
Reason.

Options for both questions:

A. Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of
Assertion (A).

B. Both Assertion (A) and Reason (R) are true but Reason (R) is not a correct
explanation of Assertion (A).

C. Assertion (A) is true and Reason (R) is false.

D. Assertion (A) is false and Reason (R) is true.

2. Assertion (A): In Python, dictionaries are used to store data in key-value pairs. 1
Reason (R): Unlike lists, dictionaries do not maintain any order and they are indexed by unique
keys.

3. Assertion (A): Tuples in Python are immutable data types. 1


Reason (R): Once a tuple is created, its elements cannot be changed or updated.

4. Which of the following is the correct syntax for using the pow() function to calculate 3 raised to 1
the power of 4?

a) pow(3 4)
b) pow(3, 4)
c) pow(3 * 4)
d) pow(3 + 4)
EKYA SCHOOLS/CMR NATIONAL PUBLIC SCHOOL
GRADE VIII Computer Science
UNIT: Python Collections and Functions
5. Predict the output of the following program code: 1
t = (2, 4, 6, 8, 10)
t1 = t[1:4]
t2 = t1 * 2
print(t2)

Q2. Choose the correct words to fill in the blanks:

nested recursive Keyword Arguments return max()

1. A function that calls itself is called a ___________ function. 1

2. The keyword used to exit a function and return a value to the caller is __________. 1

3. The ___________ function returns the largest of the arguments passed to it. 1

4. Functions defined inside another function are called ___________ functions. 1

5. ____________________ are arguments passed to the function by explicitly specifying the 1


parameter name.

Q3. Identify whether the following statements are true or false. Correct the false statements.

1. A Python function can return multiple values. 1

2. Default arguments in a function must always be listed first in the function definition. 1

3. The correct syntax to define a function multiply that takes two numbers, a and b, and returns 1
their product is def multiply(a, b): return a * b.

4. A variable defined inside a function has a global scope. 1

5. The return statement in Python is used to exit a function and return a value (or values) to the 1
caller.

Q4. Answer the following in one sentence.

1. What is the difference between a function and a method in Python? 1

2. What is the purpose of the pass statement in a Python function? 1

3. How does Python handle multiple return values from a function? 1

4. Can we have more than one return statement in a Python function? Why or why not? 1

5. What are default arguments in Python functions? 1


EKYA SCHOOLS/CMR NATIONAL PUBLIC SCHOOL
GRADE VIII Computer Science
UNIT: Python Collections and Functions
Q5. Answer the following.

1. Write a Python function that takes an arbitrary number of arguments and returns the largest 3
value among them. Provide a sample function call.

2. Write a Python program to define a function that accepts a list of numbers and returns the 3
largest and smallest numbers in the list.

Q6. Answer the following.

1. Explain recursion in Python with an example. Write a Python function that calculates the 4
factorial of a number using recursion.

You might also like