Question Bank UNIT I
Question Bank UNIT I
Question Bank UNIT I
1 mark question
3. The steps that are followed by the programmer for writing a program: Problem
Analysis, Program Design, Program Development, and Program Documentation
and Maintenance.
5. There are three kinds of control structures. They are Sequential, Selection and
Iterative
7. Selection (branch or conditional) - it asks a true/false question and then selects the next
instruction based on the answer
12. Pseudo code consists of short, readable and formally-styled English language used for
explaining an algorithm.
13. In a pseudo code, some terms are commonly used to represent the various actions. For
example, for inputting data the terms may be (INPUT, GET, READ).
17. In a pseudo code, some terms are commonly used to represent the various actions. For
example, for outputting data (OUTPUT, PRINT, DISPLAY).
18. In a pseudo code, some terms are commonly used to represent the various actions. For
example, for calculations (COMPUTE, CALCULATE).
19. In a pseudo code, some terms are commonly used to represent the various actions. For
example, for incrementing and decrementing (INCREMENT).
20. In a pseudo code, some terms are commonly used to represent the various actions. For
example, in addition to words like ADD, SUBTRACT, INITIALIZE used for addition,
subtraction, and initialization, respectively.
2 marks question
Step 1: Start.
Step 2: Read the three numbers n1, n2, n3.
Step 3: Compare n1 with n2 and n1 with n3. If n1 is greater display n1 as greater, else n3 is
greater
Step 4: Compare n2 with n3. If n2 is greater display n2 as greater, else n3 is greater.
Step 5: Stop
Step 1: Start.
Step 2: Read the values radius
Step 3: Calculate area of circle with product of pi value (3.14) and square of radius, store it as
area.
Step 4: Calculate circumference of circle with product of pi value (3.14) with radius and
constant 2, store it as circumference
Step 5: display area
Step 6: display circumference
Step 7: Stop.
5. Write an algorithm to calculate simple interest.
Step 1: Start.
Step 2: Read Principal Value (P), Rate of Interest (R) and Number of Years (T)
Step 3: Calculate simple interest with the formula, product of Principal value (P), Rate of
Interest (R) and Number of Years (T) whole divided by 100 and store it as SI. Step 4: display
SI
Step 5: Stop.
6. Define flow chart. Why is flow chart required? (or) What are flowcharts and list down
their advantages?
Control structures specify the statements to be executed and the order of execution of
statements.
9. List down any four standard flowchart symbols and mention its meaning
Pseudo code consists of short, readable and formally-styled English language used for
explaining an algorithm.
A pseudo code is easily translated into a programming language. Generally, programmers
prefer to write pseudo code instead of flowcharts.
11. Write the pseudo code to find whether the given number is odd or even.
BEGIN
READ value of N.
IF N MOD 2 is equal to 0 THEN
PRINT Even Number
ELSE
PRINT Odd Number
END IF
END
12. Write a pseudo code for swapping two numbers without using temporary
storage.
BEGIN
READ values of num1 and num2
PRINT Before swapping num1 = num1 and num2 = num2.
COMPUTE num1 by adding num1 with num2.
COMPUTE num2 by subtracting num2 from num1.
COMPUTE num1 by subtracting num2 from num1.
PRINT After swapping num1 = num1 and num2 = num2.
END
An algorithm can be represented using a pseudo code. Pseudo code is a readable, formally
styled English like language representation of the algorithm. Pseudo code use structured
constructs of the programming language for representation. The user does not require the
knowledge of a programming language to write or understand a pseudo code.
7. What is a constant?
A constant is a fixed value that cannot be changed in the C program execution.
8. What is a variable?
A variable is an identifier for memory location
Data can be stored in it and taken when needed.
9. What is user-defined datatype? What are its types?
User can define a new kind of data type to declare variables. It is called as user-defined
data type.
Types: Typedef, Enumerated
10. What is the difference between local variable and global variable?
Local Variable Global Variable
Defined at starting of a block Declared before the main function
It can be used only within that block It can be used anywhere in the program
ex:- ex:-
int a=10; void main()
void main() {
{ int i=10;
printf(“%d”,i); printf(“%d”,i);
}}
o/p:- 10 o/p:- 10
Here are some commonly used conversion specifiers (not a comprehensive list):
/*
/*Comments
Comments*/ */
main()
{
/* Comments */
main()
Declaration
{ part;
Executable part;
/* Comments */
}
User-defined functions
{
statements;
Declaration part;
}
Executable part;
7. Define token. List and explain various types of tokens with example.