computer science I midterm

0.0(0)
studied byStudied by 3 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/120

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.

121 Terms

1
New cards

program

set of instructions that a computer follows to perform a certain task

2
New cards

CPU

part of the computer that runs the program; fetches instructions and produces some result

3
New cards

parts of the CPU

control unit and ALU

4
New cards

ALU (arithmetic and logic unit)

perform math operations

5
New cards

control unit

retieves and decodes program instructions and coordinates computer operations

6
New cards

three parts of a program

input, processing, output

7
New cards

main memory

holds both instructions and data

8
New cards

secondary storage

type of memory that can hold data for long periods of time

9
New cards

three things that make the program run

preprocessor, compiler, linker

10
New cards

volatile memory

temporary (ex. RAM)

11
New cards

low-level language

resembles numeric language of the computer

12
New cards

high-level language

close to human-readibility

13
New cards

algorithim

a set of well-defined steps for performing a task or solving a problem

14
New cards

operating system software

program that manage the computer software and runs on the compute

15
New cards

computer

programmable machine designed to follow instructions

16
New cards

main components of hardware

CPU, main memory (RAM), secondary storage devices, input devices, output devices

17
New cards

smallest to biggest piece of memory

bit, byte, word

18
New cards

application software

programs that provide services to the user

19
New cards

common elements in programming

key words, programmer-defined identifiers, operators, punctuation, syntax

20
New cards

variable

named location in computer memory

21
New cards

structured programming

-divide problem into smaller subproblems

-implementing a structured design

22
New cards

object-oriented programming

-specify relevat data and possible operations to be performed on that data

-each object consists of data and operations on that data

-combines data and operations into a single unit

23
New cards

namespace

organizes the names of program entities

24
New cards

cout

console output

25
New cards

vaiables provide interface to where?

RAM

26
New cards

literal

piece of data written directly into a program’s code (characters, strings, numbers, anything not a key word)

27
New cards

identifier rules

  • made up of letters, numbers, and _

  • must start with alphabet character or _ character

28
New cards

c++ variable types

bool, char, int, float, double

29
New cards

c++ integer data types

short, int, long

30
New cards

c++ floating-point data types

float, double, long double

31
New cards

unsigned

program never needs negative numbers

32
New cards

decimal

base 10

33
New cards

hexadecimal

base 16; place a 0x before it

34
New cards

octal

base 8; place a 0 before it

35
New cards

notation for floating-point values

E notation or fixed point (decimal) notation

36
New cards

data types for floating-point numbers

float, double, long double

37
New cards

true number value

one

38
New cards

false number value

zero

39
New cards

variables’ scope

part of the program that has access to the bariable

40
New cards

three types of operators

unary, binary, ternary

41
New cards

#include

inserts the contents of another file into the program

42
New cards

L

store an integer in a long memory location

43
New cards

\0

null terminator at the end of every string

44
New cards

sizeof()

gives the size of number of bytes

45
New cards

floating-point divided by any number equals

a floating point

46
New cards

file that must be included to use cout

iostream

47
New cards

comments

notes of eplanation that document lines or sections of a program

48
New cards

«

feeds the data into the cout

49
New cards

»

feeds user input to variable

50
New cards

pow(double x,y)

exponent function

51
New cards

type coercian

conversion of the operands of the same type (promoted vs. demoted)

52
New cards

hierchary of data types

  1. long double

  2. double

  3. float

  4. unsigned long

  5. long

  6. unsigned int

  7. int

  8. unsigned short

  9. short

  10. char

53
New cards

static_cast<dataType>

how to change the type

54
New cards

setw()

prints spaces

55
New cards

setprecision()

sets numbe of sig digs you want

56
New cards

cin.ignore()

ignores the newline character (null terminator) after previous entered variable

57
New cards

array

group of memory cells

58
New cards

order of operations

  1. negatives

  2. multiplication, divison, modules

  3. addition, subtraction

59
New cards

char, short, and unsigned short are promoted to

int

60
New cards

the ___ variable gets converted to the one on the _____

right; left

61
New cards

#define

do not occupy memory location; works as a text substitution

62
New cards

iomanip

header file for controlling how output is displayed

63
New cards

c-string

stores characters in an array

64
New cards

strcpy()

how to assign a value to c-string later

65
New cards

srand()

initializes random number generator with unsigned int “seed”

66
New cards

flag

a variable that signals a condition

67
New cards

logical precedence

! && ||

68
New cards

operators precedence

arithmetic relational logical

69
New cards

variables defined inside curly brackets

local or block scope

70
New cards

expr1 ? expr2 : expr3;

2 if 1 is true; 3 if 1 is false

71
New cards

short circuit

72
New cards

when to use prefix mode?

when you want the increment to occur first

73
New cards

do-while loops perform at least ____ iteration before checking the condition

one

74
New cards

toupper()

changes it to uppercase

75
New cards

break

terminates execution of the loop

76
New cards

continue

causes the code to skip this interation and go to the next one

77
New cards

sentinel

indicates end of loop

78
New cards

ifstream infile

input

79
New cards

ofstream outfile

output

80
New cards

size of an array

number of bytes * number of elements

81
New cards

another way to initialize a variable

variableType value(VALUE)

82
New cards

for(dataType name : array){

}

range-based for loop

83
New cards

how to access data from file

ifstream infile;
infile.open()

if(!infile){}

else { infile _____}

84
New cards

parallel arrays

building relationships between data stored in two or more arrays

85
New cards

array vs. vector

-size not needed
-automatcally adjusts itself
-can initialize a vector in another

86
New cards

how to declare a vector

vector<type> name

87
New cards

pop_back()

removes last element from vector

88
New cards
89
New cards

push_back(value)

adding a value to the vector

90
New cards

pop_back()

removes a value from the vector

91
New cards

function that doesn’t return anything

void

92
New cards

compiler needs to know what about the function?

name, return type, number of parameters, data type of parameters

93
New cards

function prototype

notifies the compiler about a function

94
New cards

prototype formation

returnType nameOfFunction(argument)

95
New cards

static

preserves local variables when function terminates

96
New cards

example of secondary storage device

disk drive

97
New cards

machine language

language that computer really processes

98
New cards

portability

program’s ability to run on several toes of systemsq

99
New cards

punctuation

marks the beginning and end of sentences

100
New cards

input

info from the outside world