You are on page 1of 4

ANS 1:

START

Count = 0

Input Name and age


age

YES
Is age=99?

No
Write ‘Count’
No
Is age>=20?
STOP

Yes
Count = Count+1

Ans. 2:
1. Begin
2. Input number as N.
3. Initialize I with 1
4. Is I<=N, then goto step 4(a) else step 7.
a. Initialize J with 1
b. Is J<=N, then goto step 4 (b)(i) else step 5.
i. Calculate I*J and store in P
ii. Print ‘P’
c. Increment J by 1 and goto step 4 (b).
5. Start printing in the next line.
6. Increment I by 1 and goto step 4.
7. Stop.

Ans 3: Begin
Take variables nos=0, NA=0,NE=0
Take no of sheets and read the grades.
Do while nos<50
IF(grade=A)
Add 1 to NA
ELSE
IF(grade=E)
Add 1 to EA
ENDIF
Add 1 to NOS
END DO
Print NA+NE
END

Ans.4:
CONDITIONS:
Customer is wholesaler Y Y Y Y N N N
Customer is retail saler N N N N Y Y Y
Order<500 Y Y N N N Y N
Order>=500 N N Y Y Y N Y
Cash on delivery N Y N Y N Y Y
ACTIONS:
Discount 2% √ √ √ √
Discount 3% √ √ √ √
Discount 5% √ √ √ √

Ans 5: When we write a program it is known as source code and source


code is complied by the compiler and its converted into object code and
liker link it with all required files and functions. And then its loaded into
memory for execution.

Ans 6: Parts of a basic C programs are:


Documentation section
Link Section
Global declaration section
Main function section
{
Local variable declaration
Executable statements
}

User-defined function
{
Local variable declaration
Executable statements
}
Ans 7.
Quantifiers are used to change the use of variables in terms of memory.
We have different quantifiers associated with each data type:
Quantifiers used with integers are: long, short, unsigned and unsigned
long.
Quantifiers used with characters are: long.
Quantifiers used with double are: long.
For more details of each quantifiers please refer your book.

Q8: Differentiate between the following


(a) Unary and Ternary operator.
Ans. Unary operators are those which require only one operant.
For example ‘not’ (!), pre/post increment/decrement operator.
On the other hand ternary operator is a conditional check which
is a short form of “if then else” condition.
(b) Assignment and Equal To operator.
Ans. Assignment (=) operator is used to assign variable some
values. The assigned value may be a constant or the value store
in another variable. On the other hand, equal to(==) operators
are used to check whether the value on the left side is equal to
the value on the right side.
(c) Expression and Statement
Ans. An expression is c token which performs a specific task,
but a statement is a collection of such tokens to perform a
coherent task.
(d) Identifiers and Keywords.
Ans. Identifiers are variable names which are used to designate
and identify memory blocks which are used by the end user to
store values which are required for the calculations.
On the contrary, keywords are some finite words whose
meanings have already been fed into the compiler an are used to
perform some specific task. Keywords can never be used as
identifiers.
(e) Signed and Unsigned integers
Ans. Signed integers are those which consist of +/- sign. In their
representation the MSB is reserved for the sign and in a n-bit no.
only n-1 bits are used to represent the data. Their range is from
-32768 to 32767.
And unsigned integers are those where all the bits are used to
represent the data and no bit is reserve for the sign. They
represent absolute numbers. Their range is from 0 to 65535.

You might also like