0% found this document useful (0 votes)
111 views

Questions C++ If Else

This document contains 5 questions asking the student to write programs in Python. Question 1 asks to write a program that takes exam marks as input and outputs the corresponding GPA based on marks ranges using if/else or switch-case statements. Question 2 asks to write a program that stores student details like name, registration number, GPA, fees into variables, calculates updated fees amount with a percentage increase based on registration number. Question 3 asks to write a program that takes 3 numbers as input and displays the largest number. Question 4 asks to write a program that determines if a character entered by the user is a capital letter, small letter or digit based on ASCII codes, or displays "Invalid Character Input". Question 5 asks to write a

Uploaded by

faraz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views

Questions C++ If Else

This document contains 5 questions asking the student to write programs in Python. Question 1 asks to write a program that takes exam marks as input and outputs the corresponding GPA based on marks ranges using if/else or switch-case statements. Question 2 asks to write a program that stores student details like name, registration number, GPA, fees into variables, calculates updated fees amount with a percentage increase based on registration number. Question 3 asks to write a program that takes 3 numbers as input and displays the largest number. Question 4 asks to write a program that determines if a character entered by the user is a capital letter, small letter or digit based on ASCII codes, or displays "Invalid Character Input". Question 5 asks to write a

Uploaded by

faraz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Q1: Write a program that takes marks as input and displays the relevant GPA.

For example, if the


marks are between 85 and 100, the GPA should be 4. If the marks are between 74 and 84, the GPA
should be 3, 2 for marks between 60 and 73, and 1 if the marks are 50 or more but less than 60. The GPA
is 0 for marks between 0 and 49. Any other value for marks is invalid. Write two different types of
selection/conditional statements can solve this problem. i.e. 1) if-else 2) switch-case.

Q2: Write a program that stores your name, your complete registration number, your gpa, and your
current semester fee into variables with appropriate names and data types. What will be the new fee if
the university decides to increase the semester fee by a percentage equal to the last three digits of your
registration number (i.e., the increase for CS12356050 will be by 50%, 1% for SE24125001, and 102% for
CS12345102). Display the new semester fee along with your details in separate lines. A sample output is
shown below (You should enter your own details).

Name: Ali

Registration Number: CS420212125


GPA: 3.4
Your current semester fees: 47000
Your semester fees with 125% increase: 105750

Q3: Write a program that ask user to enter three numbers. The program should find and display the
largest number among three numbers.

Q4: In Ascii code the value of A to Z are 65 to 90 and a to z are 92 to 122 and for 0 to 9 are 48 to 57.
Write a program that determine whether the giver entered character is a capital or small or a digit. If
user enter any other character then program should display “Invalid Character Input!”.

Q5: Assume that Courtyard of Kust Physics department is 20-meter-long and 15 meters wide. The
expenditure of flooring the courtyard is at the rate 250 per square meter. Write a program that calculate
and display the total area of the courtyard and total cost rate of the courtyard. If area of courtyard is
equal to 150 per square meter then the expenditure rate is same as default total cost. If area of
courtyard is more than 150 per square meter and less than or equal to 250 per square meter then the
expenditure rate is 200. If area of courtyard is more than 250 per square meter and less than or equal to
300 per square meter then the expenditure rate is 250. If area of courtyard is more than 300 per square
meter then the expenditure rate will 400.

Note: Its better you to get input from user in all Questions. Best of Luck.

You might also like