Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This process is analogous to reading the text and figures that appear on the page of a notebook. In the monolithic program, the instructions are

This process is analogous to reading the text and figures that appear 
on the page of a notebook. In the monolithic program, the instructions are executed sequentially 
in the order in which they appear in the program. Quite often, it is desirable in a program to alter 
the sequence of the statements depending upon certain circumstances. In real time applications, 
there are a number of situations where one has to change the order of the execution of statements 
based on the conditions.
Decision-making statements in a programming language help the programmer to transfer 
the control from one part to other parts of the program. Thus, these decision-making statements 
facilitate the programmer in determining the flow of control. This involves a decision-making 
condition to see whether a particular condition is satisfied or not. On the basis of real time 
applications it is essential:
(i) to alter the flow of a program.
(ii) to test the logical conditions.
(iii) to control the flow of execution as per the selection.
These conditions can be placed in the program using decision-making statements. C language supports the control statements as listed below:
(i) The if statement
(ii) The if-else statement
(iii) The if-else-if ladder statement
(iv) The switch case statement
(v) The goto unconditional jump
(vi) The loop statement
Besides, the C also supports other control statements such as continue, break.
The decision-making statement checks the given condition and then executes its sub-block. 
The ­decision statement decides which statement to execute after the success or failure of a given 
condition.
The conditional statements use relational operators, which have been explained in Chapter 3. The 
relational operators are useful for comparing the two values. They can be used to check whether they 
are e­ual to each other, une­ual or one is smaller/greater than the other.
The reader or the programmer is supposed to understand the concepts as cited above. Following 
points are expected to be known to the programmer related to the decision-making statements.
Sequential execution: The statements in the program are executed one after another in a 
se­uential manner. This is called the se­uential execution.
Transfer of control: The C statements such as if, goto, break, continue, switch
allow a program to transfer the control at different places in the program. This is accomplished by 
skipping one or more statements appearing in a se­uential flow. This jumping of control is called the 
transfer of control.
 uring 1960s, programmers faced various difficulties in the program in which goto statement 
was used which allows a programmer to transfer the control anywhere in the program. Bohm and 
Jacopini reported that the programmer should not use the goto statement in their programs. Both 
M05_KAMT3553_02_SE_C05.indd 113 for inputting the data and for getting the results, respectively. To perform these tasks in a user friendly 
manner, C has a number of input and output functions. When a program needs data, it takes the data 
through the input functions and sends results obtained through the output functions. Thus, the input/
output functions are the link between the user and terminals.
There are a number of I/O functions in C, based on the data types. The input/output functions are 
classified in two types:
(i) Formatted functions
(ii) Unformatted functions
With formatted functions, the input or output is formatted as per our requirement. The readability 
in easy way is possible with formatted functions. For example, with formatted functions one can 
decide how the result should appear or display on the screen. The result can be shown on the second 
line or it can appear after leaving some space or if the result is a real number then decisions on 
the number of digits before and after decimal point, etc. will be taken care in formatted functions. 
All I/O functions are defined as stdio.h header file, which can be initialized at the starting of a 
program; that is this header file should be included in the program at the beginning. However, formatting is not possible with unformatted functions. Various functions of these categories are listed 
in Figure 4.1.
Streams perform all input and output operations. The streams are nothing but a sequence of bytes. 
In input operations, the bytes (data) flow from input device such as keyboard, a disc drive or network 
connection to main memory. Similarly, in output operation bytes flow from main memory to output 
devices such as monitor, printer, disc drive, network connection.
When a program performs input and output operations, the streams are connected to the program automatically. The operating system always allows streams to redirect to other devices. While 
performing these operations, if any error occurs, it will be reported on the screen by the third stream 
called standard error stream.
Further elaboration on formatted functions is as follows.
(i) Formatted Functions: The formatted input/output functions read and write, respectively, all 
types of data values. They require format string to produce formatted results. Hence, they can 
be used for both reading and writing of all data values. The formatted functions return values 
after execution. The return value is equal to the number of variables successfully read/written. 
Using this value, the user can find out the error that occurred during reading or writing of 
data. Using this function, the given numeric data can be represented in float, integer and 
double to possible available limits

imageimageimage

Question 1 A computer network is a digital telecommunications network which allows nodes to share resources. In computer networks, computing devices exchange data with each other using connections (data links) between nodes. (a) Clarify the FOUR (4) fundamental characteristics of effective data communication. (16 marks) (b) Explain your understanding on client/server network and any THREE (3) benefits of client/server network over peer-to-peer networks. (9 marks) [25 Mark]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Architecture A Quantitative Approach

Authors: John L. Hennessy, David A. Patterson

4th edition

123704901, 978-0123704900

More Books

Students also viewed these Computer Network questions