辅导案例-TOPIC 1

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top



Fundamentals of
Computer Systems

Topic Exercises





FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 1

COMPUTER SYSTEM FUNCTIONAL
COMPONENTS, CHARACTERISTICS,
PERFORMANCE, INTERACTIONS
AND USE IN IT


Learning Objectives

At the end of this topic, you should be able to

 Describe the hardware organisation of a typical system
 Explain how information is moved from one place to another
 Describe the various memory levels under the memory hierarchy


Instructions:

As you go through this module, refer to these guiding questions to aid your learning.

 What is Buses?
 What is I/O devices?
 What is Main Memory?
 What is Processor?
 What is Direct Memory Access?
 What is Cache Memories?
 What is the purpose of Static Random Access Memory?
 What are the various levels of a memory hierarchy?
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 1 Exercises

1. Draw a diagram on the hardware (CPU, ALU, PC, USB) organisation of a typical
computer system.
2. Using the diagram, describe how a command is being read from the keyboard.
3. Draw the memory hierarchy.



FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 2

OPERATING SYSTEMS


Learning Objectives

At the end of this topic, you should be able to

 Explain how the operating system manages the hardware


Instructions:

As you go through this module, refer to these guiding questions to aid your learning.

 What are the TWO primary purpose of the operating system?
 What is Process?
 What is Threads?
 What is Virtual Memory?
 What is Files?
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 2 Exercises

1. Draw a diagram to illustrate process context switching.


FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 3

MEMORY AND STORAGE
TECHNOLOGIES


Learning Objectives

At the end of this topic, you should be able to

 Describe the basic storage technologies
 Describe the steps that took place when a CPU reads data from
a disk


Instructions:

As you go through this module, refer to these guiding questions to aid your learning.

 What is RAM?
 What is SRAM?
 What is DRAM?
 What is a Memory Module?
 What is the difference between Volatile Memory and Non-volatile Memory?
 What is the purpose of buses?
 What is the purpose of I/O bridge?
 What is the purpose of Platters within the Disk?
 What technology factors determine the Disk Capacity?
 How does the Disk operate?
 What are I/O devices?
 What are the steps that took place when a CPU reads data from a disk?
 What is a solid state disk?
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 3 Exercises

1. Explain the differences between SRAM and DRAM.
2. Draw an organisation of a 16 x 8 DRAM chip with d=16 supercells, w=8 bits per
supercell, r=4 rows and c=4 columns. Next, draw a memory controller connected
to the DRAM via TWO pins (eight data pins that can transfer 1 byte in or out of
the chip, and two addr pins that carry two-bit row and column supercell
addresses).
3. Explain how the contents of supercell (i,j) is being read.
4. List the steps of a read transaction.
5. List the steps of a write transaction.
6. Estimate the average time (in ms) to access a sector on the following disk:

Rational rate: 12, 000 RPM
Tavg seek: 5ms
Average number of sectors/track: 300

7. Suppose that a 1MB file consisting of 512-byte logical blocks is stored on a disk
drive with the following characteristics:

Rational rate: 13, 000 RPM
Tavg seek: 5ms
Average number of sectors/track: 5000
Surfaces: 4
Sector Size: 512 bytes

For each case below, suppose that a program reads the logical blocks of the
file sequentially, one after the other, and that the time to position the head over
the first block is Tavg seek + Tavg rotation.

A. Best case: Estimate the optimal time (in ms) required to read the file given the
best possible mapping of logical blocks to disk sectors (i.e., sequential).

B. Random case: Estimate the time (in ms) required to read the file if blocks are
mapped randomly to disk sectors.

8. Explain how a disk sector is being read.

FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 4

DIGITAL LOGIC


Learning Objectives

At the end of this topic, you should be able to

 Describe how the output of a combinatorial circuit is uniquely
defined for every combination of inputs


Instructions:

As you go through this module, refer to these guiding questions to aid your learning.

 What is combinatorial circuits?
 What is sequential circuits?
 What is the difference between AND gate, OR gate, and NOT gate?
 What is exclusive-OR logical operation?
 What is a Boolean function?
 What is a NAND gate?



FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 4 Exercises

