wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Basics, Strings & Pandas Worksheet

Total questions: 70

Worksheet time: 35mins

Name
Class
Date
1.

What symbol is used to create a comment in Python?

a)

//

b)

#

d)

;;

2.

Which of the following is a valid Python variable name?

a)

2var

b)

_data

c)

for

d)

var-name

3.

Which operator is used for assignment in Python?

a)

==

b)

:=

c)

=>

d)

=

4.

What does the print() function do?

a)

Saves a file

b)

Returns a value

c)

Outputs text to screen

d)

Pauses execution

5.

What is the file extension for Python scripts?

a)

.pt

b)

.script

c)

.python

d)

.py

6.

Loops and Functions — What keyword starts a while loop?

a)

do

b)

repeat

c)

while

d)

loop

7.

Which function is used to get user input in Python?

a)

input()

b)

scan()

c)

read()

d)

prompt()

8.

What keyword exits a loop prematurely?

a)

skip

b)

exit

c)

break

d)

stop

9.

What does continue do in a loop?

a)

Ends the loop

b)

Skips the current iteration

c)

Prints an error

d)

Starts a new loop

10.

Which of these is a valid function definition in Python?

a)

def add(x, y):

b)

function add(x, y)

c)

define add(x, y):

d)

func add(x, y)

11.

Strings & Data Types — What data type is "123" in Python?

a)

Integer

b)

Float

c)

String

d)

Boolean

12.

What is the result of "2" + "2" in Python?

a)

4

b)

"22"

c)

Error

d)

None

13.

Which method converts all string characters to uppercase?

a)

toUpper()

b)

upper()

c)

uppercase()

d)

makeUpper()

14.

Which method is used to remove whitespace from both sides of a string?

a)

clean()

b)

strip()

c)

trim()

d)

remove()

15.

Which function gives the length of a string?

a)

size()

b)

count()

c)

len()

d)

length()

16.

Pandas — What does df.head() display?

a)

Last 5 rows

b)

Summary

c)

First 5 rows

d)

Column names only

17.

What data structure is used in Pandas for 2D data?

a)

Array

b)

Table

c)

DataFrame

d)

Tuple

18.

How do you select a single column called 'Age' from a DataFrame df?

a)

df.select('Age')

b)

df['Age']

c)

df.get('Age')

d)

df.Age()

19.

What function is used to merge two DataFrames?

a)

join()

b)

append()

c)

bind()

d)

merge()

20.

What does fillna() do in Pandas?

a)

Removes all rows

b)

Fills missing values

c)

Deletes duplicates

d)

Adds new rows

21.

What does np.array([1,2,3]) create?

a)

DataFrame

b)

List

c)

Series

d)

NumPy array

22.

How do you calculate the mean of a NumPy array arr?

a)

arr.mean()

b)

mean(arr)

c)

np.mean(arr)

d)

average(arr)

23.

What will arr[1:3] return?

a)

1st to 3rd element

b)

2nd and 3rd element

c)

1st to 2nd element

d)

2nd to 4th element

24.

What does np.arange(0, 10) return?

a)

Array from 0 to 9

b)

Array from 0 to 10

c)

Error

d)

List from 1 to 10

25.

Which of the following is not a NumPy statistical function?

a)

np.mean

b)

np.std

c)

np.count

d)

np.median

26.

What is plt.plot() used for?

a)

Tables

b)

Line graphs

c)

Histograms

d)

Labels

27.

Which function adds a title to a plot?

a)

title()

b)

plt.title()

c)

plot.title()

d)

graph.title()

28.

Which library is used with Matplotlib to plot Pandas data?

a)

SciPy

b)

Seaborn

c)

Pandas

d)

NumPy

29.

What function displays the plot?

a)

plot()

b)

draw()

c)

show()

d)

plt.display()

30.

What does plt.hist() plot?

a)

Bar chart

b)

Scatter plot

c)

Histogram

d)

Pie chart

31.

Which function is used to access the current ArcGIS Pro project?

a)

arcpy.project()

b)

arcpy.loadProject()

c)

arcpy.mp.ArcGISProject()

d)

arcpy.mp.open()

32.

What does map.listLayers() return?

a)

Layout elements

b)

Map names

c)

Feature classes

d)

Layers in a map

33.

Which ArcPy method adds symbology from another layer?

a)

ApplyStyle()

b)

ApplyLayer()

c)

ApplySymbologyFromLayer()

d)

StyleLayer()

34.

What is the file extension for ArcGIS layer files?

a)

.lyrx

b)

.shx

c)

.csv

d)

.gdb

35.

Which command saves changes to a project in ArcPy?

a)

aprx.save()

b)

aprx.commit()

c)

arcpy.saveProject()

d)

aprx.write()

36.

What does GIS stand for?

a)

Global Information Structure

b)

Geographical Information System

c)

General Info Statistics

d)

Geospatial Internet Services

37.

Which of the following is a component of GIS?

a)

SQL

b)

Cloud computing

c)

People

d)

