python midterm updated

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/115

encourage image

There are no tags or description

Looks like no tags are added yet.

116 Terms

1
New cards

Program

A set of instructions a computer follows to perform a task (also called software).

2
New cards

Programmer

A person who designs, creates and tests computer programs (software developer).

3
New cards

Hardware

The physical devices that make up a computer.

4
New cards

CPU

Central processing unit: the part of the computer that actually runs programs.

5
New cards

Microprocessor

A CPU located on a small chip.

6
New cards

Main memory (RAM)

Where a program and its data are stored while running. Fast, volatile (erased when power is off).

7
New cards

Volatile memory

Temporary storage whose contents are erased when the computer is turned off (e.g., RAM).

8
New cards

Secondary storage

Holds data for long periods; programs are stored here and loaded into RAM when needed.

9
New cards

Types of secondary storage

Disk drive (magnetic), solid state drive (faster, no moving parts), flash memory (portable), optical devices.

10
New cards

Input device

Component that collects data from people or other devices (keyboard, mouse, touchscreen, scanner, camera).

11
New cards

Output device

Component that formats and presents data produced by the computer (display, printer).

12
New cards

Application software

Programs that make the computer useful for everyday tasks (word processing, email, games, web browsers).

13
New cards

System software

Programs that control and manage the basic operations of a computer.

14
New cards

Operating system (OS)

System software that controls the operations of the hardware components.

15
New cards

Utility program

System software that performs a specific task to enhance computer operation or safeguard data.

16
New cards

Software development tools

Programs used to create, modify and test software.

17
New cards

Bit

Smallest unit of data; an on/off switch holding 0 or 1.

18
New cards

Byte

8 bits; enough memory to store one letter or a small number.

19
New cards

Range of one byte

0 (00000000) to 255 (11111111).

20
New cards

ASCII

American Standard Code for Information Interchange; numeric codes for 128 characters.

21
New cards

Unicode

Newer character coding standard; compatible with ASCII and covers other languages.

22
New cards

Two's complement

Scheme computers use to encode negative numbers.

23
New cards

Floating-point notation

Scheme computers use to encode real numbers.

24
New cards

Digital

Describes any device that stores data as binary numbers.

25
New cards

Pixel

Digital images are made of these; each is stored as a binary number for its color.

26
New cards

Sample

Digital music is made of these sections; each is stored as a binary number.

27
New cards

Machine language

Binary instructions the CPU understands, from its instruction set (differs by CPU brand).

28
New cards

Fetch-decode-execute cycle

Fetch: read next instruction from memory. Decode: determine the operation. Execute: perform it.

29
New cards

Assembly language

Low-level language using short mnemonics (e.g., MOV AX, BX) instead of binary.

30
New cards

Assembler

Program that translates assembly language into machine language.

31
New cards

High-level language

Language that makes it easy to create powerful programs without knowing how the CPU works.

32
New cards

Key words

Predefined words with specific meaning used to write programs in a high-level language.

33
New cards

Operator

Symbol that performs an operation on data (e.g., +, *, /).

34
New cards

Syntax

The set of rules to follow when writing a program.

35
New cards

Statement

An individual instruction in a high-level language.

36
New cards

Compiler

Translates a whole high-level program into a separate machine language program that can be run any time.

37
New cards

Interpreter

Translates and executes high-level instructions one at a time; no separate program. Python uses one.

38
New cards

Source code

The statements written by the programmer.

39
New cards

Syntax error

An error that prevents code from being translated.

40
New cards

Number system

Defined by the allowed symbols (digits), the base (radix), and how place values are calculated.

41
New cards

Binary

Base 2; digits 0, 1.

42
New cards

Octal

Base 8; digits 0-7.

43
New cards

Decimal

Base 10; digits 0-9.

44
New cards

Hexadecimal

Base 16; digits 0-9 and A-F.

45
New cards

Hex digit values

A=10, B=11, C=12, D=13, E=14, F=15.

46
New cards

Positional value formula

Digit x Base^position (position counted from 0 on the right).

47
New cards

Convert 1011 (binary) to decimal

1x8 + 0x4 + 1x2 + 1x1 = 11.

48
New cards

Convert 725 (octal) to decimal

7x64 + 2x8 + 5x1 = 469.

49
New cards

Convert 2F (hex) to decimal

2x16 + 15x1 = 47.

50
New cards

Method: decimal to binary

Repeatedly divide by 2; read the remainders from bottom to top.

51
New cards

Method: decimal to octal

