Unit 8 (Unit 3) Computer Science Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are the three main building blocks of programming? (3)

A
  • Sequence
  • Selection
  • Iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is sequence in programming?

A

The specific order in which instructions or statements are executed in a program. It ensures operations happen in a logical and predictable order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is pseudocode?

A

A simplified, informal way of describing an algorithm or program logic using plain language. It focuses on structure and flow without specific programming syntax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a high-level language?

A

A type of programming language designed to be easy for humans to read and write

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is syntax in programming?

A

The set of rules that define the structure and format of valid statements in a programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are data types?

A

Data types define the kind of data a variable can hold, such as numbers, text, or boolean values. They ensure data is processed and stored correctly by the system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do data types enable appropriate storage?

A

Data types allow data to be stored in the right format, e.g. numbers as integers, characters as strings, etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do data types enable effective manipulation?

A

Data types allow operations like mathematical calculations on numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is automatic validation in the context of data types?

A

The system automatically checks if the data matches the expected type and prevents errors

Note: This is a trick word in exams for CS they use validation which sounds confusing but it just means CHECKING

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an integer in Python?

A

An integer is a positive or negative WHOLE number that can be used with mathematical operators (MUST be a whole number, cant be a decimal number)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a real number (float) in Python?

A

A real number is a positive or negative number WITH A DECIMAL and it can be used with mathematical operators (MUST be a decimal number, cant be a whole number)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a char in Python?

A

A char is a variable or constant that HOLDS a SINGLE character which can be letters, digits, or any printable symbol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a string in Python?

A

A string is a variable or constant that HOLDS MULTIPLE characters, which can be letters, digits, or any printable symbol. Strings can also be empty

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a boolean in Python?

A

A boolean is a variable or constant that can have only two values: TRUE or FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How would you DIRECTLY assign an integer in python (give example)?

A

Score = 25

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How would you DIRECTLY assign a real number (float) in python (give example)?

A

Price = 2.67

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How would you DIRECTLY assign a char value in python (give example)?

A

Grade = ‘A’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How would you DIRECTLY assign string values in python (give example)?

A

Name = “Kyllian Mbappe KM9”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How would you DIRECTLY assign boolean in python (give example)?

A

logged_in_now = True

(this just represents a boolean showing login status)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How do you get an integer input from a user with python (use age as an example)?

A

age = int(input(“Enter your age: “))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How do you get a real number (float) input from a user with python (use price as an example)?

A

price = float(input(“Enter the price: “))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is Sequence in programming?

A

Sequence refers to the order in which instructions or steps are executed in an algorithm. The correct order is crucial because an incorrect sequence can lead to incorrect results or unnecessary steps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is Selection in programming?

A

Selection is a programming flow concept that allows the program to make decisions based on conditions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is an If Statement?

A

It is a conditional statement that executes a block of code if its condition is true, otherwise it skips that block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is an Else Statement?

A

An else statement provides an alternative to an if statement. It executes a block of code when the if condition is false

26
Q

What is a Nested Statement?

A

Nested if statements allow one if statement inside another to check multiple conditions. They provide structure but can make code more complex.

27
Q

What is a Case Statement?

A

Case statement checks a variable for different values and runs the code that matches the value

28
Q

What is Selection in programming?

A

Selection allows a program to make decisions and choose different paths based on whether conditions are true or false

29
Q

What do If Statements in programming allow?

A

It allows for branching outcomes in programs

30
Q

What do Else Statements in programming allow?

A

It creates two possible paths, allowing the program to handle different scenarios efficiently

31
Q

What do Case Statements in programming allow?

A

Helps people test a variable against several possible values. When a match is found, the corresponding code block executes

32
Q

What are the benefits of selection in programming?

A
  • Enables decision-making in programs.
  • Makes applications user-responsive.
  • Helps programmers create logical and efficient solutions.
33
Q

What is Iteration in programming?

A

Iteration is the repetition of a block of instructions in a program. It can repeat a set number of times or until a condition is met, helping avoid repetitive code

34
Q

What is a For Loop (Count Controlled)?