Blockchain

38.

What are the two main GIS data models?

a)

Linear and Circular

b)

Spatial and Temporal

c)

Raster and Vector

d)

2D and 3D

39.

What does vector data represent?

a)

Elevation

b)

Pixels

c)

Points, lines, polygons

d)

Images

40.

What is the smallest unit of raster data?

a)

Cell

b)

Pixel

c)

Node

d)

Vertex

41.

Who is known as the "Father of GIS"?

a)

Jack Dangermond

b)

Dr. Roger Tomlinson

c)

Ian McHarg

d)

John Snow

42.

What does topology ensure in vector data?

a)

Data encryption

b)

Projection

c)

Spatial relationships

d)

Table sorting

43.

Which GIS type is used via browsers?

a)

Desktop GIS

b)

Enterprise GIS

c)

Web GIS

d)

Cloud GIS

44.

Which data model is better for surface analysis?

a)

Vector

b)

Raster

c)

SQL

d)

Feature

45.

What does attribute data describe?

a)

Location

b)

Coordinates

c)

Features

d)

Descriptive characteristics of features

46.

Which ArcPy command removes a layer from a map?

a)

map.remove()

b)

removeLayer()

c)

map.deleteLayer()

d)

remove(layer)

47.

Which is NOT a type of GIS listed in GIS-503?

a)

Desktop GIS

b)

Mobile GIS

c)

Cloud GIS

d)

Terminal GIS

48.

What is the format of a GIS raster file pixel value?

a)

Vector

b)

Binary

c)

Single value

d)

Multi-value array

49.

What is the purpose of listLayouts() in ArcPy?

a)

Lists maps

b)

Lists tables

c)

Lists layout elements

d)

Lists map legends

50.

What is the advantage of vector data over raster?

a)

More colorful

b)

Simpler structure

c)

Better for surface modeling

d)

More compact and accurate geometry

51.

What is the primary data structure used by GeoPandas?

a)

DataGrid

b)

GeoSeries

c)

GeoFrame

d)

GeoDict

52.

What file format does Fiona primarily work with?

a)

NetCDF

b)

.csv

c)

.shp

d)

.tif

53.

Which function in GeoPandas is used to read a shapefile?

a)

gpd.load()

b)

gpd.read_file()

c)

gpd.open_shapefile()

d)

shapefile.read()

54.

What is the purpose of the Shapely library?

a)

Plot satellite images

b)

Read raster data

c)

Manipulate geometric shapes

d)

Connect to APIs

55.

Which of the following is a valid Shapely geometry?

a)

GeoPoint

b)

Polygon

c)

Raster

d)

Layer

56.

What does folium.Map() create?

a)

A point geometry

b)

A coordinate list

c)

An interactive leaflet map

d)

A shapefile

57.

What function in Folium adds markers to a map?

a)

add_layer()

b)

Marker()

c)

add_point()

d)

Drop()

58.

What file format does Rasterio commonly work with?

a)

.json

b)

.shp

c)

.tif

d)

.xlsx

59.

Which module is commonly used with Rasterio to read metadata?

a)

rasterio.meta.read()

b)

rasterio.open().meta

c)

rasterio.read()

d)

rasterio.open().info()

60.

What function is used to read raster data in Rasterio?

a)

read_image()

b)

rasterio.load()

c)

dataset.read()

d)

open_raster()

61.

In Network Analyst, what is the purpose of arcpy.na.MakeRouteLayer()?

a)

To edit routes

b)

To convert to shapefile

c)

To create a route analysis layer

d)

To export a network dataset

62.

Which method adds locations to a network analysis layer?

a)

arcpy.na.AssignPoints()

b)

arcpy.na.AddLocations()

c)

arcpy.na.Attach()

d)

arcpy.na.Insert()

63.

What unit is commonly used for impedance in ArcPy network analysis?

a)

Inches

b)

Minutes

c)

Meters

d)

Degrees

64.

What is the result of arcpy.na.Solve()?

a)

A raster file

b)

An edited feature

c)

A solved route or network

d)

A spatial join

65.

In Folium, how do you save a map to an HTML file?

a)

map.save()

b)

map.export()

c)

map.to_file()

d)

map.write_html()

66.

Which of the following can be used to validate geometries in Shapely?

a)

.validate()

b)

.check()

c)

.is_valid

d)

.test()

67.

What does GeoDataFrame.plot() do in GeoPandas?

a)

Creates an HTML map

b)

Plots geometries on a static map

c)

Converts raster to vector

d)

Writes to a shapefile

68.

Which of these libraries is best suited for reading and writing shapefiles?

a)

Shapely

b)

Rasterio

c)

Fiona

d)

NumPy

69.

In a routing analysis, what are "Stops"?

a)

Raster layers

b)

Metadata points

c)

Locations to include in a route

d)

Temporary buffers

70.

What function in Fiona is used to open a shapefile?

a)

fiona.open()

b)

fiona.read_file()

c)

fiona.load()

d)

fiona.shapefile()