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

CSE 351: Procedural Abstraction Exam Questions

The document contains examination questions for CSE 351 focused on procedural abstraction, including multiple choice, short answer, code analysis, design, and advanced application questions. It assesses understanding of modularity, parameters, functions versus procedures, and algorithm design. An answer key and grading rubric are also provided, detailing scoring for each section.

Uploaded by

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

CSE 351: Procedural Abstraction Exam Questions

The document contains examination questions for CSE 351 focused on procedural abstraction, including multiple choice, short answer, code analysis, design, and advanced application questions. It assesses understanding of modularity, parameters, functions versus procedures, and algorithm design. An answer key and grading rubric are also provided, detailing scoring for each section.

Uploaded by

simumbwebright8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CSE 351 Examination Questions: Tools for Procedural

Abstraction
Section A: Multiple Choice Questions (1 mark each)

1. What is the primary purpose of procedural abstraction?


a) To make algorithms run faster
b) To break down complex problems into manageable subtasks
c) To reduce memory usage
d) To eliminate the need for variables

2. Which of the following is NOT a benefit of modularity?


a) Makes algorithms easier to write
b) Raises the level of abstraction
c) Increases execution speed
d) Saves time, space, and effort

3. What type of parameter allows data to flow FROM a module back to the calling
algorithm?
a) Input parameter
b) Output parameter
c) Input/output parameter
d) Return parameter

4. A function in procedural abstraction:


a) Can produce multiple values
b) Can perform I/O operations
c) Must resolve to a single value
d) Can modify external variables

5. The formal parameter list is found in:


a) The module call
b) The module declaration
c) The main algorithm
d) The variable declarations

6. Which rule governs the relationship between actual and formal parameters?
a) Parameters can be in any order
b) Actual parameters are associated with formal parameters by name
c) The number of parameters must be consistent
d) All parameters must be of type Num

7. When can an actual parameter be a literal or constant?


a) Never
b) Always
c) Only when associated with an input parameter
d) Only when associated with an output parameter

8. The main algorithm in a well-designed modular system should:


a) Contain most of the data manipulation instructions
b) Primarily consist of module calls
c) Have no parameters
d) Be the longest part of the code

Section B: Short Answer Questions (5 marks each)

9. List and briefly explain the three types of parameters used in procedural abstraction.

10. Explain the difference between a function and a procedure in terms of their
capabilities and restrictions.

11. What are the four rules that govern the relationship between actual and formal
parameter lists?

12. Describe the five key benefits of modularity in algorithm design.

Section C: Code Analysis Questions (10 marks each)

13. Analyze the following procedure declaration and identify:

procedure Calculate_Stats(numbers isoftype in Array,


average isoftype out Num,
maximum isoftype out Num)
// Purpose: Calculate average and maximum of an array of numbers
// Implementation code would go here
endprocedure //Calculate_Stats

a) The procedure identifier


b) The number and types of parameters
c) What this procedure is designed to do
d) Why this should be a procedure rather than a function
14. Given the following function declaration, write a proper function call and explain
how it would be used:

function Convert_Temperature returnsa Num (celsius isoftype in Num)


// Purpose: Convert Celsius to Fahrenheit
Convert_Temperature returns ((celsius * 9.0 / 5.0) + 32.0)
endfunction //Convert_Temperature

15. Identify the errors in the following module declarations and explain how to fix
them:

function Get_User_Input returnsa Num ()


// Purpose: Get a number from the user
print("Enter a number: ")
read(user_input)
Get_User_Input returns user_input
endfunction //Get_User_Input

Section D: Design Questions (15 marks each)

16. Design a complete modular solution for the following problem:


Problem: Create an algorithm that calculates the total cost of a shopping trip. The algorithm should:

Get the number of items purchased


For each item, get its price and quantity

Calculate the subtotal


Apply a 10% tax

Display the final total

Your solution should include:


a) A hierarchy diagram showing the modules
b) Declarations for at least 3 modules (procedures or functions)
c) The main algorithm that uses these modules
d) Justification for your choice of functions vs procedures

17. You are tasked with creating a module that processes student grades. The module
should:
Accept an array of test scores
Calculate the average score

Determine the letter grade (A, B, C, D, F)


Count how many scores are above average
Return all this information to the calling algorithm

a) Should this be a function or procedure? Justify your answer.


b) Write the complete module declaration with appropriate parameters.
c) Explain the interface design decisions you made.

18. Design a modular solution for a simple banking system with the following
requirements:
Check account balance
Make deposits

Make withdrawals (with overdraft protection)


Calculate interest

Display account summary

Your answer should include:


a) A list of required modules with their purposes
b) Parameter specifications for each module
c) The main algorithm structure
d) Discussion of how modularity benefits this system

Section E: Advanced Application Questions (20 marks each)

19. Scenario: You are developing a graphics application that needs to perform various
geometric calculations. The application must handle circles, rectangles, and triangles,
calculating area, perimeter, and other properties for each shape.
Tasks: a) Design a modular hierarchy for this application b) Create function declarations for area
calculations of all three shapes c) Create a procedure that can output a complete report for any shape d)
Write the main algorithm that demonstrates the use of your modules e) Discuss how your modular
design promotes code reusability and maintainability

20. Problem: Design a complete modular solution for a student information system that
processes student records and generates reports.
Requirements:

Read student data (ID, name, grades for 5 subjects)

Calculate GPA for each student


Determine class ranking
Generate individual student reports
Generate class summary statistics
Handle data validation

Your solution must include: a) Complete module hierarchy with justification b) At least 5 module
declarations with proper parameters c) Main algorithm showing module integration d) Discussion of
interface design principles applied e) Analysis of how modularity addresses the complexity of this
system

Answer Key Summary

Section A Answers:
1. b) To break down complex problems into manageable subtasks

2. c) Increases execution speed


3. b) Output parameter

4. c) Must resolve to a single value


5. b) The module declaration
6. c) The number of parameters must be consistent

7. c) Only when associated with an input parameter


8. b) Primarily consist of module calls

Grading Rubric:
Section A: 1 mark per correct answer
Section B: 5 marks each (1 mark per main point with explanation)

Section C: 10 marks each (distributed across sub-questions)


Section D: 15 marks each (comprehensive design and justification)
Section E: 20 marks each (advanced application and analysis)

Total Possible Score: 140 marks

You might also like