Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

COMPUTER SCIENCE

Aims (Conceptual) (b) how they communicate with the outside


world.
(1) To understand algorithmic problem solving
using data abstractions, functional and (3) To create awareness of ethical problems and
procedural abstractions, and object based and issues related to computing.
object oriented abstractions.
Aims (Skills)
(2) To understand: (a) how computers represent,
To devise algorithmic solutions to problems and to
store and process data by studying the
be able to code, validate, document, execute and
architecture and machine language of a simple
debug the solution using the Java programming
microprocessor and the different levels of
system.
abstraction that mediate between the machine
and the algorithmic problem solving level and

CLASS XI

There will be two papers in the subject: bases using English or pseudo code. These
algorithms are also good examples for defining
Paper I: Theory - 3 hours…70 marks
different functions in a class modelling numbers
Paper II: Practical - 3 hours…30 marks (when programming is discussed). For addition
and subtraction use the analogy with decimal
PAPER I –THEORY – 70 MARKS
numbers, emphasize how carry works (this will be
Paper 1 shall be of 3 hours duration and be divided useful later when binary adders are discussed).
into two parts.
2. Encodings
Part I (20 marks): This part will consist of
compulsory short answer questions, testing (a) Binary encodings for integers and real
knowledge, application and skills relating to the entire numbers using a finite number of bits (sign-
syllabus. magnitude, twos complement, mantissa-
Part II (50 marks): This part will be divided into exponent notation). Basic operations on
three Sections, A, B and C. Candidates will be integers and floating point numbers.
required to answer two questions out of three from Limitations of finite representations.
Section A (each carrying 10 marks) and two questions Signed, unsigned numbers, least and most
out of three from Sections B (each carrying 10 marks)
significant bits. Sign-magnitude
and two questions out of three from Section C
(each carrying 5 marks). Therefore, a total of six representation and its shortcomings (two
questions are to be answered in Part II. representations for 0, addition requires extra
step); twos-complement representation.
SECTION A Operations (arithmetic, logical, shift), discuss
the basic algorithms used for the arithmetic
Basic Computer Hardware and Software operations. Floating point representation:
1. Numbers normalized scientific notation, mantissa-
exponent representation, binary point (discuss
Representation of numbers in different bases and trade-off between size of mantissa and
interconversion between them (e.g. binary, octal,
exponent). Single and double precision.
decimal, hexadecimal). Addition and subtraction
operations for numbers in different bases. Arithmetic operations with floating point
numbers. Properties of finite representation:
Introduce the positional system of representing overflow, underflow, lack of associativity
numbers and the concept of a base. Discuss the (demonstrate this through actual programs).
conversion of representations between different

236
(b) Characters and their encodings (e.g. ASCII, 5. Propositional logic, hardware implementation,
Unicode). arithmetic operations

Discuss the limitations of the ASCII code in (a) Propositional logic, well formed formulae,
truth values and interpretation of well formed
representing characters of other languages. formulae, truth tables.
Discuss the Unicode representation for the
local language. Java uses Unicode, so strings Propositional variables; the common logical
connectives (~ (not)(negation), ∧
in the local language can be used (they can (and)(conjunction), ∨ (or)(disjunction),
be displayed if fonts are available) – a simple ⇒ (implication),  (equivalence)); definition
table lookup for local language equivalents of a well-formed formula (wff); representation
for Latin (i.e. English) character strings may of simple word problems as wff (this can be
be done. More details on Unicode are used for motivation); the values true and
available at www.unicode.org. false; interpretation of a wff; truth tables;
satisfiable, unsatisfiable and valid formulae.
3. High level structure of computer (b) Logic and hardware, basic gates (AND, NOT,
OR) and their universality, other gates
Block diagram of a computer system with details (NAND, NOR, XOR); inverter, half adder,
of (i) function of each block and full adder.
(ii) interconnectivity and data and control flow Show how the logic in (a) above can be
between the various blocks realized in hardware in the form of gates.
Develop the diagram by successive refinement of These gates can then be combined to
implement the basic operations for arithmetic.
blocks till all the following have been covered: Tie up with the arithmetic operations on
ALU, RAM, cache, the buses (modern computers integers discussed earlier in 2 (a).
have multiple buses), disk (disk controller and
what it does), input/output ports (serial, parallel, 6. Memory
USB, network, modem, line-in, line-out etc.), Memory organization and access; parity; memory
devices that can be attached to these ports hierarchy - cache, primary memory, secondary
(e.g keyboard, mouse, monitor, CDROM, DVD, memory.
audio input/output devices, printer, etc.). Clearly The access time differences between the different
describe the connectivity and the flow of data and kinds of memory; size differences; locality of
control signals. reference and cache memory.

