0% found this document useful (0 votes)
106 views5 pages

HNDIT 1103-Structured Programming Q1. (2007 First Semester Exam - Q 1)

The document contains 5 past exam questions from various years on the topics of algorithms, flowcharts, and pseudocode. The questions assess understanding of key concepts like local vs global variables, function definitions and calls, characteristics of good algorithms, graphical notations used in flowcharts, and translating between pseudocode and flowcharts. Sample problems are provided to be solved using these programming concepts, such as finding the greatest common divisor or largest number from a set.

Uploaded by

Banda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views5 pages

HNDIT 1103-Structured Programming Q1. (2007 First Semester Exam - Q 1)

The document contains 5 past exam questions from various years on the topics of algorithms, flowcharts, and pseudocode. The questions assess understanding of key concepts like local vs global variables, function definitions and calls, characteristics of good algorithms, graphical notations used in flowcharts, and translating between pseudocode and flowcharts. Sample problems are provided to be solved using these programming concepts, such as finding the greatest common divisor or largest number from a set.

Uploaded by

Banda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

HNDIT 1103- Structured Programming

Q1. ( 2007 First Semester Exam - Q 1)

01. (a) What is a local variable? (02 marks)


(b) What is the use of global (External variable)? (02 marks)
(c) (i). How is information supplied as input to a function?
(ii). How can information be conveyed back to the calling program?
(03 marks)

(d). Write a declaration (prototype) for a function called "testnumber( )" that has two arguments
and a reduce of type 'double’. The first argument is of the float and the second argument is
of type double with a default value of 10.5. (03 marks)
(e). What are the advantages of using functions? (03 marks)
(f). What would be the output from the following program fragment?

void change(void)
{
int x;
x = 1;
}
void main()
{
int x;
x = 0; change();
cout « x « endl;
}
(03 marks)

(g) Using an example describe how to use functions in a C++ program, (include function
declaration, function definition, and function calling)
(04 marks)
(Total 20 marks)

Q2. ( 2009 - First Semester Exam - Q 1)

01. (a). What is a algorithm? List the characteristics of a good algorithm, (04 Marks)
(b) Identify the following symbols used in a flow chart. (02 Marks)

(c) Guess the purpose of the following flaw chart.


(d) Guess the purpose of the following pseudocode.

Start
Enter a number N
D 2
P TRUE
While E<N AND P=TRUE)
If N MOD D= 0) Then P-FALSE
DD+l
End While
If P=TRUE Then Output "SUCCESS"
Stop
(03 Marks)
(e) Draw a flowchart to find out the largest number of ten given numbers (04 Marks)
(f) Write a pseudocode equitant to the flowchart you have drawn in e). (04 Marks)
[Total 20 marks]
Q3. ( 2010 First Semester Exam - Q 1)
(i) Briefly describe what is an algorithm, flowchart and pseudo code? (03 marks)
(ii) Which graphical notations are usually used in a flowchart for begin/end, process, selection
and input/output? (02 marks)
(iii) Use flowchart and pseudocode to explain the terms sequence, selection, and iteration in
structured programming? (03 marks)
(iv) An unstructured algorithm for finding the Greatest Common Divisor (GCD) of two given
(positive) numbers is given below.

Stepl: Read two numbers A and B.


Step2: If A=B Then output A and stop running (because the GCD is A (or B)]
Step3: If A>B Then A <- (A-B) Else B <- (B-A).
Step4: Goto Step2.

Find the GCD of 18 and 30 by using the above algorithm. Clearly show your execution.
(02 marks)
(v) Draw a structured flow chart to output the GCD of two given numbers based on the above
algorithm. (05 marks)
(vi) Write a structured pseudo code to output the GCD of two given numbers based on the above
algorithm. (05 marks)
(Total 20 marks)

Q4. ( 2013 First Semester Exam - Q 1)


1. a) What is meant by terms source code and object code in programming? [04 Marks]
b) What is pseudo code? [02 Marks]
c) What are the symbols used in flow charting to indicate following.
I. input
II. Start/End
Ill. Process
IV. Decision [04 Marks]
d) What is the expected output of the following pseudo code? [02 Marks]
Begin
X=I
While X<IO
X=X+I
End while
Display X
End
e) Write pseudo codes to input two numbers and display the smaller one. [04 Marks]
f) Draw a flowchart to find largest number of given 6 numbers. [06Marks]
[Total Marks 20]
Q5. ( 2014 First Semester Exam - Q 1)
1. a) Define the terms algorithm, flowchart and pseudo code. [03 Marks]
2. b) Give the names and functions of the following basic symbols of flowcharts. [05 Marks]

3. Draw flowcharts for the following constructs: [05 Marks]


a. The sequence construct
b. The decision construct if... then
c. The decision construct if... then ... else
d. The repetition construct - repeat/until
e. The repetition construct – while
4. What is, the output of the following flowchart if the input is 5? [03 Marks]
5. Write pseudo code equivalent to the above flow chat (d).
[04 Marks]

You might also like