1. Write the Boolean expression that represents the combinatorial circuit, write the
logic table, and write the output of each gate symbolically
a.
b.
c.

2. Find the value of the Boolean expressions for 1 = 0, 2 = 1, 4 = 0:
a. 1 ∧ 2̅̅ ̅̅ ̅̅ ̅̅ ̅
b. (1 ∧ 2̅̅ ̅) ∨ (1 ∨ 3̅̅ ̅)
c. 1̅̅̅ ∧ (2̅̅ ̅ ∨ 4)

3. Find the disjunctive normal form of each function and draw the combinatorial
circuit corresponding to the disjunctive normal form.
a.
b.
c.
4. Show that the set of gates {OR, NOT} is functionally complete.
5. Show that each set of gates in the following is not functionally complete:
a. {AND}
b. {NOT}
c. {OR}
d. {AND, OR}
6. Draw a circuit using only NAND gates that computes xy.
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 5

INTRODUCTION TO C PROGRAMMING


Learning Objectives

At the end of this topic, you should be able to

 Write simple C programs
 Use simple input and output statements
 Use fundamental data types
 Describe computer memory concepts
 Describe the use of arithmetic operators
 Write simple decision-making statements


Instructions:

As you go through this module, refer to these guiding questions to aid your learning.

 How to print a line of text?
 What are the common Escape Sequences?
 How to compute the sum of two input integers and print the result using printf?
 How to define variables?
 How to define multiple variables of the same type in one statement?
 What is the purpose of identifiers?
 What is the purpose of assignment operator?
 How to calculate in printf statements?
 What is a destructive process?
 What are the various arithmetic operators?
 How must arithmetic expressions be written?
 What are the FOUR rules of operator precedence?
 What are the relational operators?
 What are the equality operators?
 How to use an if statement to make a decision?
 What are the various C’s keywords?


FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 5 Exercises

1. Fill in the blanks in each of the following.
a. Every C program begins execution at the function _____.
b. Every function’s body begins with _____ and ends with _____.
c. Every statement ends with a(n) _____.
d. The _____ standard library function displays information on the screen.
e. The escape sequence \n represents the _____ character, which causes
the cursor to position to the beginning of the next line on the screen.
f. The _____ Standard Library function is used to obtain data from the
keyboard.
g. The conversion specifier _____ is used in a scanf format control string to
indicate that an integer will be input and in a printf format control string to
indicate that an integer will be output.
h. Whenever a new value is placed in a memory location, that value
overrides the previous value in that location. This process is said to be
_____.
i. When a value is read from a memory location, the value in that location is
preserved; this process is said to be _____.
j. The _____ statement is used to make decisions.

2. Write a single C statement to accomplish each of the following:
a. Define the variables c, thisVariable, q76354 and number to be of type int.
b. Prompt the user to enter an integer. End your prompting message with a
colon (:) followed by a space and leave the cursor positioned after the
space.
c. Read an integer from the keyboard and store the value entered in integer
variable a.
d. If number is not equal to 7, print "The variable number is not equal to 7."
e. Print the message "This is a C program." on one line.
f. Print the message "This is a C program." on two lines so that the first line
ends with C.
g. Print the message "This is a C program." with each word on a separate
line.
h. Print the message "This is a C program." with the words separated by
tabs.

3. Write a statement (or comment) to accomplish each of the following:
a. State that a program will calculate the product of three integers.
b. Prompt the user to enter three integers.
c. Define the variables x, y and z to be of type int.
d. Read three integers from the keyboard and store them in the variables x, y
and z.
e. Define the variable result, compute the product of the integers in the
variables x, y and z, and use that product to initialize the variable result.
f. Print "The product is" followed by the value of the integer variable result.

4. Using the statements you wrote in Exercise 3, write a complete program that
calculates the product of three integers.

FUNDAMENTAL OF COMPUTER SYSTEMS
5. Identify and correct the errors in each of the following statements:
a. printf( "The value is %d\n", &number );
b. scanf( "%d%d", &number1, number2 );
c. if(c<7);{
printf( "C is less than 7\n" );
}
d. if ( c => 7 ) {
printf( "C is greater than or equal to 7\n" );
}

FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 6

STRUCTURED PROGRAM
DEVELOPMENT IN C


Learning Objectives

At the end of this topic, you should be able to

 Describe the basic problem-solving techniques
 Develop algorithms through the process of top-down, stepwise
refinement
 Use the if selection statement
 Use the if…else selection statement
 Use the while iteration statement to execute statements in a
program repeatedly
 Use counter-controlled iteration and sentinel-controlled iteration
 Use increment, decrement and assignment operators


Instructions:

As you go through this module, refer to these guiding questions to aid your learning.

 What is the purpose of an algorithm?
 What is a Pseudocode and its purpose?
 What statements does a Pseudocode consist?
 What is a sequential execution?
 How to translate a Pseudocode if statement into C code?
 How to translate a Pseudocode if…else statement into C code?
 How to translate a Pseudocode Nested if…else statement into C code?
 What is the purpose of an iteration statement?
 What is the purpose of a Counter-Controlled Iteration?
 When is sentinel value used?
 What is top-down, stepwise refinement technique used for?
 What is floating-point numbers used for?
FUNDAMENTAL OF COMPUTER SYSTEMS
 What are the various assignment operators for abbreviating assignment
expressions?
 What are the various increment and decrement operators and their purpose?
 What is arithmetic overflow?
 What is a good practice to prevent arithmetic overflow?

FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 6 Exercises

1. Fill in the blanks in each of the following questions.
a. A procedure for solving a problem in terms of the actions to be executed
and the order in which the actions should be executed is called a(n)
_____.
b. Specifying the execution order of statements by the computer is called
_____.
c. All programs can be written in terms of three types of control statements:
_____, _____ and _____.
d. The _____ selection statement is used to execute one action when a
condition is true and another action when that condition is false.
e. Several statements grouped together in braces ({ and }) are called a(n)
_____.
f. The _____ iteration statement specifies that a statement or group of
statements is to be executed repeatedly while some condition remains
true.
g. Iteration of a set of instructions a specific number of times is called _____
iteration.
h. When it’s not known in advance how many times a set of statements will
be repeated, a(n) _____ value can be used to terminate the iteration.

2. Write four different C statements that each add 1 to integer variable x.

3. Write a single C statement to accomplish each of the following:
a. Multiply the variable product by 2 using the *= operator.
b. Multiply the variable product by 2 using the = and * operators.
c. Test whether the value of the variable count is greater than 10. If it is, print
“Count is greater than 10.”
d. Calculate the remainder after q is divided by divisor and assign the result
to q. Write this statement two different ways.

4. Write a C statement to accomplish each of the following tasks.
a. Define variables sum and x to be of type int.
b. Set variable x to 1.
c. Set variable sum to 0.
d. Add variable x to variable sum and assign the result to variable sum.
e. Print "The sum is: " followed by the value of variable sum

