Exam 1 Topics Flashcards

1
Q

What is a computer

A

An electronic device capable of performing commands (input, output, storage, arithmetic and logic operations)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the definition of hardware

A

The physical components of a computer and its surrounding (peripheral) devices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the basic components of a computer’s hardware?

A

CPU and main memory, secondary storage, and input and output devices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the definition of software

A

programs; sets of instructions to be executed by a computer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the type of software designed to control the computer?

A

system software

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a operating system?

A

a set of programs that control overall computer activity and provide services (Linux, Windows)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an application (type of software)

A

it is a program designed to perform specific tasks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is emacs?

A

a program used to create and modify text based files (editor)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

List the three categories of programming languages

A

machine language, assembly language, and high-level language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Define machine language (programming language)

A

machine language is instructions made up of sequences of 0s and 1s. It is the only language directly understood and executed by the computer and is machine dependent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Define assembly language (programming language)

A

assembly language is instructions made up of mnemonic codes. It must be translated into machine language be a program called a assembler and is machine dependant.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Define high-level language and name some examples (programming language)

A

high-level language is instructions that are closer to natural language which makes use of familiar words and symbols. It is machine independent. Some examples include BASIC, FORTRAN, Pascal, Java, C, C++.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Explain what a compiler is and name the one that we use in CS 135

A

a program that translates instruction written in a high-level language into the equivalent machine code (g++)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Name the Linux distro we use in CS 135

A

Linux (CentOS 6)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does “ls” do? (Linux command)

A

the list command displays an alphabetical list of all the files and directories in your current directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does “cat” do? (Linux command)

A

the concatenate command allows a user to display the entire content of a text file to the screen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does “more” do? What are the controls? (Linux command)

A

the more command allows the user to display the content of a file one screen (or page) at a time (similar to cat command) - press space bar to display the next page, q to quit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does “lpr” do? (Linux command)

A

the line print command is used to send a file to a printer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What does “cp” do? (Linux command)

A

the copy command is used to copy the content of one file to another file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What does “man” do? (Linux command)

A

the man command provides the user with access to an online manual for Linux commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the Linux command to compile a program? (Linux command)

A

g++ progfile.cpp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the Linux command to run a complied program?

A

./a.out

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is a source file? What is a source file’s file extension for this course?

A

A source file is the human readable version of a program; the file extension we use is .cpp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is a object file?

A

The object file is what gets compiled, it is “a.out” and is machine readable version of a program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is a program?

A

a sequence of statements whose objective is to accomplish a task

26
Q

What is a programming language?

A

a set of rules, symbols, and special words

27
Q

Define syntax

A

syntax is the grammar rules of a programming language. It describes how legal statements will be written that the compiler will accept.

28
Q

Define semantics

A

semantics is the meaning of the instructions in a programming language. A compiler cannot find these errors; another name for them is “logic errors”

29
Q

What is a C++ program a collection of?

A

A C++ program is a collection of one or more functions

30
Q

What is a function?

A

a function is a collection of statements designed to perform a task

31
Q

What is a library in C++? What are the names of libraries called?

A

A library contains a collection of operations and data types that C++ can refer to. Each library has a name and is called a header file.

32
Q

What does a preprocessor directive do? What is the general syntax for one?

A

Preprocessor directives tell the computer where to find a library.
general syntax:
#include

33
Q

Explain what “std namespace” is and how is the statement declared

A

std namespace is the location where identifiers used in header files are defined.
using namespace std;

34
Q

Define what a comment is and how are comments declared. How is a multi-line comment declared.

A
a comment is a non-executable statment that is included in a program to provide information about what the program does, how it works, what input/output is expected and who wrote the program.
// this is a comment
/* this is multi-line comment*/
35
Q

Define what a string literal is.

A

a string literal is a series of 0 or more characters enclosed in quotation marks “”

36
Q

What is “cout”?

A

cout is the variable that represents the default output device (command line feed)

37
Q

What is the insertion operator used for? How is it declared?

A

insertion operator is used to perform an output operation

“<

38
Q

What is “endl”?

A

endl is a named constant that represents the linefeed character (‘/n’) and should be used when you wish to terminate the current line of output.

39
Q

What is a reserved word?

A

a reserved word is a word that can only be used for a specific purpose in a programming language

40
Q

List the reserved words used in CS 135

A

and, bool, break, case, char, const, default, double, else, false, float, for, if, int, namespace, not, or, return, struct, switch, true, using, void, while

41
Q

What is a identifier? What are the rules for choosing a legal identifier name?

A

An identifier is a name associated with a function or data object used to refer to that function or data object. The 1st character must be a letter or a underscore, remaining characters must be letter, digits, or underscores, reserved words cannot be used as identifier names. C++ is case sensitive.

42
Q

What is a data type?

A

a data type is a set of values along with the set of operations that can be performed using those values. C++ has built in data types.

43
Q

What is a literal value?

A

it is a fixed value that can be stored in the computer

44
Q

Name the built-in numeric data types that are included in C++

A

numeric data types include int, float, double, short, long, long double, signed, unsigned. These are reserved words.

45
Q

Name the two floating-point number data types in C++, what makes them special and how they are different from each other.

A

The two floating-point types are “float” and “double”. They can include decimals. double is stored with more precision than floats

46
Q

What are the floating point arithmetic operators?

A
  • multiply / divide

+ add - subtract

47
Q

What are the rules for using floating point arithmetic operators?

A

Default order of operation. Results of a arithmetic expression involving 2 floats will be a float.

48
Q

Name the reserved word for integer data type and what a integer is.

A

“int” is the reserved word used in this course for integers, they cannot contain a decimal place.

49
Q

What are the int arithmetic operators?

A
  • multiply /divide
    + add - subtract
    % modulus
50
Q

What are the rules for using int arithmetic operators?

A

Default order of operations. Results of a arithmetic expression involving 2 ints will always be int

51
Q

Define what a variable is. What is the syntax for declaring a variable.

A

A variable is the name and a data type of a memory location. It’s content can be changed during program execution. Must be declared before used.
declaration:
datatype identifier;

52
Q

What is the semantics for a variable declaration?

A

allocate a memory location of a specified data type with a specified name. No value is stored (unless specified) in the location so whatever was in that location prior to allocation remains.

53
Q

What is a assignment statement? What is the assignment operator? What is the syntax for an assignment statement?

A

it is a statement used to store a value in a variable (name of memory location). “=” is the assignment operator.

variable = expression;

54
Q

Define algorithm

A

a algorithm is a step-by-step process for solving a problem in a finite amount of time.

55
Q

Define “constant”

A

a constant is a memory location with a name, a data type, and a value. it cannot be changed once it is declared. Placed before main function

56
Q

Hand write the syntax for a constant delcaration

A

const datatype identifier = value;

57
Q

For type coercion, what is the type hierarchy when data types are mixed in arithmetic expressions?

A

double then float then int

58
Q

What happens when data types are mixed in a expression?

A

the lower type is coerced (implicitly forced) to its equivalent value in the higher type for the purpose of performing a given operation.

59
Q

What is “type coercion”?

A

implicit (automatic) type conversion

60
Q

What is “Type casting”

A

explicit (user defined) type conversion