Comp Thinking Exam

0.0(0)
studied byStudied by 2 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

21 Terms

1
New cards

Conversion between decimal and binary number system

0 is off, 1 is on, all of the zeroes and exponents can make numbers by adding, Bit (1), Bite (8), kilobite (1000), megabite (10000), gigabite (100000), terabite (1000000), decimal is normal, binary is 0s and 1s

2
New cards

Can you identify AND, OR, and NOT logic gates?

If “and” is shown, and 1 is true and the other is true, it is true. If one or two is false, the statement is false

If “or” is shown, and 1 or more is true, then the statement is true. If both statements are false, then the whole statement is false

“Not” negates a statement

3
New cards

Can you create the correct drawings to represent a Boolean logic circuit?

4
New cards

Can you create a table showing the truth values for a Boolean logic circuit?

Variables such as A or B are put through the Boolean logic circuit. They can represent true (1) or false (0) values. Depending on what the circuit looks like, the values can come out true or false. The final variable will be something like “Z”

5
New cards

Can you state the four original Karel functions?

put_ball(), take_ball(), turn_left(), move()

6
New cards

Can you distinguish between a high level of abstraction and a low level of abstraction?

High abstraction gives a bit of info and is simplified, low abstraction gives a lot of normally unnecessary information and is very detailed

7
New cards

Can you state the reasons why abstraction and decomposition are important in coding?

They work together so that code is easier to understand. Decomposition breaks a problem down into smaller parts so that it is easier to understand, and abstraction can simplify a problem

8
New cards

Can you distinguish between syntax and logical errors?

Syntax error: Is mechanically incorrect, the code is wrong

Logical error: The code is logically incorrect, the code doesn’t do what it should do

9
New cards

Decomposition

breaking a problem down into smaller parts

10
New cards

Top down design

A large problem is broken down into smaller parts step by step in order

11
New cards

Debugging

Fixing a flawed code by fixing syntax errors and logical errors

12
New cards

Can you state the purpose of using functions in programming?

To make code easier to understand

13
New cards

Can you write both a single-line and multi-line comment using correct notation?

Single line comment: #_____________

Multi line comment: ‘’’ then lines of code ‘’’ or “”” then lines of code “””

14
New cards

Can you write conditional statements and apply them to contextual situations?

Conditional statements apply to if something is true or not.

x=3

if x==3:

    print("Berry")

elif x>=0:

    print("Death")

else:

    print("Ilysm")

15
New cards

Can you write while loops and apply them to contextual situations?

Infinite loop unless it breaks or uses the function “break”

x=3

while x<=9:

   x=x+1

   print(x)

Output: 4,5,6,7,8,9,10

16
New cards

Can you state the four data types and what each data type represents?

str: a string, or text

int: an integer(whole) number

float: a decimal number

bool: True or False

17
New cards

Can you state the rules for naming variables in Python?

-May only include letters, numbers, and underscores; no other symbols

-cannot begin with numbers

-cannot include reserved words(while, in, else, etc.)

-names are case-sensitive.

18
New cards

Can you apply the seven arithmetic operations (+,-,*,/,**,//,%) to simple mathematical expressions?

+Is adding

-Is subtracting

* is multiplying

/ is division

** is exponents

// is floor division(rounds down, no matter what)

% gives the output of the remainder

19
New cards

Can you write code to prompt a user for information?

Prompting for integer: x = int(input(“____________”)

Prompting for a response: favorite_food = input(“What is your favorite food?”)

20
New cards

for i in range

for i in range(2,20,2):

    print(i)

the output for this example would be: 2, 4, 6, 8, 10, 12, 14, 16, 18

For i in range prints a sequence of numbers: start, stop, sequence 🙂

21
New cards

Can you concatenate strings to print out a statement that may include a literal string and one or more variables?

Yes! Even if they are integers, you can do this. It might look something like this:

x = input("How are you today? ")

y = int(input("What is your favorite number? "))

print("Amanda is " + x + " and her favorite number is " + str(y))