5. Identify and correct the errors in each of the following:
a. while(c<=5){
product *= c;
++c;
b. scanf( "%.4f", &value );
c. if(gender==1)
puts( "Woman" );
else;
puts( "Man" );
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 7

C PROGRAM CONTROL


Learning Objectives

At the end of this topic, you should be able to

 Describe the essentials of counter-controlled iteration
 Use the for and do…while iteration statements to execute
statements repeatedly
 Describe the multiple selection using the switch selection
statement
 Use the break and continue statements to alter the flow control
 Use logical operators to form complex conditional expressions in
control statements
 Describe how to avoid the consequences of confusing the
equality and assignment operators


Instructions:

As you go through this module, refer to these guiding questions to aid your learning.

 What are the FOUR requirements of a counter-controlled iteration?
 What does the for iteration statement handle?
 What are the for statement header components?
 What is the general format of the for statement?
 What are the various methods which varies the control variable in a for
statement?
 What is switch multiple-selection statement used for?
 When is the purpose of break statement?
 What is the difference between the while statement and the do…while
statement?
 What is the purpose of continue statement?
 What is logical AND (&&) operator?
 What is logical OR (||) operator?
 What is logical NOT (!) operator?
 What sort of error is caused by Equality (==) and Assignment (=) operators?
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 7 Exercises

1. Fill in the blanks in each of the following questions.
a. Counter-controlled iteration is also known as _____ iteration because it’s
known in advance how many times the loop will be executed.
b. Sentinel-controlled iteration is also known as _____ iteration because it’s
not known in advance how many times the loop will be executed.
c. In counter-controlled iteration, a(n) _____ is used to count the number of
times a group of instructions should be repeated.
d. The _____ statement, when executed in an iteration statement, causes the
next iteration of the loop to be performed immediately.
e. The _____ statement, when executed in an iteration statement or a switch,
causes an immediate exit from the statement.
f. The _____ is used to test a particular variable or expression for each of
the constant integral values it may assume.

2. Write a statement or a set of statements to accomplish each of the following
tasks:
a. Sum the odd integers between 1 and 99 using a for statement. Use the
unsigned integer variables sum and count.
b. Print the value 333.546372 in a field width of 15 characters with precisions
of 1, 2, 3, 4 and 5. Left justify the output. What are the five values that
print?
c. Calculate the value of 2.5 raised to the power of 3 using the pow function.
Print the result with a precision of 2 in a field width of 10 positions. What is
the value that prints?
d. Print the integers from 1 to 20 using a while loop and the counter variable
x. Print only five integers per line. [Hint: Use the calculation x % 5. When
the value of this is 0, print a newline character, otherwise print a tab
character.]
e. Repeat Exercise (2d) using a for statement.

3. Find the error in each of the following code segments and explain how to correct
it.
a. x = 1;
while (x <= 10);
++x;
}
b. for (double y = .1; y != 1.0; y += .1) {
printf("%f\n", y);
}
c. switch (n) {
case 1:
puts("The number is 1");
case 2:
puts("The number is 2"); break;
default:
puts("The number is not 1 or 2");
break;
}
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 8
C FUNCTIONS
PART 1
Learning Objectives
At the end of this topic, you should be able to
 Construct programs modularly from small pieces called functions
 Use common math functions in the C standard library
 Create new functions
 Use mechanisms that pass information between functions
Instructions:
As you go through this module, refer to these guiding questions to aid your learning.
 What are functions used for?
 How are functions invoked?
 What are the commonly used maths library functions?
 What is the purpose of a function square and how do you invoke it?
 What is the format of a function definition?
 What are the THREE ways to return control from a called function to the point
which a function was invoked?
 What is the purpose of function maximum?
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 8 Exercises

1. Answer each of the following:
a. _____ are used to modularise programs.
b. A function is invoked with a(n) _____.
c. A variable known only within the function in which it’s defined is called a(n)
_____.
d. The _____ statement in a called function is used to pass the value of an
expression back to the calling function.
e. Keyword _____ is used in a function header to indicate that a function
does not return a value or to indicate that a function contains no
parameters.
f. A(n) _____ allows the compiler to check the number, types, and order of
the arguments passed to a function.



FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 9
C FUNCTIONS
PART 2
Learning Objectives
At the end of this topic, you should be able to
 Explain how the function call/return mechanism is supported by
the function call stack and stack frames
 Describe the various simulation techniques
 Write and use functions that call themselves
Instructions:
As you go through this module, refer to these guiding questions to aid your learning.
 What is the purpose of function prototypes?
 What does a function call that does not match the function prototype known as?
 What are the usual arithmetic conversion rules that must be followed to avoid
incorrect results?
 What is the concept of last-in, first-out (LIFO) data structures in Stacks?
 What is a stack frame?
 How does the function call stack operate?
 What are the various standard library headers and their descriptions?
 How to create custom headers?
 What are the two ways to pass arguments?
 How to obtain a Random Integer Value using the rand function?
 What are the TWO types of storage duration which the storage-class
specifiers can be split between?
 What type of variables can have automatic storage duration?
 What are the Keywords that are used in the declarations of identifiers for
