CPSC 1010 Exam 1 Graded A+
101001110000 (base 2) = ? (base 16) - ANSWER-A70
101111011000111010 (base 2) = ? (base 8) - ANSWER-573072
11001 (base 2) = ? (base 10) - ANSWER-25
113(base 10) = ? (base 2) - ANSWER-1110001
202 (base 10) = ? (base 16) - ANSWER-CA
After compiling a program but before it can be executed, this is the step that links or
adds to the object code any other code being included from the program which then
produces the executable program. - ANSWER-Linker
Declare an array of 5 integers called array1 and initialize the array with the values 1-5. -
ANSWER-Int array1[] = {1, 2, 3, 4, 5};
Evaluate the following expression:
!( 1 && !(0 || 1))
a. true
b. false - ANSWER-true
How long has C been around? - ANSWER-45 years
1969 - 1973
How many characters are in this array?
char word1[] = {"CS for all"}; - ANSWER-11 because there is a null character at the end
How many characters are in this array?
char word2[] =
{'a', 'l', 'l', ' ', 'i', 'n'}; - ANSWER-6 characters - no null character because it is not an
array, its a string
int a = 100, b = 2, c = 25, d = 3, e = 1;
int result;
printf ("%d", b++); - ANSWER-2
, int a = 25, b = 0;
if (a == b)
printf ("Values of both variables are equal \n");
else
printf ("Values of both variables are different \n"); - ANSWER-Values of both variables
are different
Is this a valid array declaration?
int array2[] = {1, 2, 3, 4, 5}; - ANSWER-Yes because it defines what is in the array,
doesn't need a size.
The first sub-step when compiling where certain "administrative" things are taken care
of before compiling takes place (example #define or #include). (.i file) - ANSWER-Pre-
Processors
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). - ANSWER-
Assembler
These are language-specific omissions/errors (missing a semi-colon where one is
required). - ANSWER-Syntax errors
These are logical errors, e.g. using a variable that hasn't been declared yet. - ANSWER-
Semantic errors
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 - ANSWER-Assembly
Language
These are the (low-level) types of instructions that the computer (processor)
understands. They are not human readable; they are machine dependent - only works
on the machine that it is developed for (not portable). - ANSWER-Machine Language
This is a collection of instructions that perform some purpose, solves a specific problem
- ANSWER-Program
This is the process of analyzing & translating the program from the C program language
to a form the computer can understand (machine language); creates an executable -
ANSWER-Compilation
This person was the one who had the idea that programs could be written in more
English-like statements than assembly and machine language; also created the first
compiler - ANSWER-Grace Murray Hopper
101001110000 (base 2) = ? (base 16) - ANSWER-A70
101111011000111010 (base 2) = ? (base 8) - ANSWER-573072
11001 (base 2) = ? (base 10) - ANSWER-25
113(base 10) = ? (base 2) - ANSWER-1110001
202 (base 10) = ? (base 16) - ANSWER-CA
After compiling a program but before it can be executed, this is the step that links or
adds to the object code any other code being included from the program which then
produces the executable program. - ANSWER-Linker
Declare an array of 5 integers called array1 and initialize the array with the values 1-5. -
ANSWER-Int array1[] = {1, 2, 3, 4, 5};
Evaluate the following expression:
!( 1 && !(0 || 1))
a. true
b. false - ANSWER-true
How long has C been around? - ANSWER-45 years
1969 - 1973
How many characters are in this array?
char word1[] = {"CS for all"}; - ANSWER-11 because there is a null character at the end
How many characters are in this array?
char word2[] =
{'a', 'l', 'l', ' ', 'i', 'n'}; - ANSWER-6 characters - no null character because it is not an
array, its a string
int a = 100, b = 2, c = 25, d = 3, e = 1;
int result;
printf ("%d", b++); - ANSWER-2
, int a = 25, b = 0;
if (a == b)
printf ("Values of both variables are equal \n");
else
printf ("Values of both variables are different \n"); - ANSWER-Values of both variables
are different
Is this a valid array declaration?
int array2[] = {1, 2, 3, 4, 5}; - ANSWER-Yes because it defines what is in the array,
doesn't need a size.
The first sub-step when compiling where certain "administrative" things are taken care
of before compiling takes place (example #define or #include). (.i file) - ANSWER-Pre-
Processors
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). - ANSWER-
Assembler
These are language-specific omissions/errors (missing a semi-colon where one is
required). - ANSWER-Syntax errors
These are logical errors, e.g. using a variable that hasn't been declared yet. - ANSWER-
Semantic errors
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 - ANSWER-Assembly
Language
These are the (low-level) types of instructions that the computer (processor)
understands. They are not human readable; they are machine dependent - only works
on the machine that it is developed for (not portable). - ANSWER-Machine Language
This is a collection of instructions that perform some purpose, solves a specific problem
- ANSWER-Program
This is the process of analyzing & translating the program from the C program language
to a form the computer can understand (machine language); creates an executable -
ANSWER-Compilation
This person was the one who had the idea that programs could be written in more
English-like statements than assembly and machine language; also created the first
compiler - ANSWER-Grace Murray Hopper