0% found this document useful (0 votes)
63 views2 pages

(7 Points) : ISC3U Test Unit 4 and Unit 5 Part A

This document contains a practice test for a Python programming course. It includes multiple choice and free response questions to test students' understanding of Python concepts like data types, variables, operators, comments, and basic input/output. Students are asked to define Python terms, give examples of illegal variable names, perform string operations, write code demonstrating a semantic error, and write a program to calculate a user's grade average from inputted values.

Uploaded by

bwLRq3V
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views2 pages

(7 Points) : ISC3U Test Unit 4 and Unit 5 Part A

This document contains a practice test for a Python programming course. It includes multiple choice and free response questions to test students' understanding of Python concepts like data types, variables, operators, comments, and basic input/output. Students are asked to define Python terms, give examples of illegal variable names, perform string operations, write code demonstrating a semantic error, and write a program to calculate a user's grade average from inputted values.

Uploaded by

bwLRq3V
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ISC3U Test

Unit 4 and Unit 5

PART A

[7 points]
Write down each of the following words next to its definition below: float, input, int, len, print, raw_input, str

__________ A type used to represent integer numbers


__________ A type used to represent strings, as well as a function which converts other types to string
__________ A function used to prompt the user for any valid Python expression (including numbers)
__________ A function which returns the length of a string
__________ A type used to represent decimal numbers
__________ A function used to display content to a user
__________ A function used to prompt the user for input, saving the result in a string

[3 points]
Give three examples of an illegal variable name, and explain why each is illegal. You can only use a given reason once.

__________ __________________________________________________________________________

__________ __________________________________________________________________________

__________ __________________________________________________________________________

[3 points]
What is the result of the following two expressions?

x = “I love eating Cheetos, though too much is bad”

x[14:16] + x[7:13] ____________________________________

x[0] + “S” ____________________________________

x[-3:] ____________________________________

[2 points]
Describe the two ways you can write comments in Python:
PART B

[5 Points]
In the space below, write Python code which demonstrates a semantic error. Be sure to include a comment explaining
the error.

[15 Points]
In the space below, write a well-commented Python program which prompts a user to enter his/her name, and each of
the last six grades (in percentages) from last semester. You should calculate his/heroverall average, and display the
following type of output:

*****************************************************
* Hi Marie! *
* Your average this semester was: 82.4% *
*****************************************************

BONUS

[5 points]
In your own words, describe what the following Python statement will do
print ("*"*len(raw_input()))[:]

You might also like