cpsc 1010 exam 1

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

1/538

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.

539 Terms

1
New cards

C is a __________________________________________ programming language (like Ada, BASIC, C++, C#, COBOL, Fortran, Java, Pascal, Perl, Python, Visual Basic).

procedural

2
New cards

When was C developed?

3
New cards
4
New cards

A) late 1950s to early 1960s

5
New cards

B) mid-1960s

6
New cards

C) late 1960s to early 1970s

7
New cards

D) mid 1970s

C

8
New cards

These are the programs that control the entire operation of a computer system (such as I/O, system resources, execution of programs, etc).

operating system

9
New cards

This is the process of analyzing & translating the program from a high-level programming language (such as C) to a form the computer can understand (machine language); creates an executable.

compiling

10
New cards

This is a type of programming language that contains a series of computational steps to be carried out; procedures / routines / functions may be called at any point in the program, including by other functions or itself.

procedural

11
New cards

These are the (low-level) types of instructions that the computer (processor) understands. They are not human readable; they are machine dependent - only worked on the machine that it was developed for (not portable).

machine language

12
New cards

These are the instructions that are defined on a processor. Different processors have different ones of these defined on them (within the circuitry of the processor).

instruction set

13
New cards

These are logical errors, e.g. using a variable that hasn't been declared yet.

semantic

14
New cards

The second sub-step when compiling where the programming language instructions are broken down into assembly language instructions first (.s file) and then converts each assembly language instruction into binary code, or object code (.o file).

assembler

15
New cards

This person from the 1800s is considered to have written the first "computer program". (From the 1800s? How can that be?) There is a computer programming language named after this person.

Ada Lovelace

16
New cards

These are low-level types of instructions that, starting in the early 1950s, allowed the programmer to use a somewhat more English-like way of writing instructions by using abbreviations, or mnemonic codes, to refer to the bit-patterns.

assembly language

17
New cards

This is the basis for many modern operating systems. It was developed at Bell Labs in 1969. One of the driving philosophies of this operating system was that everything consists of small modular units that do one thing well and when combined, can do more powerful things.

Unix

18
New cards

This is the "brains" of the computer that carries out the retrieve, decode, execute, write-back results cycle, which is measured in GHz.

CPU

19
New cards

This is the part of the computer that allows the computer to "think". The items that are currently being processed are held here in this temporary storage, also called main memory. It is measured in GB.

RAM

20
New cards

This refers to the approach or steps taken to solve the problem, to show the logic for the program before you start coding.

algorithm

21
New cards

If the results of compiling your program look like the following:

22
New cards
23
New cards

prog1.c: In function 'main':

24
New cards

prog1.c:14:2: error: expected ';' before 'return'

25
New cards

return 0;

26
New cards

^

27
New cards
28
New cards

The error in your program...

29
New cards
30
New cards

A) must be on line 14

31
New cards

B) could be on line 14 or an earlier line before line 14

32
New cards

C) could be on line 14 or a line after line 14

B

33
New cards

Consider the small program below. It contains several errors that would need to be fixed before it will successfully compile. On which line number is the first error in the program?

34
New cards
35
New cards
1 #include
36
New cards

2

37
New cards

3 int main() {

38
New cards

4 int a = 2 b = 8, c = -3, result;

39
New cards

5 result = 6 + b a * c;

40
New cards

6 printf("result is: %d\n', result)

41
New cards

7

42
New cards

8 result = a - b + c * 5);

43
New cards

9 printf"result is: %d\n", result);

44
New cards

10

45
New cards

11 return 0:

46
New cards

12 }

4

47
New cards

Your C code that you type up in a file for a program, for example prog2.c, is called what type of code?

source code

48
New cards

Let's say you are currently logged in to

49
New cards
50
New cards
/home//Fall23/Classes/CPSC/lecture/
51
New cards
52
New cards

directory and that you have a file in that location called prog.c. You want to change the name of the program from prog.c to prog1.c and only want the one copy of the file (that will be called prog1.c). What Unix/Linux command will allow you to achieve this with just one command?

mv prog.c prog1.c

53
New cards

What is the Unix/Linux command for showing the list of files and directories one directory below where you are currently located?

ls ..

54
New cards

After the following code executes, what would be the value of sum?

55
New cards
56
New cards
#include
57
New cards
58
New cards

int main(void) {

59
New cards

int x = 10, y = 2;

60
New cards

int sum = 0, product = 0, diff = 0, quotient = 0, mod = 0;

61
New cards
62
New cards

sum = x + y;

12

63
New cards

After the following code executes, what would be the value of quotient?

64
New cards
65
New cards
#include
66
New cards
67
New cards

int main(void) {

68
New cards

int x = 10, y = 2;

69
New cards

int sum = 0, product = 0, diff = 0, quotient = 0, mod = 0;

70
New cards
71
New cards

sum = x + y;

72
New cards

quotient = x / y;

5

73
New cards

After the following code executes, what would be the value of diff?

74
New cards
75
New cards
#include
76
New cards
77
New cards

int main(void) {

78
New cards

int x = 10, y = 2;

79
New cards

int sum = 0, product = 0, diff = 0, quotient = 0, mod = 0;

80
New cards
81
New cards

sum = x + y;

82
New cards

quotient = x / y;

83
New cards

diff = x - y;

8

84
New cards

After the following code executes, what would be the value of product?

85
New cards
86
New cards
#include
87
New cards

int main(void) {

88
New cards

int x = 10, y = 2;

89
New cards

int sum = 0, product = 0, diff = 0, quotient = 0, mod = 0;

90
New cards
91
New cards

sum = x + y;

92
New cards

quotient = x / y;

93
New cards

diff = x - y;

94
New cards

product = x * y;

20

95
New cards

After the following code executes, what would be the value of quotient?

96
New cards
97
New cards
#include
98
New cards
99
New cards

int main(void) {

100
New cards

int x = 10, y = 2;