Programming roadmap 2
Programming roadmap 2
Important: This set of questions is based on the following one dimensional and two dimensional
arrays
NAMES:
Ali
Ahmed
Asad
Omar
Fahad
MARKS:
55 65 70 90
88 77 66 44
90 91 77 38
87 100 75 91
64 84 93 70
1- Write code that outputs all the names in the Names array. You must use a FOR loop to print
the values inside the array by accessing one element at a time and outputting the value as
shown below
e.g. print(Names[0]) <- This statement outputs the name of the student stored in
element 0 of the Names array
print(Names) works in python but it is not an acceptable solution for this question
2- Write code that prints all the values stored in the two dimensional Marks array by using a
FOR loop. The values must be printed in order of rows i.e. row wise processing.
Your code must access the values inside the array one element at a time and print them.
4- Write code that prints the name of each student and outputs his marks in the same row.
Every students name and marks should be printed in a separate row
5- The marks stored in each column are for different subjects. Col1 is Physics, Col2 is Maths,
Col3 is Computer Science and Col4 is Chemistry. You are required to output the name of each
subject and the marks scored in that subject
6- Write code that outputs the highest marks stored in the class in any subject and output the
name of the student who scored the highest marks as well as the subject in which these marks
were scored
7- A score of 100 marks in the exam means a student scored distinction. Write code to check if
any of the students scored a distinction. Output the name of the student and the subject in
which he scored distinction