Department of Computer Science Iqra University, Karachi: 1 Is Pseudocode 2 Is Awesomeness
Department of Computer Science Iqra University, Karachi: 1 Is Pseudocode 2 Is Awesomeness
1 Read it first
Prior to start solving the problems in this assignments, please give full concentration on following
points.
3. In a Software house, employer efficiency is determined on the basis of time required for a
employer to complete a particular job. If the time taken by the employer is between 2-3
hours,then the employer is said to be highly efficient. If the time required by the employer is
between 3 -4 hours, then the employer is ordered to improve speed. If the time taken is
between 4-5 hours, the employer is given training to improve his speed and if the time taken
by the employer is more than 5 hours, then the employer has to leave the company . If the
time taken by the employer is input through the keyboard, find the efficiency of the employer.
4. You are asked to compute weekly payment for an employee working at CubixLabs.
TheCubixLabs has a policy such that, if the employee works less than 50 hours in a week then
he/she will get payment as per the given payment rate, that is amount per hour. Otherwise (in
all other conditions) he/she will get payment which is 50 × payment rate.
5. You have to write a program that will take two numbers and a mathematical operator (+, -, * or
/) as the input from the user. Then, you have to perform user-given mathematical operation on
input numbers. Consider following pseudo codes:
6. You have to ask a word w from user, and a number n. You have to print that word upto n time.
Suppose, user enters the word ‘Pakistan’ and number 10, then your program should print the
word ‘Pakistan’ ten times. Yes, the smartest way to deal with this kind of problem is to use a
repeating structure.
7. You have to print the sum of numbers that are in a user defined range. For it you have to ask
the lower bound (limit) and upper bound of a numerical range, and then set an identifier sum
to zero. Then, implement a repeating structure that will add, one by one, all number coming
within user defined range. Remember, adding up a number should retain the value of all
previous summations.
9. Ask a number from user and add next number to it. The process of addition should be repeated
until the sum would become 100 or greater. In the case where user enters the number ≥ 100,
the program should be stopped. In between the steps, you have to count how many iterations
it took for attaining the sum equals to 100.
10. You have to take two numbers as an input from user; and print their average if both inputs
are positive, otherwise print the product of numbers.
f(input1, input2)
11. You are to find mid of two points P and Q. Each point is consisting of two coordinates (x and
y). Seek the values of P and Q from user. Mid-point formula can be:
12. Write a program where you have to ask road type and speed of the vehicle from user and
then decide whether a car is over-speeding, is under-speed or it is moving with the allowed
speed. The allowed speed limit is given in the following table. See the following conditions:
13. Bundoo khan is famous restaurant in Karachi, they have almost manual process. Now they are
willing to use computers and need a computer program that helps them to process their
orders. They defined their process as: When a user comes and asks about deals, we replied we
have three deals for as per different budget and our deals are associated with days. Often we
have complementary food to our customers. You have to workout a solution that asks user to
enter day as input, then it asks how much money you have, if day and money is suitable for
deal then algorithm suggest it otherwise says “sorry you can not have any deal in this range,
you can buy single item”. They showed following menu that bears information:
14. Perform the given operations using File handling concept of python
I. Write a Python program to create a file where all letters of English alphabet are liste by
specified number of letters on each line
II. Write a Python program to count the frequency of words in a file.
III. Write a Python program to append text to a file and display the text
17. Random Lottery Pick. Generate 100 random lottery tickets and pick two lucky tickets from it as a
winner.
Note you must adhere to the following conditions:
The lottery number must be 10 digits long.
All 100 ticket number must be unique.
Hint: Generate a random list of 1000 numbers using random.randrange() and then
use random.sample() method to pick lucky 2 tickets.
18. Write a Python script to display the various Date Time formats – used python module date
a) Current date and time
20. : Roll dice in such a way that every time you get the same numberDice has 6 numbers (from 1 to 6). Roll
dice in such a way that every time you must get the same output number. do this 5 times.
There’s a way to amuse yourself while doing things and thats how I
look at efficiency. — Donald Knuth