CPIT

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

1/133

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.

134 Terms

1
New cards

A computer

Includes hardware and software, stores and process data

2
New cards

Hardware

The physical elements of the computer. Eg: Monitor, Speaker, Mouse, RAM, computer case

3
New cards

Software

Invisible instructions that control hardware. Eg: Word & Powerpoint

4
New cards

Bus

Subsystem that interconnects the computer components, found inside of the motherboard

5
New cards

Bus

knowt flashcard image
6
New cards

Output devices

Sends data from a computer to another device or user, (audio video text graphics) Eg: Monitor (which displays text and graphics), speakers, printers.

7
New cards

Resolution and dot pitch

Determines the quality of the display

8
New cards

Input devices

Send data to a computer, Eg: keyboard and mice

9
New cards

CPU (central processing unit)

Brain of the computer, retrieves instructions from memory.

10
New cards

CPU speed

MHz=1 million pulses per second

11
New cards

Memory

  • stores data and program instructions

  • Saves ordered sequences of bytes (each byte=8bits)

  • Volatile, lost once power is off

  • Lost whenever new info replaces the old info

12
New cards

Storage devices

Permanently stored & nonvolatile Eg: Disk drives (hard & floppy), CD drives (CD-R, CD-RW) and tape drives (magnetic tape)

13
New cards

Programs

Software that has instructions for the computer. Are written using programming languages

14
New cards

Machine languages

Primitive instructions, binary code, difficult to read and modify by user. Native language. Eg: 10100110

15
New cards

Assembly language

Difficult to understand by the computer, needs an assembler to change (convert) the assembly code to machine code. Eg: ADD 2, 3, result

16
New cards

High level languages

Easy to understand, english-like. Needs an interpreter or compiler to convert this language to machine code. Eg: Area=5×5×3.1415

17
New cards

High level language examples

Python, C++, C#, Java, COBOL, Visual basic, Ada, Pascal

18
New cards

Statement

Instructions in high-level language

19
New cards

Source code/ program

A program in high-level language

20
New cards

Interpreter/compiler

Translates the high-level code to machine code

21
New cards

Interpreter

Reads one statement and then changes it to machine code (one by one)

22
New cards

Compiler

Translates the entire source code to machine code (all together)

23
New cards

Operating system (OS)

Program that manages and controls computer activities eg: windows 10, linux, macOS

24
New cards

Application program

Cannot run without an operating system. Eg: internet browser, word

25
New cards

General purpose

High level language used in google search, nasa projects, python is interpreted and needs an interpreter

26
New cards

Interpreted

Interpreted one statement at a time

27
New cards

Object oriented

Objects created by classes

28
New cards

Reuse-able software

It relies on the object oriented software, making it easier to use the code in more than one place.

29
New cards

Class

A type that defines the objects pf the same kind with properties and methods

30
New cards

open source program

Software released under a license that the copyright holder gives the rights to change, or study and then distribute to anyone. Eg: two types of python interpreters

31
New cards

Interactive mode

A quick way of running python code, used in python shell.

> > > means shell is ready to use

Results are returned directly after enter. Cannot be edited

32
New cards

Code tracing

Interprets the results of each code line, and keeps track of the effect of each code statement.

33
New cards

Statement

Action or sequence of actions. Eg: print(“Welcome to python”)

34
New cards

Programming style

Easy to read and understand. Python is case sensitive

35
New cards

Documentation

Body of explanatory remarks and comments

36
New cards

Comment

A programmer readable explanation that is ignored by the interpreter. Starts with #

37
New cards
38
New cards

Script mode

Script mode (normal mode) is written in a text file with the extension .py. Result is returned as a full file after being created and saved. Can be edited

39
New cards

Python

General purpose, interpreted, object oriented

40
New cards

Overflow error

Variable with too large of a value

41
New cards

Underflow error

Variable with too small of a value

42
New cards

String + string

Concatenation of strings

43
New cards

Number + number