4. Basic architecture of a simple processor and its 7. System and other software
instruction set Boot process. Operating system as resource
manager, command processing, files, directories
Simple Hypothetical Computer. and file system. Commonly available programs
The simple hypothetical computer abbreviated as (editors, compilers, interpreters, word processors,
spread sheets etc.).
(SHC) is meant to introduce the basic structure of
a processor in particular registers, basic Boot process step-by-step from power on till the
instruction set, structure of an instruction, prompt. In OS discuss: (i) all the resources
(processor, memory, i/o) that need to be managed
program counter addressing modes (immediate,
in a computer; (ii) what is meant by managing
direct, register, register-indirect). Simple these resources. Logical structure of data storage
programs should be written in the SHC on disk using logical disks, hierarchical
instruction set (e.g. max./min. of set of nos.) directories and files. Distinguish between
interpreters and compilers. In particular, discuss
the javac and java programs.

237
SECTION B 10. Primitive values, wrapper classes, types and
casting
The programming element in the syllabus is aimed at
Primitive values and types: int, short, long, float,
algorithmic problem solving and not merely rote double, boolean, char. Corresponding wrapper
learning of Java syntax. The Java version used should classes for each primitive type. Class as type of
be 1.5 or later. For programming, the students can use the object. Class as mechanism for user defined
any text editor and the javac and java programs or any types. Changing types through user defined
development environment: for example, BlueJ, casting and automatic type coercion for some
primitive types.
Eclipse, NetBeans etc. BlueJ is strongly recommended
for its simplicity, ease of use and because it is very Ideally, everything should be a class; primitive
well suited for an ‘objects first’ approach. types are defined for efficiency reasons; each
primitive type has a corresponding wrapper class.
8. Introduction to algorithmic problem solving Classes as user defined types. In some cases types
are changed by automatic coercion or casting –
using Java
e.g. mixed type expressions. However, casting in
Note that topics 9 to 13 will get introduced almost general is not a good idea and should be avoided,
simultaneously when classes and their definitions if possible.
are introduced.
11. Variables, expressions
9. Objects
Variables as names for values; expressions
(a) Objects as data (attributes) + behaviour (arithmetic and logical) and their evaluation
(methods or functions); object as an instance (operators, associativity, precedence). Assignment
of a class. Constructors. operation; difference between left hand side and
right hand side of assignment.
Difference between object and class should be
Variables denote values; variables are already
made very clear. BlueJ (www.bluej.org) and defined as attributes in classes; variables have
Greenfoot (www.greenfoot.org) can be used types that constrain the values it can denote.
for this purpose. Constructor as a special kind Difference between variables denoting primitive
of function; the new operator; multiple values and object values – variables denoting
constructors with different argument objects are references to those objects. The
assignment operator = is special. The variable on
structures; constructor returns a reference to
the lhs of = denotes the memory location while the
the object. same variable on the rhs denotes the contents of
(b) Analysis of some real world programming the location e.g. i=i+2.
examples in terms of objects and classes.
12. Statements, scope
Use simple examples like a calculator, date, Statements; conditional (if, if-then-else, switch-
number etc. to illustrate how they can be break, ?: ternary operator), looping (for, while-do,
treated as objects that behave in certain well- do-while, continue, break); grouping statements in
defined ways and how the interface provides a blocks, scope and visibility of variables.
way to access behaviour. Illustrate behaviour Describe the semantics of the conditional and
changes by adding new functions, deleting old looping statements in detail. Evaluation of the
functions or modifying existing functions. condition in conditional statements (esp.
difference between || and | and && and &).
Emphasize fall through in switch statement. Many
small examples should be done to illustrate
control structures. Printing different kinds of
patterns for looping is instructive. When number