A

A for loop is a control flow statement that repeatedly executes a block of code a specified number of times, often used when you know how many times you want the code to run

35
Q

What is a Repeat Until (Condition Controlled) loop?

A

A Repeat Until loop executes at least once. The condition is checked after the statements, and it stops when the condition is true

36
Q

What is a While (Condition Controlled) loop?

A

While loop tests a condition before executing statements. The loop runs only if the condition is true and repeats the check after each execution. It ends when the condition becomes false.

37
Q

What is Totalling in programming?

A

Totalling is the process of adding up values, often using a loop. A total variable is set to 0 at the beginning and updated during each loop iteration

38
Q

What is Counting in programming?

A

Counting keeps track of how many times an event happens. A count variable is set to 0 and updated in each loop iteration based on the event

39
Q

What is String HANDLING?

A

String handling is when you perform tasks on strings, such as joining two strings, slicing a string into parts, or finding out how many characters it contains

40
Q

What is the Length method in string handling?

A

The Length method counts the number of characters in a string.

41
Q

What is the Case Conversion method in string handling?

A

The Case Conversion method changes a string from one case to another, such as converting all characters to uppercase or lowercase

42
Q

What is the Substring method in string handling and whats its use?

A

The Substring method allows you to extract a sequence of characters from a larger string. This can be useful for tasks like data validation or combining parts of strings

43
Q

How is Substring extraction performed in Python?

A

Substring extraction is done using slicing. You specify a start and end position to get the desired characters from the string

44
Q

In pseudocode, what is the starting position for extracting a Substring?

A

In pseudocode, the Substring starts at position 1 (not 0 as in Python)

45
Q

What are Arithmetic Operators?

A

Arithmetic operators are used to perform basic mathematical operations in programming

46
Q

What is the Addition operator and its pseudocode equivalent (how is it represented in pseudocode)?

A

Addition operator is used to add two numbers and in pseudocode it is written as +

47
Q

What is the Subtraction operator and its pseudocode equivalent?

A

Subtraction operator is used to subtract one number from another and in pseudocode, it is written as -

48
Q

What is the Multiplication operator and its pseudocode equivalent?

A

Multiplication operator is used to multiply two numbers and in pseudocode, it is written as *

49
Q

What is the Division operator and its pseudocode equivalent?

A

Division operator is used to divide one number by another and in pseudocode, it is written as /

50
Q

What is the Modulus operator and its pseudocode and python equivalent (how is it represented in pseudocode and python)?

A

Modulus operator returns the remainder after division. In Python, it is written as %. In pseudocode, it is written as MOD

51
Q

What is the Quotient operator and its pseudocode and python equivalent?

A

Quotient operator returns the whole number result of division. In Python, it is written as //. In pseudocode, it is written as DIV

52
Q

What is Exponentiation, and its pseudocode equivalent?

A

Exponentiation makes a number to the power of another number. In Python, it is written as **. In pseudocode, it is written as ^

53
Q

What are Logical Operators?

A

Used to combine conditions and check if they are true or false. They help control how a program runs based on different conditions

54
Q

What is the Equal to operator and its pseudocode equivalent?

A

The Equal to operator checks if two values are the same and in pseudocode, it is written as ==.

55
Q

What is the Not equal to operator and its pseudocode equivalent?

A

The Not equal to operator checks if two values are different and in pseudocode, it is written as <>

56
Q

What is the Less than operator and its pseudocode equivalent?

A

The Less than operator checks if one value is smaller than another and in pseudocode, it is written as <

57
Q

What is the Less than or equal to operator and its pseudocode equivalent?

A

The Less than or equal to operator checks if one value is smaller than or equal to another and in pseudocode, it is written as <=

58
Q

What is the Greater than operator and its pseudocode equivalent?

A

The Greater than operator checks if one value is larger than another and in pseudocode, it is written as >

59
Q

What is the Greater than or equal to operator and its pseudocode equivalent?

A

The Greater than or equal to operator checks if one value is larger than or equal to another and in pseudocode, it is written as >=

60
Q
A