NEW
Font size
WorksheetsGame of Codes Workshop: Comprehensive Reading Material
Total questions: 64
Worksheet time: 32mins
What is Python? Fill in the blank: Python is a ________-level programming language with clear syntax, widely used in academia and industry for its versatility and readability.
high
low
machine
assembly
In Python, variables are containers for storing ________ values.
data
functions
loops
modules
Comments are used to explain code. Comments are ignored by Python when code runs. Which symbol is used for a single line comment in Python?
//
#
;;
Triple single inverted commas (''' ''') are used for multi line comments in Python.
True
False
Fill in the blank: The ________ function is used to display output in Python.
print()
display()
show()
output()
What is the value of the variable 'x' if it is defined as x = 10?
10
5
0
20
Which of the following is a float value?
10
3.14
'Hello'
True
What is the data type of the variable s = 'Hello'?
String
Integer
Boolean
Float
Which of the following is a boolean value?
10
3.14
'Hello'
True
What is the output of the following code? numbers = [1, 2, 3, 4] print(numbers)
[1, 2, 3, 4]
1 2 3 4
numbers
[1,2,3,4] (without spaces)
What is the output of the following code? coords = (10, 20) print(coords)
(10, 20)
10 20
[10, 20]
(10; 20)
What is the output of the following code? student = {"name": "Alice", "age": 20} print(student)
{'name': 'Alice', 'age': 20}
{"name": "Alice", "age": 20}
[('name', 'Alice'), ('age', 20)]
name: Alice, age: 20
What is the output of the following code? unique_nums = {1, 2, 3} print(unique_nums)
{1, 2, 3}
[1, 2, 3]
(1, 2, 3)
{1: 2, 3: 4}
Which operator is used for addition in Python?
-
*
+
/
Which operator is used for exponentiation in Python?
**
//
%
/
What is the output of the following code? a = 4 b = 6 print(a + b)
10
12
8
46
What is the output of the following code? a = 10 b = 3 print(a ** b)
1000
30
13
300
What is the output of the following code? a = 10 b = 3 print(a > b)
True
False
None
10
What is the output of the following code? a = 10 b = 3 print(a != b)
True
False
None
10
Which statement executes a block of code only if a given condition is true?
if statement
for statement
while statement
print statement
Which statement allows for multiple conditions to be checked sequentially?
if statement
if-else statement
if-else-elif statement
while statement
Which loop repeats as long as a condition is True?
for loop
while loop
if loop
print loop
What is the output of the following code? x = 745 if x > 0: print("Positive") elif x == 0: print("Zero") else: print("Negative")
Positive
Zero
Negative
None of the above
What is the output of the following code? countries = ["Japan", "USA", "UK"] for country in countries: print(country)
Japan USA UK
Japan, USA, UK
UK USA Japan
Japan USA UK
What is the output of the following code? for i in range(4): print(i)
0 1 2 3
1 2 3 4
0 1 2 3 4
1 2 3
What is the output of the following code? count = 0 while count < 5: print(count) count += 1
0 1 2 3 4
1 2 3 4 5
0 1 2 3 4 5
1 2 3 4
What is a function in Python?
A variable that stores data
A reusable block of code that performs a specific task
A type of loop
A Python file
Fill in the blank: The keyword used to define a function in Python is _____
def
func
define
function
What is the output of the following code? def greet(): print("Welcome to Game of Codes!") greet()
Welcome to Game of Codes!
Hello World!
Syntax Error
None
What is a module in Python?
A loop
A Python file containing definitions and statements
A variable
A function
What is the output of the following code? import math print(math.sqrt(16))
2.0
4.0
8.0
16.0
NumPy is a Python library for _____
Web development
Numerical computing
String manipulation
File handling
Fill in the blank: The number of dimensions of a NumPy array is called the _____ of the array.
rank
shape
size
axis
What is the output of the following code? a = np.array([1, 2, 3]) print(a)
[1, 2, 3]
(1, 2, 3)
{1, 2, 3}
1 2 3
What is a Series in Pandas?
One-dimensional data (like a column)
Two-dimensional data (like a table)
Three-dimensional data
None of the above
What is a DataFrame in Pandas?
One-dimensional data (like a column)
Two-dimensional data (like a table)
Three-dimensional data
None of the above
What will be the output of the following code? import numpy as np c = np.array([11, 22, 33, 44, 55]) print(c[0])
11
22
33
44
What will be the output of the following code? import numpy as np c = np.array([11, 22, 33, 44, 55]) print(c[-1])
55
44
11
33
What will be the output of the following code? import numpy as np d = np.array([[1,2,3], [4,5,6], [7,8,9]]) print(d[0, 1])
2
1
3
5
What will be the output of the following code? import numpy as np a = np.array([1, 2, 3]) b = np.array([4, 5, 6]) print(a + b)
[5 7 9]
[4 10 18]
[1 2 3 4 5 6]
[3 3 3]
What will be the output of the following code? import numpy as np a = np.array([1, 2, 3]) b = np.array([4, 5, 6]) print(a * 2)
[2 4 6]
[5 7 9]
[1 2 3 4 5 6]
[8 10 12]
What will be the output of the following code? import pandas as pd s = pd.Series([1, 2, 3, 4, 5]) print(s)
0 1 1 2 2 3 3 4 4 5 dtype: int64
1 1 2 2 3 3 4 4 5 5 dtype: int64
0 1 1 2 2 3 3 4 4 5 dtype: float64
0 5 1 4 2 3 3 2 4 1 dtype: int64
What will be the output of the following code? import pandas as pd mydata = { 'Country': ['India', 'USA', 'Japan', 'Switzerland'], 'CountryCode': [91, 1, 81, 268], 'Currency': ['Rupee', 'Dollar', 'Yen', 'Franc'] } df = pd.DataFrame(mydata) print(df)
Country CountryCode Currency 0 India 91 Rupee 1 USA 1 Dollar 2 Japan 81 Yen 3 Switzerland 268 Franc
Country CountryCode Currency 0 India 91 Dollar 1 USA 1 Rupee 2 Japan 81 Yen 3 Switzerland 268 Franc
Country CountryCode Currency 0 India 91 Rupee 1 USA 1 Franc 2 Japan 81 Dollar 3 Switzerland 268 Yen
Country CountryCode Currency 0 Switzerland 268 Franc 1 Japan 81 Yen 2 USA 1 Dollar 3 India 91 Rupee
Which of the following code snippets will select the 'Country' column from the DataFrame df?
df['Country']
df.Country
df.loc['Country']
df.iloc['Country']
Fill in the blank: The currency of India is _______.
Rupee
Dollar
Yen
Euro
Fill in the blank: The country code for Japan is _______.
81
44
49
86
Fill in the blank: The currency of Switzerland is _______.
Franc
Euro
Dollar
Pound
Which country uses the Dirham as its currency?
India
UAE
Japan
Switzerland
Which Python library is used to make graphs, charts, and plots from data?
NumPy
Pandas
Matplotlib
Seaborn
In the given code, what does the function plt.show() do?
plt.show() displays the plot window.
plt.show() saves the plot as an image file.
plt.show() clears the current plot.
plt.show() adds a title to the plot.
What is the title of the plot shown in the image?
Simple Line Plot
Bar Chart
Scatter Plot
Pie Chart
In the code, what does plt.xlabel('X-axis') do?
It sets the label for the X-axis of the plot.
It sets the title of the plot.
It sets the label for the Y-axis of the plot.
It changes the color of the X-axis.
What type of plot is shown in the 'Customized Plot' figure?
Bar Chart
Line Plot
Scatter Plot
Pie Chart
Based on the bar chart shown, what is the value for category 'C'?
15
10
20
25
Which color is used for the bars in the bar chart according to the code?
Blue
Orange
Red
Green
In the scatter plot code, what marker is used for the points?
o
*
x
s
What is the y-value corresponding to x = 10 in the scatter plot?
20
10
15
25
What does the following code do? plt.xlabel('Categories') plt.ylabel('Values')
It sets the x-axis label to 'Categories' and the y-axis label to 'Values'.
It creates a bar chart with categories and values.
It plots a line graph with categories on the x-axis and values on the y-axis.
It saves the plot as an image file named 'Categories_Values.png'.
Refer to the code snippet below: '''1 '''Reading and Writing Files:''' 2 3 with open('data.txt', 'r') as file: 4 content = file.read() 5 print(content) ''' What is the purpose of the code snippet shown above?
To write data to a file
To read data from a file and print it
To delete a file
To create a new file
Fill in the blank: The mode used to open the file in the code snippet is '__'.
r
w
a
rb
Which of the following is an application of Python in scientific computing?
Data cleaning
Simulations and data analysis
Web development
Report generation
Which of the following is an example of Python use in data science?
Automating report generation
Visualizing trends in experimental data
Coding quiz
Web development
Which of the following is NOT listed as a resource for further learning Python?
Python Official Documentation
NumPy Documentation
JavaScript Documentation
Pandas Documentation
Name one recommended book for learning Python mentioned in the worksheet.
'Automate the Boring Stuff with Python' by Al Sweigart
'The C Programming Language' by Brian Kernighan and Dennis Ritchie
'Java: The Complete Reference' by Herbert Schildt
'Head First JavaScript Programming' by Eric Freeman and Elisabeth Robson
