Beruflich Dokumente
Kultur Dokumente
FOUNDATIONS OF COMPUTING
PART-A
Q1. Draw a flowchart to produce a printed list of all the students over the
age of 20 in a class .The input records contains the name and age of
students. Assume a sentinel value of 99 for the age field of the trailer
record.
Ans. Flowchart to print names of all the students above the age of 20 in a class
START
IS
AGE>20
&&
AGE<=
99
STOP
STOP
Q2. Write a algorithm for multiplication table for an integer?
Ans.
1. Enter the grade.
2. Read the grade.
3. Scan and count paper with grade A, A=i;
4. Scan and count paper with grade E, E=j;
5. Add count of A and B, n=i+j;
6. Print the total count of A and B, print n;
7. End.
Q4. Company X sells merchandise to wholesale and outlets .Wholesale
customers receives a 5% discount on all orders. The company also
encourages both wholesale and retail customers to pay the cash on
delivery by offering a 3% discount for this method of payment .Another
2% discount is given on orders of 500 or more units’. Each column
represents a certain type of order? Draw the decision table?
Ans.
New wholesale Y Y Y N N Y
order
Cash on delivery N Y Y Y N N
500 or more units N N Y Y Y Y
5% discount X X X X
3% discount X X X
2% discount X X X X
PART-B
Ans. First a file is created in which the program is written. The program is written
and if needed edited under the editor. After editing the file is saved. The program
which was entered into the file is called source program. When the program is
ready for compilation the instructions in the program are translated into suitable
execution form by the compiler. After the translation the program is stored in
another file and it is called object code. Now the object code is linked. Linking is
the process of putting together other program files and functions that are required
by the program. After compiling and linking the program the program is called
executable object code and saved as a executable file with file extension ‘.exe’. this
whole process is done with the help of compiler.
Q6. Write down the basic structure of c program. And draw the flow chart
for same? Also elaborate the each section?
#include <stdio.h>
#include <conio.h>
void main ()
{
printf ("Hello World!");
getch();
}
getch ();
The return instruction causes the main() function finish and return the code
that the instruction is followed by. This it is most usual way to terminate a
program that has not found any errors during its execution.
Documentation section
Link section
Definition section
Declaration part
Executabl
e part
end
Q7. Why do we use qualifiers with data types and elaborate each qualifier
with example?
Ans. Basic data types in C i.e. char, float, int, double has different range of values
and different storage size. In order to have some control over the range of numbers
and storage space, c has different types of qualifiers i.e. short, long, signed and
unsigned. They can be used to stop the wastage of memory. If only 8 bits of
memory is required qualifier ‘short’ can be used with a data type instead of using
the regular data type which would consume 16 bits of memory. Similarly, if more
memory is required than qualifier ‘long’ can be used.
e.g.
1). Data type ‘char’
a). signed char- 8 bits from -128 to 127
b). unsigned char- 8 bits from 0 to 255
3). Data type ‘float’- 32 bits from 3.4E –38 to 3.4E +38
4). Data type ‘double’- 64 bits from 1.7E -308 to 1.7E +308
a). long double- 80 bits from 3.4E -4932 to 1.1E +4932