238
of iterations are known in advance use the for 14. Arrays, strings
loop otherwise the while-do or do-while loop.
(a) Structured data types – arrays (single and
Express one loop construct using the others. For
multi-dimensional), strings. Example
e.g.:
algorithms that use structured data types (e.g.
for (<init>; <test>; <inc>) <stmt>; is equivalent searching, finding maximum/minimum,
to: sorting techniques, solving systems of linear
equations, substring, concatenation, length,
(i) Using while
access to char in string, etc.).
<init>; while <test> {<stmt>; <inc> }
Storing many data elements of the same type
(ii) Using do-while requires structured data types – like arrays.
<init>; if !<test> do <stmt>; <inc> while Access in arrays is constant time and does not
<test>; depend on the number of elements. Sorting
techniques (bubble, selection, insertion),
Nesting of blocks. Variables with block scope, Structured data types can be defined by
function scope, class scope. Visibility rules when classes – String. Introduce the Java library
variables with the same name are defined in String class and the basic operations on
different scopes. strings (accessing individual characters,
various substring operations, concatenation,
13. Functions replacement, index of operations).
Functions/methods (as abstractions for complex (b) Basic concept of a virtual machine; Java
user defined operations on objects), functions as virtual machine; compilation and execution of
mechanisms for side effects; formal arguments Java programs (the javac and java programs).
and actual arguments in functions; different
behaviour of primitive and object arguments. The JVM is a machine but built as a program
Static functions and variables. The this variable. and not through hardware. Therefore it is
Examples of algorithmic problem solving using called a virtual machine. To run, JVM
functions (various number theoretic problems, machine language programs require an
finding roots of algebraic equations). interpreter (the java program). The advantage
is that such JVM machine language programs
Functions are like complex operations where the (.class files) are portable and can run on any
object is implicitly the first argument. Variable machine that has the java program.
this denotes the current object. Functions (c) Compile time and run time errors; basic
typically return values, they may also cause side- concept of an exception, the Exception class,
effects (e.g. change attribute values of objects) – catch and throw.
typically functions that are only supposed to cause
Differentiate between compile time and run
side-effects return void (e.g. Set functions). Java time errors. Run time errors crash the
passes argument by value. Illustrate the difference program. Recovery is possible by the use of
between primitive values and object values as exceptions. Explain how an exception object
arguments (changes made inside functions persist is created and passed up until a matching
after the call for object values). Static definitions catch is found. This behaviour is different
as class variables and class functions visible and from the one where a value is returned by a
shared by all instances. Need for static functions deeply nested function call. It is enough to
and variables. Introduce the main method – discuss the Exception class. Sub-classes of
Exception can be discussed after inheritance
needed to begin execution.
has been done in Class XII.

239
SECTION C boolean isEmpty()
15. Elementary data structures and associated Object top()
algorithms, basic input/output Then, for example the LIFO property can be
(a) Class as a contract; separating implementation expressed by (assume s is a stack):
from interface; encapsulation; private and if s.push(o); o1=pop() then o ≡ o1
public.
What the rule says is: if o is pushed on the
Class is the basic reusable unit. Its function stack s and then it is popped and o1 is the
prototypes (i.e. the interface) work as a visible object obtained then o, o1 are identical.
contract with the outside world since others
will use these functions in their programs. Another useful property is:
This leads to encapsulation (i.e. hiding if s.isEmpty() == true then s.pop() = ERROR
implementation information) which in turn
leads to the use of private and public for It says that popping an empty stack gives
realizing encapsulation. ERROR.

