Flow of Control || Sumita Arora || Class 11 || Practical || Computer Science || Solution


P.I.P: - 4.1


Q9. Write a short program to input a digit and print it in words. Paste your code below.


Q10. Write a program to print absolute value of a number. Absolute value of a number is:


Q11. Write a program to input marks in 3 subjects; compute average and then calculate grade as per following guidelines:

Grade

Remarks

Marks

A

(Level 4, above agency-normalized standards)

80% and above

B

(Level 3, at agency-normalized standards)

70-79%

C

(Level 2, below, but approaching agency-normalized standards)

60-69%

D

(Level 1, well below agency-normalized standards)

50-59%

E

(Level 1-, too below agency-normalized standards)

40-49%




P.I.P: - 4.2

 

Q8. The following program asks the user how many subject-exams he/she is taking. Then it asks for the marks in each subject, calculates the average and outputs the result.
Given below is incomplete code for the same. Complete the code by writing missing functionality.
'''
Return the average or mean mark for a num_subjects.
precondition : num_subjects > 0
postcondition : computed average
'''
num_subjects = int(input ( "How many subjects are you taking?" ))
#initialize the accumulator for the total number of marks
sum = _____
#obtain each mark from the user and keep a running total
for index in _____ (num_subjects) _____
    prompt = "Enter marks for subject #" + str(index + 1) + ":"
    marks = _____ ( input ( _______ ))
    _____ = ________  #add marks to total
#calculate average based on average total marks / number of marks
average = _____ / _____
print ("Your average marks in", _____, "subjects are", _____ )



Q9. Write a program that prints out a list of the integers from 1 to 20 and their squares. The output should look like this:
1---1
2---4
3---9
….
20---400



Q10. Write a program that uses exactly four for loops to print the sequence of letters below.

AAAAAAAAAABBBBBBBCCCCCCEEEEE


Q11. Write a program that checks in the range 1….100 and prints “Fizz” if the numbers multiple of 3 and prints "Buzz" if the number is multiple of 5. It should print “FizzBuzz” if the number multiple of both 3 and 5.


Q12. Use a ‘for loop’ to print ant upside down triangle like the one below. Allow the user to specify how high the triangle should be.

****
***
**
*




Q13. Write a script to print the following:

8
86
864
8642




Q14. Program to print the following pattern:

#######
#           #
#           #
#           #
#           #
#           #
#######



Q15. Program to print the following patterns:

(a)
#######
 #     
   #    
      #   
        #  
           #
#######

(b)
#######
            #
         #
       #  
    #   
 #    
#######




Q16. Write a Python script to print sum of negative numbers, sum of positive even numbers, sum of positive odd numbers from a list of numbers entered by the user. The script should end when the number entered is zero.



Q17. Take an integer input N from the user. Print N Fibonacci numbers. Recall that Fibonacci series progresses as 0112358…..



Q18. Print the series which starts with 1, 1, 2…. Every next number is defined as:
(pre1 * pre2 + pre3) For nth term, prev1 is the last number, prev2 is the second last number, and prev3 is the third last number (N >= 3), i.e. series progresses as:

…..pev3, prev2, perv1, Nth term




Q19. Print first 10 prime numbers.

13 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Hi I want answer for 8th question in P.I.P:- 4.2 Could you please upload it as soon as possible.

    ReplyDelete
  2. i need answers from 1st

    ReplyDelete
  3. Q 1 to 8 of 9.1
    Q 1 to 7 of 9.2
    Plss upload

    ReplyDelete
  4. Please upload answers for question 1 to 8 (flow of control) why those questions are missing

    ReplyDelete
  5. Pls upload theory question

    ReplyDelete
  6. Hi I want answer of question from 1 to 7 in P.I.P:- 4.2 Could you please upload it as soon as possible.

    ReplyDelete
  7. Q 1 to 8 of 9.1
    Q 1 to 7 of 9.2
    Please give me solutions for above mentioned questions

    ReplyDelete
  8. 9.1 1to 8 q please upload

    ReplyDelete
  9. I need 9.2 1st question to 7th question

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post