Docsity

Introduction to Programming: Basic Computer Science Concepts, Quizzes of Electrical and Electronics Engineering

Partial preview of the text

Download Introduction to Programming: Basic Computer Science Concepts and more Quizzes Electrical and Electronics Engineering in PDF only on Docsity!

what is software?

The code we write.

TERM 2

What is a programmer?

DEFINITION 2

someone who writes software

TERM 3

what is

hardware?

DEFINITION 3

the physical components such as cpu, ram, input and output

devices

TERM 4

What is the main memory?

DEFINITION 4

Ram, it is the work area where all programs are stored

TERM 5

What is the CPU and what does it

do?

DEFINITION 5

The Central Processing Unit, controls the computer

What are low level programming languages?

Binary, machine language

TERM 7

What are high level programming languages?

DEFINITION 7

C++, Java, Python

TERM 8

What is the process to take source code and

create an executable?

DEFINITION 8

compile the program and then turn into an object file, then

the file uses a linker which combines the objective file to

make the C++ library usable and thus create an executable

file.

TERM 9

What are the 4 steps in the problem solving

process?

DEFINITION 9

Understand the problemdesign solutionimplement

solutiontest solution

TERM 10

What is a variable?

DEFINITION 10

name location of memory

What is the cin object?

gets input from keyboard

TERM 17

what makes extraction (>>) stop?

DEFINITION 17

a semi colon ( ; )

TERM 18

How is math done in C++? ( integer, double,

and a combination)

DEFINITION 18

-if both are integers then the answer is an integer (7/2=3)-if

both are doubles the the answer will be a double

(7.0/2.0=3.5)-if one there is a combination then the answer

will be a double (7.0/2=3.5)

TERM 19

How do you convert a variable in one data

type into another data type?

DEFINITION 19

1) cast the variableor2) when the operator works with

different data types, the lower-ranking value is upgraded to

the higher-level

TERM 20

How do you ignore parts of input?

DEFINITION 20

cin.ignore()

What is the main selection statement?

if()

TERM 22

What is the && operator and how does it

work?

DEFINITION 22

essentially means AND. Basically in selection statements

there and be more than one condition.

TERM 23

What is the || operator and how does it work?

DEFINITION 23

essentially means OR.

TERM 24

what is the alternative selection statement?

DEFINITION 24

switch. basically the ELSE

TERM 25

How many lines of code does an if control by

default?

DEFINITION 25

one line

What is the difference between a pre and

post test loop?

-pre will check to make sure that the conditions to run the

test are met-post will run after every cycle of the loop to see

if the conditions are met for the loop to run again

TERM 32

what is a function declaration and what are

the 3 parts?

DEFINITION 32

- A function declaration creates the function-3 parts -function

type or return type (void, int, string, double, ext) - function

name (follow stadard c++ naming conventions) - function

parameters (the parentheses after the function name

TERM 33

what is a function definition and what are the

4 parts?

DEFINITION 33

-a function definition defines what the function will do-4 parts

-function type (or return type) -function name -function

parameters -function body

TERM 34

how do you pass data into a function?

DEFINITION 34

int(x), pass by copy ( with a parameter)

TERM 35

what is the default passing mechanism for

most datatypes in c++?

DEFINITION 35

pass by value, the argument's value is copied into the

function's parameter

How can you return 1 piece of data out of a

function?

use a return and a variable nameoruse a struct which is

composed of several data types that is only considered one

TERM 37

what is the mechanism used when a function

needs to modify a parameter?

DEFINITION 37

pass by reference, where you add an amperstamp & aster

the type

TERM 38

what 2 questions can you ask to help you

determine if you need to use pass by

reference?

DEFINITION 38

-does the function modify the parameter-does calling the

function know the parameter is modified

TERM 39

what is a variable's scope?

DEFINITION 39

a scope is a region of the program and broadly speaking

there are 3 places where variables can be declared;-inside a

function or a block which is called local variables-in the

definition of function parameters which is called formal

parameters-outside of all functions which is called global

variables

TERM 40

why are global variables evil?

DEFINITION 40

they tend to be confusing, they beak passing mechanisms

that c++ has like passing by values. causes weird side

effects

what is the & operator? or, what does the &

operator return?

it's an address operator (&) that returns the memory address

of a variable

TERM 47

what is a pointer?

DEFINITION 47

a pointer variable is designed to hold memory addresses.-

side note: with pointer variables you can indirectly

manipulate data stored in other variables

TERM 48

what are 2 ways a pointer gets its address?

DEFINITION 48

1) can use amperstand2)can use the new keyword

TERM 49

how do you declare a

pointer?

DEFINITION 49

data type, , name (intx, so x out be a pointer to an int)

TERM 50

when you dynamically allocate memory to a

pointer, where does it get its memory?

DEFINITION 50

get's it from the heap or "system store". data dynamically

allocated comes from heap or system store

what key word will dynamically allocate

memory to a pointer?

the key word new

TERM 52

what key word will release memory for a

pointer?

DEFINITION 52

keyword delete

TERM 53

how do you dynamically allocate memory for

an array?

DEFINITION 53

use int*x= new x [number<- how many you have] stick on

brackets

TERM 54

what is a struct?

DEFINITION 54

a way to organize data

TERM 55

how do you access the fields in a struct?

DEFINITION 55

period ( dot notation)

what is a

getter?

a function that gets the value of an attribute in a class

TERM 62

how are a class and a struct the same?

DEFINITION 62

they both organize data in a wrapper

TERM 63

how do a class and a struct differ?

DEFINITION 63

- class by default is private vs struct which is by

default public

TERM 64

what are include guards?

DEFINITION 64

makes sure that a class isn't defined multiple timmes

TERM 65

what is an exception?

DEFINITION 65

provides a way to react to exceptional circumstances in

programs by transferring control to special functions called

handlers