variables and functions of static storage duration?
 What is the Scope of an Identifier?
 What are the FOUR identifier scopes and their purpose?
 What is a recursive function?
 What are the differences and similarities between Recursion and Iteration?
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 9 Exercises
1. Answer each of the following:
a. The _____ function is used to produce random numbers.
b. The four possible scopes of an identifier are _____ , _____ , _____ and
_____.
c. A function that calls itself either directly or indirectly is a(n) _____ function.
2. For the following program, state the scope (either function scope, file scope,
block scope or function-prototype scope) of each of the following elements.
a. The variable x in main.
b. The variable y in cube.
c. The function cube.
d. The function main.
e. The function prototype for cube.
f. The identifier y in the function prototype for cube.
3. Find the error in each of the following program segments and explain how the
error can be corrected:
a. int g(void)
{
printf("%s", Inside function g\n");
int h(void)
{
printf("%s", Inside function h\n");
}
}
b. int sum(int x, int y)
{
int result = x + y;
}
FUNDAMENTAL OF COMPUTER SYSTEMS
c. void f(float a);
{
float a;
printf("%f", a);
}
d. int sum(int n)
{
if (0 == n) {
return 0; //
}
else {
n + sum(n - 1);
}
}
e. void product(void)
{
printf("%s", "Enter three integers: ")
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int result = a * b * c;
printf("Result is %d", result);
return result;
}
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 10
C ARRAYS
Learning Objectives
At the end of this topic, you should be able to
 Use the array data structure to represent lists and tables of
values
 Define an array, initialise an array and refer to individual
elements of an array
 Define symbolic constants
 Pass arrays to functions
 Use arrays to store, sort and search lists and tables of values
Instructions:
As you go through this module, refer to these guiding questions to aid your learning.
 What is an Array?
 How to define and initialise arrays?
 How to perform many common array manipulations?
 How to use Character Arrays to store and manipulate strings?
 When to apply static or automatic local arrays?
 How to pass an array argument to a function?
 What is the difference between passing an entire array and passing an array
element?
 How to sort arrays?
 What is the technique used for sorting values into ascending order?
 How to compute Mean, Median and Mode using arrays?
 How to perform Linear Search?
 How to perform Binary Search?
FUNDAMENTAL OF COMPUTER SYSTEMS
TOPIC 10 Exercises
1. Answer each of the following:
a. Lists and tables of values are stored in _____.
b. The number used to refer to a particular element of an array is called its
_____.
c. A(n) _____ should be used to specify the size of an array because it
makes the program more modifiable.
d. The process of placing the elements of an array in order is called _____
the array.
e. Determining whether an array contains a certain key value is called _____
the array.
f. An array that uses two indices is referred to as a(n) _____ array.
2. Follow the instructions below regarding an array called fractions.
a. Define a symbolic constant SIZE to be replaced with the replacement text
10.
b. Define an array with SIZE elements of type double and initialize the
elements to 0.
c. Refer to array element 4.
d. Assign the value 1.667 to array element nine.
e. Assign the value 3.333 to the seventh element of the array.
f. Print array elements 6 and 9 with two digits of precision to the right of the
decimal point, and show the output that’s displayed on the screen.
g. Print all the elements of the array, using a for iteration statement.
Assume the integer variable x has been defined as a control variable for
the loop. Show the output.
3. Write statements to accomplish the following:
a. Define table to be an integer array and to have 3 rows and 3 columns.
Assume the symbolic constant SIZE has been defined to be 3.
b. How many elements does the array table contain? Print the total number
of elements.
c. Use a for iteration statement to initialize each element of table to the
sum of its indices. Assume the integer variables x and y are defined as
control variables.
d. Print the values of each element of array table. Assume the array was
initialized with the definition:
int table[SIZE][SIZE] = { {1,8},{2,4,6},{5}};
FUNDAMENTAL OF COMPUTER SYSTEMS
4. Find the error in each of the following program segments and correct the error.
a. #define SIZE 100;
b. SIZE = 10;
c. Assume int b[10] = { 0 }, i;
for (i = 0; i <= 10; ++i) {
b[i] = 1;
}
d. #include ;
e. Assume int a[2][2]={{1,2},{3,4}};
a[1, 1] = 5;
f. #define VALUE = 120
FUNDAMENTAL OF COMPUTER SYSTEMS

欢迎咨询51作业君
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468