Advertisement

CL_XII_COMPUTER_IMP

 

Class – XII

Important questions for COMPUTER (SA-1) EXAMINATION


What are tokens in python? How many types of tokens are allowed in python? Exemplify your answer.

How are keywords different from identifiers?

Can non graphic characters be used and processed in Python? How? Give examples to support your answer.

How are floating constants represented in Python? Give example to support your

What all components can a python program contains ?

How many times is the following loop executed?
for a in range(100,10,-10):
print a

What is the difference between ‘/’ and ‘//’ ?

Give the output of the following statements :

>> str=‘Hello Python’
 >>> str.istitle()

 

Name the modules to which the following func-tions belong:

1.      Uniform ()

2.      fabs ()

 

Out of the following, find the identifiers, which cannot be used for naming Variable or Functions in a Python program: 
_Cost, Price*Qty, float, switch, Address one, Delete, Number12, do

 

SECTION  -  C (THREE MARK QUESTIONS)

 

Out of the following, find those identifiers, which cannot be used for naming variable or Function in a Python program:
Price*Qty, class, for, do, 4thCol, totally, Row31, _Amount

What are operators ? what is their function? Give examples of some unary and binary operators.

 What are variable? How are they important for a program?

Name the Python Library modules which need to be imported to invoke the follwing functions :

1.      sqrt()

2.      dump()

 

What is the difference between input() and raw_input()?

How many times will Python execute the code inside the following while loop? You should answer the question without using the interpreter! Justify your answers.

i = 0

 while i < 0 and i > 2 :

 print “Hello ...”

 i = i+1

 

 

Differentiate between the round() and floor() functions with the help of suitable example.

Convert the following for loop into while loop, for i in range (1,100):

if i % 4 == 2 :
 print i, “mod”, 4 , “= 2”

 

SECTION  -  D (FIVE MARK QUESTIONS)

 

Fill in the missing lines of code in the following code. The code reads in a limit amount and a list of prices and prints the largest price that is less than the limit. You can assume that all prices and the limit are positive numbers. When a price 0 is entered the program terminates and prints the largest price that is less than the limit.

# Read the limit
limit = float(input(“Enter the limit”))
max_price = 0
# Read the next price
next_price = float(input(“Enter a price or 0 to stop:”))
while next_price > 0:
<write your code here>
#read the next price
<write your code here>
if max_price>0:
<write your code here>
else :
<write your code here>

 

Write a generator function generatesq () that displays the squareroots of numbers from 100 to n
where n is passed as an argument.

Write a program to convert binary to decimal