Вы находитесь на странице: 1из 3

Solution of Assignment-1

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.
AS!
"#S
o
o
"es
Q2. $rite a algorithm for multiplication ta%le for an integer&
Ans. Algorithm:
1. 'egin
2. (nput num%er as .
). (nitiali*e ( with 1
+. (s (,-. then goto step +/a0 else step 1.
a. (nitiali*e 2 with 1
%. (s 2,-. then goto step + /%0/i0 else step 3.
i. 4alculate (52 and store in 6
ii. 6rint 768
c. (ncrement 2 %9 1 and goto step + /%0.
3. Start printing in the ne:t line.
;. (ncrement ( %9 1 and goto step +.
1. Stop.
(s age<-20&
(nput ame and age
age
(s age-99&
STA=T
4ount - 0
$rite 74ount8
ST>6
4ount - 4ount?1
Q). #ach paper in a set of e:amination papers includes a grade of A. '. 4.
D or #. A count is to %e of how man9 papers have grade of A and how
man9 have grade of #. The total of %oth t9pes have to %e printed at the
end. Assume 30 as sentinel value. $rite a 6seudo 4ode to perform this
function
Ans! 'egin
Ta@e varia%les nos-0. A-0.#-0
Ta@e no of sheets and read the grades.
Do while nos,30
(A/grade-A0
Add 1 to A
#BS#
(A/grade-#0
Add 1 to #A
#D(A
Add 1 to >S
#D D>
6rint A?#
#D
Q+. 4ompan9 C sells merchandise to wholesale and outlets .$holesale
customers receives a 3D discount on all orders. The compan9 also
encourages %oth wholesale and retail customers to pa9 the cash on
deliver9 %9 offering a )D discount for this method of pa9ment .Another
2D discount is given on orders of 300 or more units8. #ach column
represents a certain t9pe of order& Draw the decision ta%le&
Ans.
4>D(T(>S!
4ustomer is wholesaler " " " "
4ustomer is retail saler " " "
>rder,300 " " "
>rder<-300 " " " "
4ash on deliver9 " " " "
A4T(>S!
Discount 2D E E E E
Discount )D E E E E
Discount 3D E E E E
Q3. Fow a Source 6rogram converted to an e:ecuta%le program in 4&
Ans! $hen we write a program it is @nown as source code and source
code is complied %9 the compiler and its converted into o%Gect code and
li@er lin@ it with all reHuired files and functions. And then its loaded into
memor9 for e:ecution.
Q;! $rite down the %asic structure of c program. And draw the flow chart
for same& Also ela%orate the each section&
Ans! 6arts of a %asic 4 programs are!
Documentation section
Bin@ Section
Ilo%al declaration section
Jain function section
K
Bocal varia%le declaration
#:ecuta%le statements
L
Mser-defined function
K
Bocal varia%le declaration
#:ecuta%le statements
L
Q1. $h9 do we use Huantifiers with data t9pes and ela%orate each
Huantifier with e:ample&
Ans. Quantifiers are used to change the use of varia%les in terms of
memor9.
$e have different Huantifiers associated with each data t9pe!
Quantifiers used with integers are! long. short. unsigned and unsigned
long.
Quantifiers used with characters are! long.
Quantifiers used with dou%le are! long.
Aor more details of each Huantifiers please refer 9our %oo@.
QN! Differentiate %etween the following
/a0 Mnar9 and Ternar9 operator.
/%0 Assignment and #Hual To operator.
/c0 #:pression and Statement
/d0 (dentifiers and Oe9words.
/e0 Signed and Mnsigned integers
Ans! Note: For theoretical questions. please refer the book

Вам также может понравиться