SP13 Lab 6 Quizzes.pdf


Preview of PDF document sp13-lab-6-quizzes.pdf

Page 1 2 3 4 5 6

Text preview


Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

Section 1

Write a program in which the user enters a 2-D dynamic array in the main(), then the program asks the
user to enter an element, the program then should display the element’s row number and column’s
number if the element is found, otherwise it should display “Not Found”.
Note: Display all occurrences of that element.
Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

Section 2

Write a program that accepts from the user a 2x3 matrix representing the grades of 2 students in 3
subjects, the program then should output a 3x4 matrix containing an extra column for students’ totals,
and an extra row for grades total.
Sample Execution:
Enter the Input Matrix:
Grade1
Grade2
Grade3
Student1
78
82
91
Student2
65
87
79
The Output Matrix is:
Grade1
Grade2
Grade3
Student1
78
82
90
Student2
65
81
79
Total Grades
143
163
169
Ain Shams University
Faculty of Computer & Information Sciences
Structured Programming
Lab Exam
First year

Total of Student
250
225

Section 3

Write a program that counts number of positive and negative numbers of elements entered by the user
in a stored array.
If the array had the following element: 4, 2, 7, 10, 9, 7, 6, 10, -8, 7, 9
Then display the array after being sorted in descending order
Sample Execution:
Number of positive numbers: 10
Number of negative numbers: 1
Sorted array: 10, 10,9,9,7,7,7,6,4,2,-8