Repeatedly divide by 8; read the remainders from bottom to top.

52
New cards

Method: decimal to hex

Repeatedly divide by 16; read remainders (10-15 as A-F) from bottom to top.

53
New cards

Convert 13 (decimal) to binary

1101.

54
New cards

Convert 83 (decimal) to octal

123.

55
New cards

Convert 250 (decimal) to hex

FA.

56
New cards

Binary to octal

Group bits in 3s from the right; convert each group. 110101 = 65 (octal).

57
New cards

Binary to hex

Group bits in 4s from the right; convert each group. 11101101 = ED.

58
New cards

Octal to binary

Replace each octal digit with 3 bits. 57 (octal) = 101111.

59
New cards

Hex to binary

Replace each hex digit with 4 bits. A3 = 10100011.

60
New cards

Where Python uses each base

Binary internally; hex for memory, colors and bitwise operations; decimal for user interaction.

61
New cards

Why 8 bits in a byte

2^8 = 256 values (0-255), enough for letters, digits and special characters.

62
New cards

Binary 01000001 as a character

Decimal 65, which is 'A' in ASCII (1 byte).

63
New cards

Bit vs byte analogy

Bit = a light switch (on/off). Byte = a group of 8 switches working together.

64
New cards

Convert 1101 (binary) to decimal

8 + 4 + 0 + 1 = 13.

65
New cards

Convert 11010 (binary) to decimal

16 + 8 + 0 + 2 + 0 = 26.

66
New cards

Four types of operations

Arithmetic, comparison (relational), logical, and Boolean (true/false).

67
New cards

Arithmetic operators

  • addition, - subtraction, * multiplication, / division, % modulus (remainder).
68
New cards

Modulus operator (%)

Returns the remainder of a division. 7 % 2 = 1; used to test odd/even.

69
New cards

Comparison operators

==, !=, >,

70
New cards

== vs =

== compares two values; = assigns a value.

71
New cards

Logical operators

AND (both true), OR (at least one true), NOT (flips the value). Python spells them and, or, not.

72
New cards

Boolean data type

Stores True (1/ON) or False (0/OFF); used to control program flow.

73
New cards

Operator priority (highest to lowest)

Parentheses, multiplication/division, addition/subtraction, comparisons, NOT, AND, OR.

74
New cards

5 - 3 * 4 + 2

-5 (multiply first: 5 - 12 + 2).

75
New cards

4 + 2 * 3 * 2 - 4

12.

76
New cards

5 - 3 - 4 + 2 * 2

2.

77
New cards

not ((10 - 2*3) < 5)

False (4 < 5 is True; NOT flips it).

78
New cards

AND truth rule

True only when both inputs are True.

79
New cards

OR truth rule

False only when both inputs are False.

80
New cards

Bitwise AND on 110011 and 001100

000000.

81
New cards

Bitwise OR on 110011 and 001100

111111.

82
New cards

Bitwise NOT on 110011

001100 (every bit flipped).

83
New cards

Who created Python and when

Guido van Rossum; released in 1991.

84
New cards

What Python is used for

Web development (server-side), software development, mathematics, system scripting.

85
New cards

Why Python

Cross-platform, simple English-like syntax, fewer lines of code, interpreter allows quick prototyping, supports procedural, object-oriented and functional styles.

86
New cards

Current major Python version

Python 3.

87
New cards

IDE

Integrated Development Environment (e.g., Thonny, PyCharm, NetBeans, Eclipse); helps manage larger collections of files.

88
New cards

How Python marks the end of a command

A new line (no semicolon or parentheses needed).

89
New cards

How Python defines scope

Indentation (whitespace), not curly brackets.

90
New cards

Software development process

Problem definition, requirement analysis (input/output), design (algorithms, flowcharts, pseudocode), coding, testing and debugging, deployment and maintenance.

91
New cards

Algorithm

A step-by-step solution to a problem.

92
New cards

Flowchart

A graphical representation of an algorithm.

93
New cards

Pseudocode

Plain-English, code-like steps for planning logic without the strict rules of a real language.

94
New cards

Flowchart: oval

Start / End.

95
New cards

Flowchart: parallelogram

Input / Output.

96
New cards

Flowchart: rectangle

Process.

97
New cards

Flowchart: diamond

Decision.

98
New cards

Flowchart: arrows

Flow of control.

99
New cards

Simple interest formula

I = (P x R x N) / 100; P = principal, R = rate, N = years, I = simple interest.

100
New cards

print()

Built-in function that displays text or values on the screen.