Wednesday 12 September 2012

sample questions of c++ 1



                                                                                                Due Date: Nov 2nd 2011       
Course: Programming Fundamentals                                                                     Total Marks: 10
                                                                          
Problem: Write a program that prompts the user to input the number of students in a class. For each student, the program prompts the user to input marks. (It is assumed that the maximum marks are 100.)

The program calculates and prints the number of students against each grade (grading rules are mentioned below) in the format shown below. The program should prompt the user if he/she wants to run it again and should keep repeating until the use opts not to continue. Use only what we have learned so far in the class.

Sample Output
Enter the number of students: 10

Enter marks for student 1: 62
Enter marks for student 2: 77
Enter marks for student 3: 56
Enter marks for student 4: 69
Enter marks for student 5: 72
Enter marks for student 6: 45
Enter marks for student 7: 64
Enter marks for student 8: 83
Enter marks for student 9: 75
Enter marks for student 10: 66

Grade No.of Students
A             0
A-            1
B+            2
B             1
B-            1
C+            1
C             2
C-            1
D             0
F             1

Do you want to run this program again (y/n)? n

Enter the number of students: 5

Enter marks for student 1: 86
Enter marks for student 2: 74
Enter marks for student 3: 67
Enter marks for student 4: 55
Enter marks for student 5: 39

Grade No.of Students
A             1
A-            0
B+            1
B             0
B-            0
C+            1
C             0
C-            1
D             0
F             1

Do you want to run this program again (y/n)? n
Good Bye.



The rules of determining the grade are displayed in the table below:

Grade Criteria
Grade
Marks greater than 0   AND less than 50
F
Marks 50 or Greater than 50 AND less than 55
D
Marks 55 or Greater than 55 AND less than 60
C-
Marks 60 or Greater than 60 AND less than 65
C
Marks 65 or Greater than 65 AND less than 69
C+
Marks 69 or Greater than 69 AND less than 71
B-
Marks 71 or Greater than 71 AND less than 74
B
Marks 74 or Greater than 74 AND less than 80
B+
Marks 80 or Greater than 80 AND less than 85
A-
Marks 85 or Greater than 85 AND less than or equal to 100
A



Submission Guidelines:
-          No Late Submissions will be entertained
-          Copied Assignments will be marked Zero.


No comments:

Post a Comment