Sum of numbers

44
New cards

String + number

Error (type error)

45
New cards

Syntax error

Error in code construction

46
New cards

Mistyped statement (Syntax)

Y=4

X=

Print(x)

47
New cards

Incorrect indentation (syntax)

Print(“hello”)

X=3

Print(x)

48
New cards

Incorrect parenthesis (syntax)

print(3+5

print(“hello”)

49
New cards

Punctuation (syntax)

print(“Hello).

50
New cards

Runtime error

Causes the program to terminate abnormally (abort) and detected by the interpreter

51
New cards

Input mistake (runtime)

Divided by zero:

x=0

print(10/x)

Entering a string value whilst the expected result is numbers:

area=input (“Enter area”)

A variable with an unidentified value:

x=4

print(y+x)

Calculation with non numeric values:

x=‘4’

y=3

print(x+y)

52
New cards

Logic error

Causes incorrect output (or unexpected results)

53
New cards

Direct value assignment

x=3

54
New cards

Assigning a value from an expression result

x=4+6

or

y=4

x=y+6

55
New cards

Assigning a value taken from the user through the keyboard

x=input(“enter the value”)

56
New cards

assign one value to multiple variables

a=b=k=3

57
New cards

assign multiple values to multiple variables in one line

a,b,c=4,3.5,”ahmed”

or a,b,c=input(“enter three variables”

58
New cards

Swap values between two variables

x=3

y=5

x,y=y,x

59
New cards

string

anything between ‘’

60
New cards

integer numbers (int)

whole numbers

61
New cards

Float numbers (float)

fractions

62
New cards

boolean

True/False

63
New cards

Operators precedence

knowt flashcard image
64
New cards

import time time.time()

returns number of milliseconds since 1970

65
New cards

import math

returns math module functions

66
New cards

Current time

knowt flashcard image
67
New cards

eval()

Converts a value to its original type

68
New cards

input()

Reads the value from the user via the keyboard

69
New cards

print()

Prints a value

70
New cards

int()

Converts a value to an integer

71
New cards

str()

converts a value into a string

72
New cards

bool()

converts a value into true(1) or false(0)

73
New cards

abs(x)

Returns absolute value

74
New cards

max(x1,x2,x3)

returns the largest value

75
New cards

min(x1,x2,x3)

returns the smallest value

76
New cards

pow(x,y)

x to the power of y

77
New cards

round(x)

rounds to the nearest whole number (integer result)

78
New cards

round(x,y)

rounds to a specific number of decimal places (float result)

79
New cards

math.pi

returns pi (3.14159)

80
New cards

math.e

returns value of 2.71828 (eulers number)

81
New cards

fabs(x)

returns absolute value in decimal/float form

82
New cards

ceil(x)

rounds up to the nearest integer

83
New cards

floor(x)

rounds x to the smallest integer

84
New cards

exp(x)

returns e to the power of x

85
New cards

log(x)

log(number) using base e

86
New cards

log(x,base)

Log x by base of base

87
New cards

sqrt(x)

square root of x

88
New cards

sin(x)

sin of x

89
New cards

asin(x)

sin-1 of x

90
New cards

cos(x)

cos of x

91
New cards

acos(x)

cos-1 of x

92
New cards

tan(x)

tan of x

93
New cards

degrees(x)

converts radians to degrees

94
New cards

radians(x)

converts degrees to radians

95
New cards

importance of degrees/radians functions

sin/cos/tan functions work in radians, so you have to convert them to degrees

96
New cards

bool(x)

converts number (integer) into true or false (boolean)

97
New cards

int(bool(x)) or int(boolean)

converts boolean into integer

98
New cards

Float division

one / with decimal placements

99
New cards

Integer division

two // no decimal placements

in the situation that one of the numbers has decimals the result will always be x.0 (eg 2.2//1 will be 1.0)

100
New cards

modulus or remainder

%

if first number is smaller than second number, the output will be the first number. If not, regular output.