(b) Interfaces in Java; implementing interfaces Similarly, several other properties can also be
through a class; interfaces for user defined specified. It is important to emphasize the
implementation of behaviour. behavioural rules or properties of a data
structure since any implementation must
Motivation for interface: often when creating guarantee that the rules hold.
reusable classes some parts of the exact
implementation can only be provided by the Some simple algorithms that use the data
final end user. For example in a class that structures:
sorts records of different types the exact i) For stack: parentheses matching, tower of
comparison operation can only be provided Hanoi, nested function calls; solving a
by the end user. Since only he/she knows maze.
which field(s) will be used for doing the
ii) For queue: scheduling processes, printers,
comparison and whether sorting should be in
jobs in a machine shop.
ascending or descending order be given by
the user of the class. (d) Basic input/output using Scanner and Printer
classes from JDK; files and their
Emphasize the difference between the Java
representation using the File class, file
language construct interface and the word
input/output; input/output exceptions. Tokens
interface often used to describe the set of
in an input stream, concept of whitespace,
function prototypes of a class.
extracting tokens from an input stream
(c) Basic data structures (stack, queue, dequeue); (StringTokenizer class).
implementation directly through classes;
The Scanner class can be used for input of
definition through an interface and multiple
various types of data (e.g. int, float, char etc.)
implementations by implementing the
from the standard input stream or a file input
interface. Basic algorithms and programs
stream. The File class is used model file
using the above data structures.
objects in the underlying system in an OS
A data structure is a data collection with well independent manner. Similarly, the Printer
defined operations and behaviour or class handles output. Only basic input and
properties. The behaviour or properties can output using these classes should be covered.
usually be expressed formally using equations
Discuss the concept of a token (a delimited
or some kind of logical formulae. Consider
continuous stream of characters that is
for e.g. a stack with operations defined as
meaningful in the application program – e.g.
follows:
words in a sentence where the delimiter is the
void push(Object o) blank character). This naturally leads to the
Object pop() idea of delimiters and in particular

240
whitespace and user defined characters as (f) Concrete computational complexity; concept
delimiters. As an example show how the of input size; estimating complexity in terms
StringTokenizer class allows one to extract a of functions; importance of dominant term;
sequence of tokens from a string with user best, average and worst case.
defined delimiters.
Points to be given particular emphasis:
(e) Concept of recursion, simple recursive (i) Algorithms are usually compared along
functions (e.g. factorial, GCD, binary search, two dimensions – amount of space (that is
conversion of representations of numbers memory) used and the time taken. Of the
between different bases). two the time taken is usually considered
Many problems can be solved very elegantly the more important. The motivation to
by observing that the solution can be study time complexity is to compare
composed of solutions to ‘smaller’ versions of different algorithms and use the one that is
the same problem with the base version the most efficient in a particular situation.
having a known simple solution. Recursion (ii) Actual run time on a particular computer
can be initially motivated by using recursive is not a good basis for comparison since it
equations to define certain functions. These depends heavily on the speed of the
definitions are fairly obvious and are easy to computer, the total amount of RAM in the
understand. The definitions can be directly computer, the OS running on the system
converted to a program. Emphasize that any and the quality of the compiler used. So
recursion must have a base case. Otherwise, we need a more abstract way to compare
the computation can go into an infinite loop. the time complexity of algorithms.
Illustrate this by removing the base case and (iii) This is done by trying to approximate the
running the program. Examples: number of operations done by each
(i) Definition of factorial: algorithm as a function of the size of the
input. In most programs the loops are
factorial(0) = 1 //base case important in deciding the complexity. For
factorial(n) = n * factorial(n-1) example, in bubble sort there are two
nested loops and in the worst case the time
(ii) Definition of GCD: taken will be proportional to n(n-1) where
gcd(m, n) = n is the number of elements to be sorted.
Similarly, in linear search in the worst
if (m==n) then n //base case case the target has to be compared with
else if (m>n) then gcd(m-n, n) all the elements so time taken will be
proportional to n where n is the number of
else gcd(m, n-m) elements in the search set.
(iii) Definition of Fibonacci numbers: (iv) In most algorithms the actual complexity
for a particular input can vary. For
fib(0) = 1 //base case example, in search the number of
fib(1) = 1 //base case comparisons can vary from 1 to n. This
means we need to study the best, worst
fib(n) = fib(n-1)+ fib(n-2) and average cases. Comparisons are
The tower of Hanoi is a very good example of usually made taking the worst case.
how recursion gives a very simple and elegant Average cases are harder to estimate
solution where as non-recursive solutions are since it depends on how the data is
quite complex. Discuss the use of a stack to distributed. For example, in search, if the
keep track of function calls. The stack can elements are uniformly distributed it will
also be used to solve the tower of Hanoi take on the average n/2 comparisons when
problem non-recursively. the average is taken over a statistically
significant number of instances.

