Computer Science 123789
Computer Science 123789
CLASS XI
COMPUTER SCIENCE
PYTHON
Q.1. Answer the following question:
a. Define Software. 1
b. How many characters are supported in ASCII? 1
c. Expand DRAM. 1
d. Write a Python program to print table from 5 to 10 2
Q.2. Answer the following questions:
a. Name three levels of data abstraction. 1
b. Define Network DBMS. 1
b. Define booting. 1
***********************************************
(iii) View Level
Sample Question
Paper–B
mul = i*j
Print mul,
Print. (2)
(1)
(b) Network DataBase Management System is type of file anagement system in which the
files are arranged in form of a network with linkag s present between them . (1)
(d) A software interruptis caused either by an exceptional condition in the processor itself,
or a special instruction in the instruction set which causes an interrupt when it is executed.
aglasem
The former is often called a trap or exception and is used for errors or events occurring
during program execution that are exceptional enough that they cannot be handled within
the program itself. For example, if the processor’s arithmetic logic unit is commanded to
divide a number by zero, this imp ssible demand will cause a divide-by-zero exception.(2)
3. (a) c[:] displays all the elements of the list while c[:-1] displays after reducing one element
(c) A Python decorator is a specific change to the Python syntax that allows us to more conveniently alter
functions and methods (and possibly classes in a future version). This supports more readable
applications of the DecoratorPattern but also other uses as well..
(2)
(d) A list can store a sequence of objects in a certain order such that you can index into the list, or iterate
over the list. List is a mutable type meaning that lists can be modified after they have been created.
Example:
A tuple is similar to a list except it is immutable. There is also a semantic difference between a list and a
tuple.
Example:
>>t = 12345, 54321, ‘hello!’
A dictionary is a key-value store. It is not ordered and it requires that the keys are hashable.
(e) Decision Statements or selection statements are the statements which produce a certain output based
upon a condition.
(i) If…Else
This enables the programmer to provide different paths for the program flow depending on certain
conditions. For example: consider a program for dividing two numbers. Division by zero will lead to an
error. To avoid this from happening, after obtaining the two numbers from the user the programmer
will want to ensure that the denominator is not zero. Hence there needs to be two different program
flow options. If the denominator is zero a message saying, “Division not possible” should be displayed.
Otherwise the program should carry out the division and display the results. In simpler terms this can
be stated as:
If the denominator is zero, then display a message and do not divide else
perform division and display the output. Syntax:
if (condition)
//statements to be executed;
else
//statements to be executed;
(ii) Nested If
You can have an ‘if’ statement within another ‘if’ statement. This is known as nested ‘if’. The program
flow will enter into the inner ‘if’ condition only if the outer ‘if’ condition is satisfied. In general form
nested ‘if’ will be of the form:
if (condition1)
if (condition2)
(iii) Switch
A switch statement is a type of selection control mechanism used to allow the value of a variable or
expression to change the control flow of program execution via a multiway branch.
Syntax:
In most languages, a switch statement is defined across many individual lines using one or two
keywords. A typical syntax is:
The first line contains the basic keyword, usually switch, case or select, followed by an expression
which is often referred to as the control expression or control variable of the switch statement.
Subsequent lines define the actual cases (the values) with corresponding sequences of statements
that should be executed when a match occurs.
4. (a) A global variable is a variable that is accessible in every scope. Interaction mechanismswith global
variables are called global environment mechanisms. The global environment
paradigm is contrasted with the local environment paradigm, where allriablesSchoolscalare with no
shared memory (and therefore all interactions can be reconducted to message passing).
(c) An interpreter is a computer program that executes, i.e. performs, instructions written in a
programming language. An interpreter generally uses one of the following strategies for program
execution:
2. translate source code into some efficient intermediate representation and immediately execute
this
3. explicitly execute stored precompiled code made by a compiler which is part of the
Interpreter Output
(2)
(d) (i) 1
(ii) 25
(iii) False
x=0
while True:
(e) try:
if x in xrange(1,1000000001):
y = oct(x)
print y
z=hex(x)
print z
print( zero(x-1)-1)
func xall
xrange()
except ValueError:
continue (4)
5. (a) 64 (1)
if e<5 :
n.remove(e)
println n (3)
(e) Even if a statement or expression is syntactically correct, it may cause an error when an attempt is
made to execute it. Errors detected during execution are calledexceptionsand are not unconditionally
fatal.
It is possible to write programs that handle selected exceptions. Look at the following example, which
asks the user for input until valid integer has been entered, but allows the user to interrupt the program
(using Control-C or whatever the operating system supports); note that a user-generated interruption is
signalled by raising the KeyboardInterrupt exception.
... try:
aglasem
... break
If no exception occurs, the except clause is skipped and execution of the trystatement is finished.
If an exception occurs during execution of the try clause, the rest of the clause is skipped. Then if
its type matches the exception named after the exceptkeyword, the except clause is executed, and
then execution continues after the try statement.
If an exception occurs which does not match the exception named in the except clause,
6. (a) ceil( ) is used to round off a number to next higher integer. floor( ) rounds off to nearest
(b) First
Fourth
Fifth (2)
line=line+ ’h’
Start
Read A, B, C
NO YES
NO NO
End
(4)
7. (a) One function performed by School Management System is that it maintains students’
(b) Booting (also known asbooting up) is the initial set of operations that a computer system performs
when electrical power to the CPU is switch d on or when the computer is reset.
(1)
interference
3. Bluetooth does not need a direct line Infrared needs a direct line of connection
of connection
(3)
In this era, there ere several innovations in various fields of computer technology. These include
Integrated Circuits (ICs), Semiconductor Memories, Microprogramming, various patterns of parallel
processing and introduction of Operating Systems and time-sharing. In the Integrated Circuit, division
there was gradual progress. Firstly, there were small-scale integration (SSI) circuits (having 10 devices
per chip), which evolved to medium scale integrated (MSI) circuits (having 100 devices per chip). There
were also developments of multi-layered printed circuits.
Parallelism became the trend of the time and there were abundant use of multiple functional units,
overlapping CPU and I/O operations and internal parallelism in both the instruction and the data
streams. Functional parallelism was first embodied in CDC6600, which contained 10 simultaneously
operating functional units and 32 independent memory banks. This device of Seymour Cray had a
computation of 1 million flopping point per second (1 M Flops). After 5 years CDC7600, the first vector
processor was developed by Cray and it boasted of a speed of 10 M Flops. IBM360/91 was a
contemporary device and was twice as first as CDC6600, whereas IBM360-195 was comparable to
CDC7600. In case of language, this era witnessed the development of CPL i.e. combined programming
language (1963). CPL had many difficult features and so in order to simplify it Martin Richards
developed BCPL - Basic Computer Programming Language (1967). In 1970 Ken Thompson developed