Code Tracing
Code Tracing
Code Tracing
Cyber Security
Cyber Security
Types of Errors
Types of Errors
Internet
Internet
Control Structures
Control Structures
100

nums = [3, 5, 7]

total = 0

for i in range(len(nums)):
    total += nums[i]

print(total)

What is 15?

100

result = 0

for num in [1, 2, 3, 4]:
    if num % 2 == 0:
        result += num

print(result)

What is 6?

100

What values does i take on during the loop?

What is printed?

def mystery(a, b):
    total = 0

    for i in range(a, b):
        total += i

    return total

print(mystery(2, 5))

What is 2, 3, 4?

What is 9?

100

This type of attack tricks users into giving away passwords or personal information through fake emails or websites.

What is Phishing?

100

A firewall mainly serves this purpose in a computer network.

What is filtering and monitoring network traffic?

100

This type of error occurs when the rules of Python grammar are broken.

What is syntax error?

100

This error happens when you try to combine incompatible data types, like adding a string and an integer.

What is Type error?

100

This system connects millions of computers together worldwide.

What is the internet?

100

This protocol is used to transfer web pages on the Internet.


What is HTTP?

100

This control structure allows a program to make decisions based on conditions.


What is Selection? (or if statement)

100

This loop repeats a block of code a specific number of times or for each item in a list.


What is For Loop?

200



x = 4

if x > 5:
    print("A")
else:
    print("B")


What is B?

200

def mystery(x):
    return x * 2 - 1

print(mystery(4))

What is 7?

200

nums = [1, 3, 5, 7]

for i in range(len(nums)):
    nums[i] += 1

print(nums)

What is 2, 4, 6, 8?

200

This cybersecurity principle ensures that information is only accessible to authorized users.

What is confidentiality?

200

This type of hacker breaks into systems illegally for malicious purposes.

What is a black hat hacker?

200

This type of error happens while the program is running, often causing the program to crash.


What is runtime error?


200

A missing colon at the end of an if statement will usually produce this type of error.

What is a syntax error?

200

This device directs data packets between networks to help information reach its destination.


What is Router?

200

The Internet is considered reliable because it uses this approach, where many different paths can carry data.


What is redundancy?

200

This loop continues running while a condition remains true.


What is While Loop?

200

What is printed by this code?


x = 7

if x > 10:
    print("A")
else:
    print("B")


What is B?

300


count = 1

while count < 5:
    print(count)
    count += 2



What is 1,3?

300

letters = ["a", "b", "c"]

for i in range(len(letters)):
    print(i, letters[i])

What is A, B, C?

300



def check(num):
    if num % 2 == 0:
        return "even"
    return "odd"

print(check(7))
print(check(10))


What is odd, even?
300

A strong password should include uppercase letters, lowercase letters, numbers, and symbols because it helps prevent this type of attack that tries every possible password combination.

What is Brute Force attack?

300

A Denial-of-Service (DoS) attack attempts to do this to a server or website.

What is overload it with traffic so legitimate users cannot access it?

300

This error occurs when a program runs without crashing but produces the wrong result.


What is logic error?

300

Accessing an index that does not exist in a list causes this error.

What is Index error?

300

Information sent across the Internet is broken into smaller pieces called these.


What is Packets?
300

This system translates website names like google.com into IP addresses.


What is DNS?

300

What is the final value of total?


total = 0

for i in range(1, 5):
    total += i



What is 10?

300

This keyword is used to run a different block of code if an if condition is false.


What is else?

400

word = "python"

print(word[1])
print(word[-1])

What is Y, N?

400

x = 10

def change():
    x = 5
    print(x)

change()
print(x)

What is 5, 10?

400

for i in range(1, 5):
    total *= i

print(total)

What is 24?

400

Hackers install malicious software on a computer that locks files until money is paid.

What is Ransomware?

400

This cybersecurity practice requires users to verify identity using two different methods, such as a password and a phone code.

What is multi factor authentication? (2 factor authentication)

400

Trying to divide by zero causes this specific runtime error in Python.


What is ZeroDivision Error?

400

An infinite loop is usually caused by this type of programming mistake.


What is Logic error?
400

An IP address is mainly used for this purpose on the Internet.


What is identifying a device/location on a network?

400

This protocol securely transfers web data by encrypting communication between a browser and website.


What is HTTPS?

400

What is printed by this code?

count = 1

while count < 4:
    print(count)
    count += 1


What is 1, 2, 3?
400

This operator checks whether two values are equal.


What is ==?
500

nums = [2, 4, 6]

nums[1] = nums[0] + nums[2]

print(nums)

What is 2, 8, 6?

500

numbers = [1, 2, 3]

for n in numbers:
    numbers.append(n)

    if len(numbers) > 5:
        break

print(numbers)

What is 1, 2, 3, 1, 2, 3?

500

data = [4, 2, 8]

smallest = data[0]

for num in data:
    if num < smallest:
        smallest = num

print(smallest)

What is 2?

500

This encryption method uses two keys: one public and one private.

What is Public Key Encryption? (Or Asymmetric Encryption)
500

Why is HTTPS generally safer than HTTP?

What is HTTPS encrypts data sent between the browser and website?




500

Using a variable before it has been created causes this error.

What is Name Error?

500

Reading an error message carefully helps programmers identify the line number and this important information.

What is Cause/Type error?

500

Packet switching improves Internet efficiency because it allows packets to do this.


What is travel independently across different routes?

500

TCP helps guarantee reliable communication on the Internet by doing these two things.


What are checking for errors and re-sending missing packets?





500

What is printed?


for num in [2, 4, 6]:
    if num == 4:
        print("Found")


What is Found?

500

A programmer accidentally creates a loop that never stops running. This is called this type of loop.


What is Infinite Loop?