241
(v) Comparisons are normally made for large PAPER II – PRACTICAL – 30 MARKS
values of the input size. This means that
This paper of three hours duration will be evaluated
the dominant term in the function is the
internally by the school.
important term. For example, if we are
looking at bubble sort and see that time The paper shall consist of three programming
taken can be estimated as: a*n2 +b*n + c problems from which a candidate has to attempt any
where n is the number of elements to be one. The practical consists of the two parts:
sorted and a, b, c are constants then for (1) Planning Session
large n the dominant term is clearly n2 and
we can in effect ignore the other two (2) Examination Session
terms. The total time to be spent on the Planning session and
16. Implementation of algorithms to solve the Examination session is three hours.
problems A maximum of 90 minutes is permitted for the
Planning session and 90 minutes for the Examination
The students are required to do lab assignments in
the computer lab concurrently with the lectures. session. Candidates are to be permitted to proceed
Programming assignments should be done such to the Examination Session only after the
that each major topic is covered in at least one 90 minutes of the Planning Session are over.
assignment. Assignment problems should be Planning Session
designed so that they are non-trivial and make the
student do algorithm design, address correctness The candidates will be required to prepare an
issues, implement and execute the algorithm in algorithm and a hand written Java program to solve
Java and debug where necessary. the problem.
Self explanatory. Examination Session
The program handed in at the end of the Planning
17. Social context of computing and ethical issues
session shall be returned to the candidates. The
(a) Intellectual property and corresponding laws candidates will be required to key-in and execute the
and rights, software as intellectual property. Java program on seen and unseen inputs individually
(b) Software copyright and patents and the on the Computer and show execution to the examiner.
difference between the two; trademarks; A printout of the program listing, including output
software licensing and piracy. results should be attached to the answer script
containing the algorithm and handwritten program.
(c) Free software foundation and its position on This should be returned to the examiner. The program
software, open source software, various types
should be sufficiently documented so that the
of licensing (e.g. GPL, BSD).
algorithm, representation and development process is
(d) Privacy, email etiquette, spam, security issues, clear from reading the program. Large differences
phising. between the planned program and the printout will
Social impact and ethical issues should be result in loss of marks.
discussed and debated in class. The important Teachers should maintain a record of all the
thing is for students to realise that these are assignments done as part of the practical work through
complex issues and there are multiple points of the year and give it due credit at the time of
view on many of them and there is no single cumulative evaluation at the end of the year. Students
‘correct’ or ‘right’ view.
are expected to do a minimum of twenty assignments
for the year.

242
EVALUATION: (Marks should be given for choice of algorithm and
implementation strategy, documentation, correct output
Marks (out of a total of 30) should be distributed as
on known inputs mentioned in the question paper,
given below:
correct output for unknown inputs available only to the
Continuous Evaluation examiner.)
Candidates will be required to submit a work file Viva-voce - 5 marks
containing the practical work related to programming
(Viva-voce includes questions on the following
assignments done during the year.
aspects of the problem attempted by the student: the
Programming assignments done throughout the year algorithm and implementation strategy,
(Internal evaluation) - 10 marks documentation, correctness, alternative algorithms or
implementations. Questions should be confined
Terminal Evaluation
largely to the problem the student has attempted).
Solution to programming problem on the computer
- 15 marks

243

You might also like