NWC CompSci 1 Test 1

3.7(3)
studied byStudied by 28 people
3.7(3)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/88

flashcard set

Earn XP

Description and Tags

CSC171QR VanBerkum Python

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

89 Terms

1
New cards

Computer

A machine that stores and manipulates information under the control of a changeable program.

2
New cards

Computer Program

A detailed, step-by-step set of instructions telling a computer what to do.

3
New cards

Programming / Coding

The process of creating software.

4
New cards

Algorithm

A step-by-step process for solving a problem or achieving a desired result.

5
New cards

CPU (Central Processing Unit)

The "brain" of the computer; carries out all basic operations on data.

6
New cards

Main Memory (RAM)

Fast, volatile memory that stores programs and data the CPU is currently using.

7
New cards

Secondary Memory

Permanent storage (e.g., hard drive, SSD).

8
New cards

Fetch-Execute Cycle

The process the CPU uses to execute a program

9
New cards

Operating System (OS)

Software that controls the computer's hardware resources and manages program execution.

10
New cards

Kernel

The core part of the OS that is always running.

11
New cards

Machine Language

The low-level language of 1s and 0s that the hardware can directly understand.

12
New cards

Compiler

Translates an entire high-level program into machine language before execution.

13
New cards

Interpreter

Translates and executes a high-level program one instruction at a time.

14
New cards

Specification

A description of what a program will do (inputs, outputs, and their relationship).

15
New cards

Pseudocode

A precise but informal English description of an algorithm.

16
New cards

IPO (Input, Process, Output)

A common program design model.

17
New cards

Test/Debug

The phase where you find and fix errors ("bugs") in the program.

18
New cards

Syntax

The precise form or grammar of a programming language structure.

19
New cards

Semantics

The precise meaning of a programming language structure.

20
New cards

Identifier

A name given to variables, functions, etc.

21
New cards

Reserved Words / Keywords

Words that are part of the Python language itself and cannot be used as identifiers.

22
New cards

Expression

A fragment of code that produces or calculates a new data value.

23
New cards

Literal

A representation of a specific value in code (e.g., 3.9, "Hello").

24
New cards

Statement

A complete line of code that performs an action.

25
New cards

Assignment Statement

=
26
New cards

Simultaneous Assignment

Assigning multiple variables at once (e.g., sum, diff = x+y, x-y).

27
New cards

Data Type

Determines what values a variable can have and what operations can be performed on it.

28
New cards

Integer (int)

A whole number without a fractional part.

29
New cards

Floating-Point (float)

A number that has a decimal fraction.

30
New cards

Type Conversion

Changing a value from one data type to another.

31
New cards

Explicit Typing

When the programmer directly controls the type conversion.

32
New cards

// (Operator)

Integer Division (floor division).

33
New cards

% (Operator)

Modulo (Remainder).

34
New cards

Math Library

A module providing mathematical functions (e.g., math.sqrt()).

35
New cards

String (str)

A sequence of characters. Immutable.

36
New cards

Indexing

Accessing a single character in a string using its position.

37
New cards

Slicing

Accessing a substring from a start index up to, but not including, an end index.

38
New cards

Concatenation

Gluing strings together with the + operator.

39
New cards

Repetition

Repeating a string with the * operator.

40
New cards

List

A sequence of arbitrary elements. Mutable.

41
New cards

Mutable

Can be changed "in place".

42
New cards

Immutable

Cannot be changed after it is created.

43
New cards

.append(x)

Adds an element x to the end of a list.

44
New cards

.extend(list2)

Adds all elements from list2 to the end of a list.

45
New cards

ASCII / Unicode

Standards that define a numeric code for every character.

46
New cards

ord(character)

Returns the numeric (ordinal) code for a single-character string.

47
New cards

chr(number)

Returns the character string for a given numeric Unicode code.

48
New cards

Function

A subprogram; a named sequence of statements that performs a specific operation.

49
New cards

Function Definition

The statement that creates a function (def function_name()

50
New cards

Call / Invoke

Using a function in a program.

51
New cards

Parameter

A variable that is initialized when the function is called.

52
New cards

Formal Parameter

The variable name listed in the function definition.

53
New cards

Actual Parameter / Argument

The actual value passed into the function when it is called.

54
New cards

Return Value

The value that a function sends back using the return statement.

55
New cards

Scope

The part of a program where a variable can be referenced.

56
New cards

Local Variable

A variable defined inside a function.

57
New cards

Global Variable

A variable defined outside of any function.

58
New cards

Pass by Value

The method Python uses for parameters. The function receives a copy of the value.

59
New cards

Stack

A data structure that manages function calls and local variables.

60
New cards

Definite Loop

A loop that executes a predetermined number of times (a for loop).

61
New cards

for Loop

for in

62
New cards

Loop Index

The variable that takes on each successive value in the sequence.

63
New cards

range() function

Generates a sequence of numbers.

64
New cards

Control Structure

A statement that alters the sequential flow of control in a program.

65
New cards

Decision Structures

Statements that allow a program to execute different instructions for different cases.

66
New cards

Condition

A Boolean expression that is either True or False.

67
New cards

Boolean Expression

An expression that produces either True or False.

68
New cards

if Statement (One-Way Decision)

if

69
New cards

if-else Statement (Two-Way Decision)

Provides two mutually exclusive paths of execution.

70
New cards

if-elif-else Statement (Multi-Way Decision)

Handles multiple, mutually exclusive cases.

71
New cards

Nesting

Putting one control structure inside another.

72
New cards

== (Operator)

Equal to (comparison).

73
New cards

Relational Operators

==, !=,

74
New cards

Lexicographic Ordering

The order used for string comparisons, based on Unicode/ASCII values.

75
New cards

Accumulator Algorithm

A pattern where you build up a result in a variable, often inside a loop.

76
New cards

Factorial (n!)

n * (n-1) * (n-2) * … * 1

77
New cards

Local scope

A variable can only be referenced where it was created (Local Use)

78
New cards

Global scope

A variable can be referenced throughout the whole program (Global use, throughout)

79
New cards

Immutability

A variable's value cannot be modified "in-place"

80
New cards

Mutability

A variable's value can be modified "in-place"

81
New cards

What does the following expression evaluate to?

chr(ord('a'))

'a'

82
New cards

Which of the following statements about Strings and Lists are true?

Strings are not mutable and Lists are mutable (Able to be changed in place)

83
New cards

Which of the following are valid boolean expressions? Assume that all variables are valid.

a: x % 3 == 1

b: (x > 5) > y

c: (x != 8) < y

d: False

e: x = 4

d and a. (e assigns value, b&c both sides should be both numeric or both Boolean)

84
New cards

Given the following String, called "phrase", which expression will evaluate to: "123"

phrase = "123 fizzbuzz"

phrase[0:3]

85
New cards

Given the following String, called "phrase", which expression will evaluate to: "buzz"

phrase = "123 fizzbuzz"

phrase[8:]

86
New cards

What will the following expression evaluate to?

[1, 2, 3] + 4

[1, 2, 3, 4]

87
New cards

What will the following expression evaluate to?

[1, 2, 3] * 2

[1, 2, 3, 1, 2, 3]

88
New cards

Which of the following will evaluate to the float value 12.0

Select all that apply.

Correct: 3.0 * 4, float(int(12.9)), 24 / 2.

Incorrect: 3 * 4, round(11.9), 24 // 2

89
New cards

True or False: Computers are more efficient with Floating-point values than with Integers

False