Search Header Logo
Review: Intro to CS 1

Review: Intro to CS 1

Assessment

Presentation

Computers

9th - 12th Grade

Easy

Created by

Emily Ishii

Used 6+ times

FREE Resource

9 Slides • 16 Questions

1

Review 1

Intro to Computer Science

2

Multiple Choice

Python is considered ______ programming.

1

block-based

2

text-based

3

Printing Output

We can output messages onto the screen using the "print" function.​

To print something onto the screen, we use the following format:

print("Your text goes here")​

4

Fill in the Blank

How can we print the following line:

Hello world!

5

Comments

To add comments to our code, we can use the following:

  • ​# (hashtag)

  • ''' (triple quotations)​

Comments are ignored when running the program and are a good way to highlight ​anything important about your code.

6

Multiple Choice

Which data type consists of characters enclosed by quotation marks?

1

string

2

integer

3

float

4

boolean

7

Multiple Choice

Which data type consists of numbers with decimal points?

1

string

2

integer

3

float

4

boolean

8

Multiple Choice

Which data type evaluates to "true" or "false"?

1

string

2

integer

3

float

4

boolean

9

Multiple Choice

Which data type consists of whole numbers without decimal points?

1

string

2

integer

3

float

4

boolean

10

Fill in the Blank

Which character/symbol do we use for addition?

11

Fill in the Blank

Which character/symbol do we use for subtraction?

12

Fill in the Blank

Which character/symbol do we use for multiplication?

13

Fill in the Blank

Which character/symbol do we use for division?

14

Fill in the Blank

Which character/symbol do we use for exponents?

15

User Input

We can include user input into our programs.

To ask for user input, we use the following format:

variable_name = input("Question")​

16

Open Ended

Ask the user for their name and input the information.

17

Multiple Choice

Asking for user input will always return a _____ data type.

1

string

2

integer

3

float

4

boolean

18

Casting

Casting allows us to convert from one data type to another.

For example, we can:

  • Convert a string into an integer using int( )

  • Convert an integer into a string using str( )

19

Casting

We can only concatenate strings with strings.​

That is, you will have an error when trying to concatenate, or combine, a string with another data type, such as an integer.​

It is important to use casting when needed!

Example: print("The area is " + str(area))​

20

Casting

Also note that you may have to convert user input into an integer data type, especially if you are trying to perform mathematical operations.

Example:

number = input("Enter a number: )

doubled_number = int(number) * 2​

21

Multiple Choice

Which casting would we use if we want to convert a string into an integer?

1

int( )

2

str( )

22

Multiple Choice

Which casting would we use if we want to convert an integer into a string?

1

int( )

2

str( )

23

Conditional Statements

Conditional statements tell the computer to run code if something is true.​

In other words, if a certain condition is true, then the code below will run.

The format uses indentation.

if <boolean condition is true>:

<execute this code>​

24

Conditional Statements

We can use "else if" and "else" statements if there are more outcomes.

​​

if <boolean condition is true>:

<execute this code>

elif <another boolean condition>:

<execute this code>

else:

<execute this code>​​

25

Fill in the Blank

What would the following code output if I typed "math"?

subject = input("Enter a subject: )

if subject == "computer science":

print("Good luck on your homework!")

elif subject == "math":

print("Good luck on your test!")

else:

print("Error.")

Review 1

Intro to Computer Science

Show answer

Auto Play

Slide 1 / 25

SLIDE