Sie sind auf Seite 1von 112




(Affiliated to Rajiv Gandhi Proudyogiki Vishwavidyalaya, Bhopal (M.P.)

CONTENTS 01. Code of Conduct for Student of Ocm 02. Academic Calendar for Semester I, 2011 03. Pattern of University Question Paper 04. Course of Study and Scheme of Examination 05. Academic Detail of Course MCA 101: Information Technology (i) Course Contents (ii) Lecture Plan with references (iii) Unit wise blow up (iv) Previous Univ. Exam Paper (v) Model paper (vi) List of Books 06. Academic Detail of Course MCA 102: Mathematical Foundation of Computer Science (i) Course Contents (ii) Lecture Plan with references (iii) Unit wise blow up (iv) Previous Univ. Exam Paper (v) Model paper (vi) List of Books 07. Academic Detail of Course MCA 103: Programming and Problem Solving in C (i) Course Contents (ii) Lecture Plan with references (iii) Unit wise blow up (iv) Previous Univ. Exam Paper (v) Model paper (vi) List of Books 08. Academic Detail of Course MCA 104: Computer organization and Assembly Language Programming (i) Course Contents (ii) Lecture Plan with references (iii) Unit wise blow up (iv) Previous Univ. Exam Paper (v) Model paper (vi) List of Books 09. Academic Detail of Course MCA 105: Distributed Operating System (i) Course Contents (ii) Lecture Plan with references (iii) Unit wise blow up (iv) Previous Univ. Exam Paper (v) Model paper (vi) List of Books 10. Annexure: RGPV University MCA Exam Q. Paper


(University of Technology of Madhya Pradesh)
Air Port Bypass Road Gandhi Nagar, Bhopal-462 036


W.E.F. JULY 2010 MCA-I Sem
S No Subject Code Subject name Periods per week L T P Credits Maximum Marks (Theory slot) End Sem Exa ms Test Two Maximum Marks (Practical slot) Assig End Practic nmen Sem/P al ts/Qu ractica Record iz l Viva /Assign ment/Q uiz/Pre sentati on Total Marks

1 2 3 4 5 6 7


Information Technology Mathematical Foundation of Computer Science Programming and Problem Solving in C Computer organization and Assembly Language Programming Communication Skills Programming Laboratory in C Assembly Language Programming

3 3 3 3 3 15

1 1 1 1 1 5

8 2 10

4 4 4 4 4 8 2 30

70 70 70 70 70 350

20 20 20 20 20 100

10 10 10 10 10 50

120 30 150

80 20 100

100 100 100 100 100 200 50 750

MCA-102 MCA-103 MCA-104

MCA-105 MCA-106




Academic Details of Course

MCA-101 Information Technology

(i) Course Content Course Course Name No. L (Hr s) T (Hr s) P (Hr s) Theory Slot Theor y Marks 70 Test Marks 20 Practical slot
Practical Record/Assignme nt/Quiz/Presentati on

Total Marks

End Assign ment/ Sem/Prac Quiz tical Viva


Information Technology



UNIT-I 1. 2. 3. 4. 5. 6. 7. 8. 9. Basic concepts of IT Concepts of Data & Info, data processing History of computers (generation, type of languages) Organization of computers I/O devices Storage devices System software Application software Utility packages

UNIT-II 1. 2. 3. 4. 5. 6. Elements of assembly language programming A simple assembly scheme Pass structure of assembler Design of two passes assemblers Design of two passes assemblers Macros & Macro Processors

UNIT-III 1. 2. 3. 4. 5. 6. 7. 8. 9. Aspects of compilation, Memory allocation, Compilation of expression &control structures Code optimization Interpreters Software tools for program development Editors & debug monitors Programming environment User interfaces

UNIT-IV 1. 2. 3. 4. 5. 6. 7. 8. 9. Relocation & linking concepts Design of linkers Self relocating programs A linker for MS DOS, linking for overlays A two pass loader scheme Relocating loaders Subroutine linkage Direct linkage loader Binders overlays

UNIT-V 1. 2. 3. 4. 5. 6. 7. 8. 9. Sequential file organization, Random file organization, Index structure, Indexed file organization, Alternate key indexed sequential files, Multi key organization, Multi key access, Multi list file organization, Inverted files & their definitions


Lecture Plan with references Jul 2011Dec 2011 I MCA

Subject Title Sub. Code Department

Information Technology MCA-101 Department of MCA

Session : Semester Branch

Lect. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.

Topics to be covered Basic concepts of IT, Concepts of Data & Info, data processing History of computers (generation, type of languages) Organization of computers , I/O devices Storage devices System software , Application software , Utility packages Elements of assembly language programming Elements of assembly language programming A simple assembly scheme Pass structure of assembler Design of two passes assemblers Design of two passes assemblers Macro definition & Call Macro expansion Nested macro calls

Date of Completion

Remarks R1 :1-5 R1 :54 63 R1 :80 82 R1 :103 R1 :439 445 R2 :85 R2 :86 R2 :91 R2 :94 R2 :95 R2 :95 R2 :132 R2 :133

14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36.

Advanced macro facilities Design of macro processors Aspects of compilation Memory allocation Compilation of expression Compilation of control structures Code optimization Interpreters Software tools for program development Editors, debug monitors Programming environment, user interfaces. Relocation & linking concepts , Design of linkers Self relocating programs A linker for MS DOS A two pass loader scheme Relocating loaders Subroutine linkage , Direct linkage loader Binders overlays Sequential file organization , Random file organization, Index structure Indexed file organization Alternate key indexed sequential files

R2 :138 R2 :145 R2 :162 R2 :165 R2 :180 R2 :192 R2 :199 R2 :212 R2 :250 R2: 257,260 R2 :262 R2 :223 R2 :232 R2 :245 Notes Notes Notes Notes Notes R3 :92 R4 :156 164 R3 :93 R3 :105

37. 38. 39. 40.

Direct file organization Multi key organization , Multi key access Multi list file organization, Inverted files & their definitions

R3 :106 113 R3: 115 R3: 116 118 R3:118120

Books References R1: Computers Today Suresh K Basandara Galgotia Publication R2 :System Programming & Operating Systems D M Dhandhere Tata McGraw Hill Publication R3 :An Introduction to Database Systems Bipin C Desai Galgotia Publication R4 :Fundamentals of Database Systems Elmarsi & Navathe Pearson Education

(iii) Unit wise blow up Unit I 1. Data: A representation of facts, concepts, or instructions in a formalized manner suitable for communication, interpretation, or processing by humans or by automated means. 2. Information: Information is the result of processing, manipulating and way that adds to the knowledge of the person receiving it.

organizing data in a

Generation of Computer: The computer has experienced five generations, with the fifth generation still very much in development. -First Generation -Second Generation -Third Generation -Fourth Generation -Fifth Generation 4. I/O Devices Input device Keyboard Mouse MICR OCR OMR Light Pen Output Unit VDU (Monitor) Printer Plotter 5. Storage Devices Hard Disk Magnetic Tape Floppy Disk Optical Disk Punched Card 6. System Software 7. Application Software Databases Word processors Spreadsheet Compiler Interpreter Operating System

Unit II 1. Basic elements of assembly language are:

Labels Instructions Operands Directives Comments.

2. Assembly Scheme Synthesis Phase Analysis Phase 3. Pass structure of assembler Single Pass Assembler Two Pass Assembler Macros: A macro is a group of repetitive instructions in a program which are codified only once and can be used as many times as necessary. Syntax of a Macro

The parts which make a macro are: Declaration of the macro Code of the macro Macro termination directive


Nested Macro Call: A model Statement in a macro may constitute a call on another macro. Such calls are known as nested macro call. Advanced Macro facilities Alteration of flow of control Expansion time variables Attributes of parameters

Unit III

Aspects of Compilation: Two Aspects of Compilation Generate code to implement meaning of a source program Provide diagnostics for violations of PL semantics in a source program Memory Allocation: Memory Allocation involves three important tasks Determine amount of memory required Use an appropriate memory allocation model Determine appropriate memory mapping Compilation of Expression: Major issues in code generations for expressions are follows Determination of an evaluation order for the operators Selection of instructions to be used in the target code Use of registers and handling of partial results



4. Compilation of control structures Control Transfer Conditional Execution Iterative Constructs Code Optimization: Code optimization aims at improving the execution efficiency of a program. This is achieved in two ways Redundancies in a program are eliminated Computations in a program are rearranged or rewritten

Optimizing transformations commonly used in compiler are Compile time evaluation Elimination of common sub expressions Dead code elimination Frequency reduction Strength reduction

Phases of Optimization: Local Optimization Global Optimization

7. Software tools for program development Program design, coding & documentation Preparation of programs in machine readable form Program translation, linking and loading Program testing and debugging Performance tuning


Reformatting the data Line Editors Steam Editors Screen Editors Word Processors Structure Editors Debug Monitor Provide following facilities o Setting Breakpoint in the program o Initiating a debug conversation when control reaches a breakpoint o Displaying values of variables o Assigning new values to variables Testing user defined assertions and predicates involving program variables

Editors :


Debug Monitors :

10. Programming Environment It consists of the following components Syntax Directed Editor Language Processor Debug Monitor Dialog Monitor 11. User Interfaces It consists of two components o Dialog Manager o Presentation Manager

Unit IV 1. To execute an object program, we needs Relocation, which modifies the object program so that it can be loaded at an address different from the location originally specified Linking, which combines two or more separate object programs and supplies the information needed to allow references between them? Loading and Allocation, which allocates memory location and brings the object program into memory for execution 2. Type of loaders Assemble-and-go loader Absolute loader (bootstrap loader)

3. Design options

Relocating loader (relative loader) Direct linking loader

Linkage editors Dynamic linking Bootstrap loaders

Linker: A program that pulls other programs together so that they can run. Most programs are very large and consist of several modules. Even small programs use existing code provided by the programming environment called libraries. The linker pulls everything together, makes sure that references to other parts of the program (code) are resolved. Loading : Copying a program from a storage device to memory, then starting execution Absolute Loader : Purpose Load an absolute program into memory Procedure (one pass over SIC obj. program) 1. Check Header record for program name, required space for program 2. Instructions in each Text record loaded into memory at indicated address 3. on reaching End record, jump to the indicated address and start execution

5. 6.

Unit V

1. 2.

File : A file is organized logically as a sequence of records.

Records : A record is a sequence of fields Fixed-length Variable-length Spanned Unspanned 3. Types of File : Serial File Sequential File Index Sequential File Direct File Secondary Key Retrieval File -Multi list file organization -Inverted file Organization


Ordered Indexes: An ordered file that stores the index field and a pointer. Requires a binary search on the index file Types of Ordered Indexes Primary Clustering Secondary Secondary Indexes: A secondary index is an ordered file that stores the no ordering field of a data file and a pointer. If the indexing field is a secondary or candidate key, then the index is dense. If the indexing field is a nonkey field, then the index is sparse. Introduces the idea of adding a level of indirection

(iv) university paper

(v) Model Test Paper MCA-101 Information Technology Time: 3 hr Note: Attempt all. And each question carry equal marks. Unit - I Q1. (a) Draw the Block diagram of a digital computer and discuss its various components. (b) Distinguish between primary memory and secondary memory OR (a) Define data processing and discuss the steps involved in data processing. (b) Distinguish between application software and System software. Unit II Q2 (a) Explain various types of assembly language statement. (b) Write algorithm and flow chart of Pass I of two pass assembler OR (a)What are literals? How are they handled during assembly? (b) What is Macro and macro definition? Unit III Q3. (a) What do you understand by Memory allocation in compilation process? (b) Explain software tools. Discuss software tools for program development. OR (a) What is Compiler? Discuss compilation process in detail. (b) Explain code optimization. What are the ways in which code optimization can be achieved? Unit IV Q4 (a) What are loaders? Explain various loading schemes. (b) What is Object module? Explain its various components. OR (a) Explain following terms (i) Link Origin (ii) Load Origin (iii) Link Address (iv) Translated Origin (b) Explain functions of Linker. Unit V Q5 (a) Explain sequential file organization .What are its advantages and disadvantages? (b) Explain following terms 1. File Header 2. Sparse & Dense Index 3. Spanned & Unspanned record OR (a) Explain Indexing. What is primary index and secondary index? (b) Differentiate between DBMS and file organization. Max Marks: 100 Min Marks: 40


List of Books

D.M. Dhamdhere System Programming & O.S. 2nd Ed., Tata Mc. Graw Hill. J. Donovan System Programming THM. Rajaraman V. Fundamental of Computers (4nd edition.) Prentice Hall of India, New Delhi 2004. Sardes D.H. Computers today McGraw Hill 1988. S.Jaiswal, Fundamental of Computer & IT, Wiley dreamtech India..


4. 5.

Web References 1. 2. %20elements 3.


Academic Details of Course

MCA-102 Mathematical Foundation of Computer Science

(i) Course Content Course No. Course Name L (H rs) T (Hr s) P (Hr s) Theory Slot Theor y Marks 70 Test Marks 20 Practical slot
Practical Record/Assignme nt/Quiz/Presentati on

Total Marks

End Assign ment/ Sem/Prac Quiz tical Viva


Mathematical Foundation of Computer Science



UNIT-I Sets, Relations and Functions: 1. Sets 2. Subsets Power sets 3. Complement, Union and Intersection, Demorgans law Cartesian products 4. Relations, relational matrices, properties of relations 5. Equivalence relation, 6. Functions , Injection, Surjection and Bijective mapping, Composition of functions 7. The characteristic functions 8. Mathematical induction. UNIT-II Proportions & Lattices: 1. Proposition & prepositional functions, Logical connections 2. Truth-values and Truth Table, 3. The algebra of prepositional functions4. The algebra of truth values 5. Applications (switching circuits, Basic Computer Components). 6. Partial order set, Hasse diagrams, upper bounds, lower bounds 7. Maximal and minimal element, first and last element 8. Lattices, sub lattices, Isotonicity 9. Distributive inequality 10. Lattice homomorphism, lattice isomorphism , 11. Complete lattice ,complemented lattice 12. Distribution lattice. UNIT-III Groups and Fields: 1. Group axioms 2. Permutation group 3. Sub group, 4. Co-sets, 5. Normal subgroup, Semi group

6. Lagrange theorem 7. Fields 8. Minimal polynomials 9. Reducible polynomials 10. Primitive polynomial 11. Polynomial roots 12. Applications. UNIT-IV Graphs: 1. Finite graphs 2. Incidence and degree 3. Isomorphism, sub graphs 4. Union of graphs 5. Connectedness, walk, paths, and circuits 6. Eulerian graphs 7. Tree properties of trees 8. Pendant vertices in tree, center of tree 9. Spanning trees and cut vertices 10. Binary tree 11. Matrix representation of graph, incidence and adjacency matrix 12. Applications and properties of graphs in computer science. UNIT-V Discrete Numeric function and Recurrence relation: 1. Introduction to discrete numeric functions 2. Generating functions 3. Introduction to recurrence relations 4. Recursive algorithms 5. Linear recurrence relations with constant coefficients 6. Homogeneous solutions 7. Particular solutions 8. Total solutions

(iii) Subject Title Sub. Code Department

Lecture Plan with references Session : Semester Branch Jul 2011Dec 2011 I MCA

Mathematical Foundation of Computer Science MCA-102 Department of MCA

Lect. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.

Topics to be covered Sets, Subsets, Power sets Complement, Union and Intersection Demorgans law and Cartesian products Relations, relational matrices, properties of relations Equivalence relation Functions ,Injection, Surjection and Bijective mapping, Composition of functions, the characteristic functions Mathematical induction Proposition & prepositional functions, Logical connections Truth-values and Truth Table The algebra of prepositional functions The algebra of truth values Applications (switching circuits, Basic Computer Components). Partial order set, Hasse diagrams, Upper bounds, lower bounds

Date of Completion

Remarks R1:2 R1:6 R1:103 R1:103 R1:113 R1:126 R1:134 R1:14-18 R1:28 R1:29 R:29 Notes R1:415 R1:117 R1:119

16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39.

Maximal and minimal element, first and last element Lattices, sub lattices Isotonicity , distributive inequality. Lattice homomorphism, lattice isomorphism Complete lattice ,complemented lattice Distribution lattice. Group axioms Permutation group, sub group Co-sets, normal subgroup Semi group, Lagrange theorem Fields, minimal polynomials Reducible polynomials, Primitive polynomial Polynomial roots, applications Finite graphs, incidence and degree Isomorphism, sub graphs and union of graphs Connectedness, walk, paths, and circuits Applications of graphs in computer science Eulerian graphs ,tree properties of trees Pendant vertices in tree, center of tree , Spanning trees and cut vertices, binary tree Matrix representation of graph, incidence ,adjacency matrix Their properties, applications of graphs in computer science. Introduction to discrete numeric functions

R1:118 R1:118393 Notes R1:365 R1:395 R1:393 R1:346 R2:300 R1:354 R2:322 R3:356 R1:344 -353 R1:372 R1:376 R1:377 R1:371 R1:139 R3:197 R1:145 Net R3:204 R1:139 R1:205210 Notes Notes R2:504

40. 41. 42. 43. 44. 45.

Introduction to generating functions Introduction to recurrence relations and recursive algorithms Recursive algorithms Linear recurrence relations with constant coefficients Homogeneous solutions Particular solutions and total solutions

R2:506 R2:531 Notes R2:558 R1:308 R1:312,31 4

Reference Books R1: Element of Discrete Mathematics: C.L. Liu R2: Foundation Of Discrete Mathematics: K.D Joshi R3: Discrete Mathematical Structure: Bernard Kolman.


Unit wise blow up

Unit-I 1. Set: A well Defined Collection or class of object is a set. Every object in a set is called an element. 2. Different types of Sets: Null or Empty Set Singleton Set Finite Set Infinite Set Subset Proper Subset Improper Set Power set Universal set

3. Mathematical Induction (A certain theorem P(n) is true for all n N, provided

It is true for n=1 i.e P (1) is true. It is true for n=m+1 i.e n=m P(m) is true P(m+1) is true.

4. Relation: Let A and B be two set. A relation from a A to B is a subset of A X B and is denoted by R. So R A X B. 1. Properties of Relation

Reflexive : if (a ,a) A Symmetric : if (a,b) A (b,a)

Anti symmetric: if (a,b) A and (b,a) A a=b Asymmetric: if (a,b) A and (b,a) A Transitive: if (a,b)

A and (b,c) A (a,c) A

2. Equivalence Relation: If relation has following property

Reflexive Symmetric Transitive

5. Function: A subset of A X B is called A function or Mapping from A to B if to every element of A there is associated an unique element of B. Such that (x,y) f, i.e f A X B. Kinds of Mapping

Onto or Surjective : F(A)= B Into mapping: F(A) B One to one or Injective : F(x1)= F(x2) x1= x2 Many one mapping: F(x1) F(x2) x1 x2 Bijective: Mapping which is One-one and onto.

6. Characteristic Function Of a Set: Let A be any subset of the universal set U. Then the real valued Function A : U {0,1} defined by

A(x) :

1, i f, x A 0, i f, x A
Unit II

is called the Characteristic Function of the set.

Boolean algebra is a set A, supplied with two binary operations (called AND), (called OR), a unary operation (called NOT) and two distinct elements 0 (called zero) and 1 (called one), such that, for all elements a, b and c of set A, the following axioms hold:

associativity commutativity absorption distributivity complements


Truth Values and Truth table :

3. Negation : Logical Negation p F T p T F

4. Conjunction Logical Conjunction p F F T T 5. Disjunction Logical Disjunction p F F T T 6. Implication Logical Implication q F T F T pq F T T T q F T F T pq F F F T

p F F T T

q F T F T

pq T T F T


Lattics : An algebra is called a lattice if is a nonempty set, and are binary operations on , both and are idempotent, commutative, and associative, and they satisfy the absorption law. Let the poset be a lattice. Set and . Then the algebra is a lattice. Hasse Diagram:A graphical rendering of a partially ordered set displayed via the cover relation of the partially ordered set with an implied upward orientation. A point is drawn for each element of the poset, and line segments are drawn between these points according to the following two rules: 1. If in the poset, then the point corresponding to appears lower in the drawing than the point corresponding to . 2. The line segment between the points corresponding to any two elements and of the poset is included in the drawing iff covers or covers .
4. 5.

Partial order: A relation " " is a partial order on a set if it has: 1. Reflexivity: for all . 2. Antisymmetry: and implies . 3. Transitivity: and implies .

Totally Order Set: A total order (or "totally ordered set," or "linearly ordered set") is a set plus a relation on the set (called a total order) that satisfies the conditions for a partial order plus an additional condition known as the comparability condition. A relation is a total order on a set (" totally orders ") if the following properties hold. 1. Reflexivity: for all . 2. Antisymmetry: and implies . 3. Transitivity: and implies . 4. Comparability (trichotomy law): For any , either or .
6. 7.

Distributive Lattics: A lattice which satisfies the identities is said to be distributive.


Modular Lattic: A lattice which satisfies the identity is said to be modular. Unit III

Group : An algebraic structure (G,o), where g is a non-empty set and o is a binary operation defined on G is called a group if satisfied the following axiom: G1: Closure property: a G and b G aob G G2: Associatively property: (aob)oc=ao(boc) a,b,c G G3: Existence of Identity: e G, eoa = aoe = a, G a G, there exist a-1 a-1oa=e=ao a-1 G4: Existence of Inverse: a


Coset : Let G be a group on which the group operation is multiplication and H be a subgroup. Let a be any element of G then the set ,,

Ha= {ha:h H} is called a right coset of H in G generate by a. Ha= {ah:h H} is called a Left coset of H in G generate by a. 3. Permutation: A one one mapping of a finite set S onto itself is called Permutation. The number of element in the finite set S is called the degree of permutation. f:SS then fis a permutation of degree n. Let f(a1)=b1, f(an)=bn where { b1, b2, } = { a1, a2, }

A subgroup is a subset of group elements of a group that satisfies the four group requirements. It must therefore contain the identity element. " is a subgroup of " is written , or sometimes The order of any subgroup of a group of order must be a divisor of . A subgroup of a group that does not include the entire group itself is known as a proper subgroup, denoted or . Normal Subgroup: Let be a subgroup of a group . The similarity transformation of by a fixed element in not in always gives a subgroup. If

5. Semi group : is an algebraic structure consisting of a set S closed under an associative binary operation. In other words, a semigroup is an associative magma. The terminology is derived from the anterior notion of a group.The operation of a semigroup is most often denoted multiplicatively, that is, or simply xy denotes the result of applying the semigroup operation to the ordered pair (x, y).


Lagranges Theorem: states that for any finite group G, the order (number of elements) of every subgroup H of G divides the order of G. The left cosets are the equivalence classes of a certain equivalence relation on G and therefore form a partition of G. If we can show that all cosets of H have the same number of elements, then we are done, since H itself is a coset of H. Now, if aH and bH are two left cosets of H, we can define a map f : aH bH by setting f(x) = ba-1x. This map is bijective because its inverse is given by f -1(y) = ab-1y. This proof also shows that the quotient of the orders |G| / |H| is equal to the index [G:H] (the number of left cosets of H in G). If we write this statement as |G| = [G:H] |H|. A field is a commutative ring (F, +, *) such that 0 does not equal 1 and all elements of F except 0 have a multiplicative inverse. The following field axioms. Both + and * are associative


Both + and * are commutative Multiplication distributes over addition Zero is the additive identity, and one is the multiplicative identity, and these two constants are different

Existence of additive and multiplicative inverses 7. Ring: Formally, a ring is an Abelian group (R, +), together with a second binary operation * such that for all a, b and c in R, a * (b * c) = (a * b) * c a * (b + c) = (a * b) + (a * c) (a + b) * c = (a * c) + (b * c) also, if there exists a multiplicative identity in the ring, that is, an element e such that for all a in R, a*e=e*a=a then it is said to be a ring with unity. The number 1 is a common example of a unity. It is simple to show that any ring in which 1 = 0 must have just one element; any such ring is called a zero ring. 8. Integral domain is a commutative ring with an additive identity 0 and a multiplicative identity 1 such that 0 1, in which the product of any two non-zero elements is always non-zero (the zero-product property); that is, there are no zero divisors. Integral domains are generalizations of the integers and provide a natural setting for studying divisibility. An integral domain is a commutative domain.

9. Irreducible Polynomial: For any field F, the ring of polynomials with coefficients in F is denoted by F[x]. A polynomial p(x) in F[x] is called irreducible over F if it is non-constant and cannot be represented as the product of two or more non-constant polynomials from F[x].

Unit IV

Graph: A simple graph can be thought of as a triple G=(V,E,I), where V and E are disjoint finite sets and I is an incidence relation such that every element of E is incident with exactly two distinct elements of V and no two elements of E are incident to the same pair of elements of V. We call V the vertex set and E the edge set of G.


Degree: The degree, d(v), of a vertex v is the number of edges with which it is incident. Two vertices are adjacent if they are incident to a common edge. Walk: A walk is an alternating sequence of vertices and edges, with each edge being incident to the vertices immediately preceding and succeeding it in the sequence. A walk is closed if the initial vertex is also the terminal vertex. The length of a walk is the number of edges in the sequence defining the walk Trail: A trail is a walk with no repeated edges. Path: A path is a walk with no repeated vertices Circuit: Cycle/circuit is a closed trail with at least one edge and with no repeated vertices except that the initial vertex is the terminal vertex. Isomorphic Graph: Two graphs which contain the same number of graph vertices connected in the same way are said to be isomorphic. Formally, two graphs and with graph vertices are said to be isomorphic if there is a permutation of such that is in the set of graph edges iff is in the set of graph edges . Planner Graph: A planar graph is a graph that can be drawn so that no edges intersect (or that can be embedded) in the plane


4. 5. 6.




Euler's formula states that if a finite, connected, planar graph is drawn in the plane without any edge intersections, and v is the number of vertices, e is the number of edges and f is the number of faces (regions bounded by edges, including the outer, infinitely-large region), then ve+f=2


Bipartite Graph:

A bipartite graph, also called a bigraph, is a set of graph vertices decomposed into two disjoint sets such that no two graph vertices within the same set are adjacent. A bipartite graph is a special case of a kpartite graph with . Bipartite graphs are equivalent to two-colorable graphs, and a graph is bipartite iff all its cycles are of even length. 11. Tree: A graph is acyclic if it has no cycles. An acyclic graph is also called a forest. A tree is a connected, acyclic graph. Thus every connected component of a forest is a tree. A spanning tree of a graph G is a sub graph T of G which is a tree and which satisfies |V(T)|=V|(G)|. 12. Spanning Tree: A spanning tree of a connected graph G can also be defined as a maximal set of edges of G that contains no cycle, or as a minimal set of edges that connect all vertices 13. Eccentricity: Let G be a graph and v be a vertex of G. The eccentricity of the vertex v is the maximum distance from v to any vertex. That is, e(v)=max{d(v,w):w in V(G)}. 14. Center: The center of G is the set of vertices of eccentricity equal to the radius. Hence, center(G)={v in V(G):e(v)=radius(G)}. 15. Minimum spanning tree: A minimum spanning tree or minimum weight spanning tree is then a spanning tree with weight less than or equal to the weight of every other spanning tree. More generally, any undirected graph has a minimum spanning forest. 16. Kruskal's algorithm is an algorithm in graph theory that finds a minimum spanning tree for a connected weighted graph. 17. Prim's algorithm is an algorithm in graph theory that finds a minimum spanning tree for a connected weighted graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized

Unit V Discrete numeric functions(or numeric functions): The functions whose domain is the set of natural numbers and whose range is the set of real numbers. 2. The sum of two numeric functions is a numeric function whose value at r is equal to the sum of the values of the two numeric functions at r. 3. The product of two numeric functions is a numeric function whose value at r is equal to the product of the values of the two numeric functions at r. 4. For a numeric function (a0, a1, a2, ..., ar, ...), we define an infinite series 2 r a0 + a1z + a2z + ... + arz + ... which is called the generating function of the numeric function a. Let a be a numeric function and A(z) is its generating function. Let b be a numeric function such that r br = ar for some constant . We have B(z) = A(z). i Let A(z) be the generating function of a. It follows that z A(z) is the generating function of i S a for any positive integer i.

Let c = a * b. We have C(z) = A(z)B(z). cr = a0br + a1br-1 + a2br-2+ ... + ar-1b1+ arb0 2 r [zr] A(z)B(z) = (a0 + a1z + a2z + + arz + ) 2 r (b0 + b1z + b2z + + brz + ) = cr.

Solving Recurrence Relations: A linear homogeneous recurrence relation of degree k with constant coefficients is a recurrence relation of the form: an = c1an-1 + c2an-2 + + ckan-k, Where c1, c2, , ck are real numbers, and ck 0. A sequence satisfying such a recurrence relation is uniquely determined by the recurrence relation and the k initial conditions: a0 = C0, a1 = C1, a2 = C2, , ak-1 = Ck-1. 6. Characteristic equation Basically, when solving such recurrence relations, we try to find solutions of the form an = rn, where r is a constant. an = rn is a solution of the recurrence relation

an = c1an-1 + c2an-2 + + ckan-k if and only if rn = c1rn-1 + c2rn-2 + + ckrn-k.

Divide this equation by rn-k and subtract the right-hand side from the left:

rk - c1rk-1 - c2rk-2 - - ck-1r - ck = 0

This is called the characteristic equation of the recurrence relation.

Let c1 and c2 be real numbers with c2 0. Suppose that r2 c1r c2 = 0 has only one root r0. A sequence {an} is a solution of the recurrence relation an = c1an-1 + c2an-2 if and only if an = 1r0n + 2nr0n, for n = 0, 1, 2, , where 1 and 2 are constants.

8. Non-homogeneous : A non homogeneous linear recurrence has the form def.

a0tn + a1tn1 + ... + aktnk = f(n) where f(n) 0. There is no known general solution technique for non homogeneous linear
recurrences. So we will solve recurrences of the form

a0tn + a1tn1 + ... + aktnk = bnp(n)

where p(n) is a polynomial in n.

Homogeneous linear recurrenc : A homogeneous linear recurrence equation with constant coeffi-cients is an equation of the form. a0tn + a1tn1 + ... + aktnk = 0 Its linear because every term ti appears in the first power and term n. depends on a sequence of n i terms for an integer i. Its homogeneous because it equals 0. . and it has constant coefficients. (v) University Paper

(v) Model Test Paper MCA-102 Mathematical Foundation of Computer Science Time : 3 hr Note : Attempt all. And each question carry equal marks. Q.1 (a) Define irreflexive, symmetric, antisymmetiric and Asymmetric relations. Let A= {1,2,3,4} Given an example of a relation R in /A which is : (i) Neither symmetric nor anti symmetric. (ii) Antisymmetric and reflexive but not transitive. (iii) Transitive and reflexive but not antisymmetric. (i) Prove that by mathematical induction that 2n < n! For all n 4 (ii) If f: X Y is one one and onto, then prove that f-1 : Y X is also one one and onto. OR Define characteristic function of a set. Prove the following set identifies using characteristic function: A ( B C ) = ( A B) ( A C ) (i) ( A B) = A B (ii) If A, B, C and D are any four sets then prove that (i) A ( B C ) = ( A B ) ( A C ) (ii) ( A B) (C D) = ( A C ) ( B D) Define distributive and modular Lattices and show that the lattice show in following fig is modular but not distributive. 1 Max Marks: 100 Min Marks: 40



(d) Q2. (a)

a a

c 0



Show that the following are equivalences: (i) ( P Q) (~ P Q) Q (ii) P Q ~ Q ~ P Find the sum of product forms of the following Boolean expression in three variable x1, x2 and x3. (i) ( x1 x2 ) ( x1 x3 )

(ii) x1 x2


Show that the set B= {0,1} with two binary operation + and * and s unary operation, defined on B by the following operation tables is a Boolean algebra.
+ 0 1 0 0 1 1 1 1 0 1 * 0 0 0 1 0 1 a 0 1 a` 1 0


(a) (b) (c) (d) (e) (f)



Give an example, intersection of two subgroup of a group is a Subgroup. But union of two subgroup is not necessarily a subgroup. Prove that the composition of two semi group homomorphism is also a semi group homomorphism. Define field and prove that the set of complex number is a field with respect to ordinary addition and multiplication. or Prove that every cyclic group is an abelian group. Prove that the order of sub group of a finite group divides the order of group. Define group and show that if every element in a group is its own inverse then the group must be abelian. Define the following trems giving examples: i. Simple graph ii. Multigraph iii. In degree and out degree iv. Complete graph v. Isomphorhic graph vi. Connected graph Find the shortest path for the following graph using Dijkstre 's algorithm.


(c) (d)

or The maximum number of edges in a simple graph with n vertices is - n(n -1)/2. Find the minimal spanning tree the weighted graph given, ahead in, using Kruskal's algorithm and prisms algorithm..


(a) (b)

Use the characteristic equation to solve the following recurrences: (a) an = 5an1 6an2 for n _ 2 where a0 = 2, a1 = 5. (b) an = 4an1 3an2 for n _ 2 where a0 = 1, a1 = 2. Determine the numeric function corresponding to the generating function
a) b)

A(z) = A(z)=

2 1 4z 2
Z5 5 6Z + Z 2


Determine the generating function of the numeric function ar where

2 r , r 2 , a =

if r is even. If r is odd


Let a be a numeric function such that

ar =

2,0 r 3 r 2 ,r 4

Determine S 2 a and S-2 a .

(vi) List of Books 1.


J.P.Trembley & R.P.Manohar Discrete Mathematical Structure with applications to Computer Science. Kenneth H. Rosen-203 Discrete Math & its Applications 5th ed. K.A. Ross and C.R.B. Writht Discrete Mathematics . Bernard Kolman & Robert C. Busby Discrete Mathematical Structures for Computer Science. D.C Agarwal Mathematical Foundation Of Computer Science . Dr. R.S Agarwal Mathematical Foundation . Saums Series Discrete Mathematics . 6th ed.

3. 4. 5. 6.

Web References
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17.,min.html



Academic Details of Course

MCA-103 Programming and Problem Solving in C

(i) Course Course Name No. L (Hr s) T (Hr s) P (Hr s)

Course Content Theory Slot Practical slot

Practical Record/Assignme nt/Quiz/Presentati on

Total Marks

Theor y Marks 70

Test Marks 20

End Assign ment/ Sem/Prac Quiz tical Viva


Programmin g and Problem Solving in C



(ii) UNIT-I An overview: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.

Problem identification, analysis, design, coding, testing & debugging, implementation, modification & maintenance; algorithms & flowcharts; Characteristics of a good program - accuracy, simplicity, robustness, portability, minimum resource & time requirement, modularization; Rules/ conventions of coding, documentation, naming variables; Top down design; Bottom-up design.

UNIT-II 1. Fundamentals of C Programming: History of C; 2. Structure of a C Program; Data types; 3. Constant & Variable, naming variables; 4. Operators & expressions; 5. Control Constructs if-else, for, while, do-while; 6. Case switch statement; Arrays; 7. Formatted & unformatted I/O; 8. Type modifiers & storage classes; 9. Ternary operator; Type conversion & type casting; 10. Priority & associativity of operators. UNIT-III 1. Modular Programming: Functions; Arguments; 2. Return value; Parameter passing call by value, 3. call by reference; Return statement; 4. Scope, visibility and life-time rules for various types of variable, 5. static variable; Calling a function;

6. 7. 8. 9.

Recursion basics, comparison with iteration, types of recursion- direct, indirect, tree and tail recursion, when to avoid recursion, examples.

UNIT-IV 1. Advanced Programming Techniques: 2. Special constructs Break, 3. continue, exit(), goto & labels; 4. Pointers - & and * operators, 5. pointer expression, pointer arithmetic, 6. dynamic memory management functions like malloc(), 7. calloc(), free(); String; Pointer v/s array; 8. Pointer to pointer; Array of pointer & its limitation; 9. Function returning pointers; 10. Pointer to function, Function as parameter; 11. Structure basic, declaration, 12. membership operator, pointer to structure, 13. referential operator, self referential structures, 14. structure within structure, 15. array in structure, array of structures; 16. Union basic, declaration; Enumerated data type; 17. Typedef; command line arguments. UNIT-V 1. Miscellaneous Features: 2. File handling and related functions; 3. printf & scanf family;C 4. preprocessor basics, #Include, #define, #undef, 5. conditional compilation directive like #if, #else, #elif, #endif, #ifdef and #ifndef; 6. Variable argument list functions.


Lecture Plan with references

Subject Title Sub. Code Department

Programming and Problem Solving in C MCA-103 Department of MCA

Session : Semester Branch

Jul 2011Dec 2011 I MCA

Lect. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16.

Topics to be covered Problem identification, Analysis, design, implementation coding, testing & debugging,

Date of Completion

Remar ks Notes R3:8-11 Notes R3:50 Notes R3:126 R3:134 R1:3-5 R1:6-23 - 168 R1:10 R1:5060 R1:3848 R1:213 R1:316325 R1:174 R1:565

Modification & maintenance, algorithms & flowcharts. Characteristics of a good program Modularization; Rules/ conventions of coding, Documentation, naming variables Top down design, Bottom-up design Fundamentals of C Programming: History of C; Structure of a C Program; Data types; Constant & Variable, naming variables; Operators & expressions; Control Constructs if-else, for, while, do-while; Case switch statement Arrays Formatted & unformatted I/O; Type modifiers & storage classes; Ternary operator; Type conversion & type casting; Priority & associatively of operators.

17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39.

Modular Programming: Functions; Arguments; Return value; Parameter passing call by value, call by reference; Return statement; Scope, visibility and life-time rules for various types of variable, Static variable; Calling a function; Recursion basics, comparison with iteration Types of recursion- direct, indirect, tree and tail recursion. When to avoid recursion, examples. Advanced Programming Techniques Special constructs Break Continue, exit(), goto & labels Pointers - & and * operators, Pointer expression, pointer arithmetic, Dynamic memory management functions like malloc() Calloc(), free(); String; Pointer v/s array Pointer to pointer; Array of pointer & its limitation; Function returning pointers Pointer to function, Function as parameter; Structure basic, declaration, membership operator, pointer to structure Structure basic, declaration, Membership operator, pointer to structure, Structure within structure, array in structure, array of structures; Union basic, declaration; Enumerated data type Typedef; command line arguments Miscellaneous Features: Variable argument list functions

R1:121 R1:136140 R1:135 notes R1:140150 Net

Net R1:354 R2:322 R3(356) R1:344 -353 R2:4-9 R1:691 R2: 2791 R2:3343 R1:96 R1:141 R3:97 R1:290 R2:135 R1:290296 R3:204 R2:140 R1:299 Notes R1:517 R1:563 Notes R1:10-

256 40. 41. 42. 43. 44. 45. 46. File handling and related functions Printf & scanf family;C Preprocessor basics, #Include, #define, #undef conditional compilation directive like #if, #else, #elif, #endif, #ifdef and #ifndef Tutorial Tutorial R1:349361 R1:27316-689 R1:208 Notes R1:202208 Notes Notes

References Books R1:Kanetkar Y. Let us C, BPB. R2:Kanetkar Y.: Pointers in C , BPB R3:Kerninghan & Ritchie The C programming language, PHI

(iii) Unit wise blow up Unit-I 1. Problem identification: Steps in the Process What bothers you about some problem? Does it vary? Can you name the relevant concepts? Can you name the most important ones? Can you hypothesize an answer? Is your problem part of a larger problem? Can you state a relationship between variables Can you collect data and test that statement? 2. Analysis: The existing system is evaluated. Deficiencies are identified. This can be done by interviewing users of the system and consulting with support personnel. 3. Design: The proposed system is designed. Plans are laid out concerning the physical construction, hardware, operating systems, programming, communications, and security issues. 4. Coding: The new system is developed. The new components and programs must be obtained and installed. Users of the system must be trained in its use, and all aspects of performance must be tested. If necessary, adjustments must be made at this stage. 5. Testing & debugging: Testing of parts of software, especially where code by two different engineers must work together falls to the software engineer. Testing the developed system Write the test conditions test conditions are conducted by comparing expected outcomes to actual outcomes. If these differ, a bug is generated and a backtrack to the development stage must occur. 6. Implementation: Reducing a design to code may be the most obvious part of the software engineering job, but it is not necessarily the largest portion. 7. Modification & maintenance: Maintaining and enhancing software to cope with newly discovered problems or new requirements can take far more time than the initial development of the software. Not only may it be necessary to add code that does not fit the original design but just determining how software works at some point after it is completed may require significant effort by a software engineer. About of all software engineering work is maintenance, but this statistic can be misleading. A small part of that is fixing bugs. Most maintenance is extending systems to do new things, which in many ways can be considered new work. In comparison, about of all civil engineering, architecture, and construction work is maintenance in a similar way. 8. Algorithms & flowcharts: An Algorithm is just a detailed sequence of simple steps that are needed to solve a problem. A Flowchart is a graphical representation of an algorithm 9. Characteristics of a good program: Accuracy, simplicity, robustness, portability, minimum resource & time requirement, modularization

10. Documentation: An important (and often overlooked) task is documenting the internal design of software for the purpose of future maintenance and enhancement. Documentation is most important for external interfaces. 11. Naming variables: (1) Variable name must begin with Alphanumeric character or underscore character (_), followed by one or more Alphanumeric character (2) Don't put spaces on either side of the equal sign when assigning value to variable. For e.g. In following variable declaration there will be no error (3) Variables are case-sensitive, just like filename in Linux. (4) You can define NULL variable as follows (NULL variable is variable which has no value at the time of definition) (5) Do not use?,* etc, to name your variable names 12. Top down design: In a top-down approach an overview of the system is first formulated specifying but not detailing any first-level subsystems. Each subsystem is then refined in yet greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced to base elements. A top-down model is often specified with the assistance of "black boxes" that make it easier to manipulate. However, black boxes may fail to elucidate elementary mechanisms or be detailed enough to realistically validate the model. 13. Bottom-up design: In a bottom-up approach the individual base elements of the system are first specified in great detail. These elements are then linked together to form larger subsystems, which then in turn are linked, sometimes in many levels, until a complete top-level system is formed. This strategy often resembles a "seed" model, whereby the beginnings are small, but eventually grow in complexity and completeness. However, "organic strategies", may result in a tangle of elements and subsystems, developed in isolation, and subject to local optimization as opposed to meeting a global purpose. UNIT-II 1. History of C: The milestones in C's development as a language are listed below: UNIX developed c. 1969 -- DEC PDP-7 Assembly Language BCPL -- a user friendly OS providing powerful development tools developed from BCPL. Assembler tedious long and error prone. A new language ``B'' a second attempt. c. 1970. A totally new language ``C'' a successor to ``B''. c. 1971 By 1973 UNIX OS almost totally written in ``C''. 2. Structure of a C Program: A C program basically has the following form: Preprocessor Commands Type definitions Function prototypes: declare function types and variables passed to function. Variables Functions 3. Data types: C has the following simple data types:


Constant & Variable: C has four fundamental types of variables: int integer (PDP-11: 16 bits; H6070: 36 bits; IBM360: 32 bits) char one byte character (PDP-11, IBM360: 8 bits; H6070: 9 bits) float single-precision floating point double double-precision floating point All variables in a C program must be declared, although this can sometimes be done implicitly by context. Declarations must precede executable statements. The declaration int a, b, c, sum; Declares a, b, c, and sum to be integers. A constant is just an immediate, absolute value found in an expression. The simplest constants are decimal integers, e.g. 0, 1, 2, 123 . Occasionally it is useful to specify constants in base 8 or base 16 (octal or hexadecimal); this is done by prefixing an extra 0 (zero) for octal, or 0x for hexadecimal: the constants 100, 0144, and 0x64 all represent the same number. (If you're not using these non-decimal constants, just remember not to use any leading zeroes. If you accidentally write 0123 intending to get one hundred and twenty three, you'll get 83 instead, which is 123 base 8.) 5. Naming variables:Variable names have one to eight characters, chosen from A-Z, a-z, 0-9, and _, and start with a non-digit. Stylistically, it's much better to use only a single case and give functions and external variables names that are unique in the first six characters. (Function and external variable names are used by various assemblers, some of which are limited in the size and case of identifiers they can handle.) Furthermore, keywords and library functions may only be recognized in one case. 6. Operators & expressions: The following table shows the available arithmetic operators and the precedence each takes within an arithmetic expression. Arithmetic Operator ** * / + Representation Exponentiation Multiplication Division Addition or identity Subtraction or negation Precedence First Second Second Third Third

Logical Operators: Logical operators are usually used with conditional statements. The two basic logical operators are: && for logical AND, || for logical OR. 7. Control Constructs if-else, for, while, do-while: The C language includes a wide variety of powerful and flexible control statements. The most useful of these are described in the following. The if-else statement is used to carry out a logical test and then take one of two possible actions, depending on whether the outcome of the test is true or false. The else portion of the statement is optional. Thus, the simplest possible if-else statement takes the form: if (expression) statement The general form of an if-else statement, which includes the else clause, is if (expression) statement 1 else statement 2 If the expression has a non-zero value (i.e., if expression is true) then statement1 is executed. Otherwise, statement2 is executed. The while statement is used to carry out looping operations, in which a group of statements is executed repeatedly until some condition is satisfied. The general form of a while statement is while (expression) statement The statement is executed repeatedly, as long as the expression is nonzero (i.e., as long as expression is true). The statement can be either simple or compound When a loop is constructed using a while statement, the test for the continuation of the loop is carried out at the beginning of each pass. Sometimes, however, it is desirable to have a loop where the test for continuation takes place at the end of each pass. This can be accomplished by means of a do-while statement. The general form of a do-while statement is do statement while (expression); The general form of a for statement is for (expression 1; expression 2; expression 3) statement where expression1 is used to initialize some parameter (called an index) that controls the looping action, expression2 represents a condition that must be true for the loop to continue execution, and expression3 is used to alter the value of the parameter initially assigned by expression1. When a for statement is executed, expression2 is evaluated and tested at the beginning of each pass through the loop, whereas expression3 is evaluated at the end of each pass.

8. Case switch statement: The switch-case statement is a multi-way decision statement. The value of the expressions in a switch-case statement must be an ordinal type i.e. integer, char, short, long, etc. Float and double are not allowed. The syntax is: switch( expression ) { case constant-expression1: [case constant-expression2: [case constant-expression3:

statements1; statements2;] statements3;]

[default : statements4;] } The case statements and the default statement can occur in any order in the switch statement. The default clause is an optional clause that is matched if none of the constants in the case statements can be matched. 9. Arrays: In C, it is possible to make arrays whose elements are basic types. Thus we can make an array of 10 integers with the declaration int x[10]; The square brackets mean subscripting; parentheses are used only for function references. Array indexes begin at zero, so the elements of x are x[0], x[1], x[2], ..., x[9] If an array has n elements, the largest subscript is n-1. Multiple-dimension arrays are provided, though not much used above two dimensions. The declaration and use look like int name[10] [20]; n = name[i+j] [1] + name[k] [2]; Subscripts can be arbitrary integer expressions. Multi-dimension arrays are stored by row (opposite to Fortran), so the rightmost subscript varies fastest; name has 10 rows and 20 columns. 10. Type modifiers & storage classes: Type modifiers include: short, long, unsigned, signed. Not all combinations of types and modifiers are available. Storage classes include: auto, extern, register, static. The auto keyword places the specified variable into the stack area of memory. This is usually implicit in most variable declarations, e.g. int i; The extern keyword makes the specified variable access the variable of the same name from some other file. This is very useful for sharing variables in modular programs. The register keyword suggests to the compiler to place the particular variable in the fast register memory located directly on the CPU. Most compilers these days (like gcc) are so smart that suggesting registers could actually make your program slower. The static keyword is useful for extending the lifetime of a particular variable. If you declare a static variable inside a function, the variable remains even after the function call is long gone (the variable is placed in the alterable area of memory). The static keyword is overloaded. It is also used to declare variables to be private to a certain file only when declared with global variables. static can also be used with functions, making those functions visible only to the file itself. UNIT-III 1. Modular Programming: Modular programming is a programming paradigm that was first presented by Information & Systems Institute, Inc. at the National Symposium on Modular Programming in 1968. Modularity in computer science and programming is a principle, whereas Modular Programming was "a set of techniques for achieving modularity

2. Functions; Arguments; Return value; Almost all programming languages have some equivalent of the function. You may have met them under the alternative names subroutine or procedure. Some languages distinguish between functions which return variables and those which don't. C assumes that every function will return a value. If the programmer wants a return value, this is achieved using the return statement. If no return value is required, none should be used when calling the function. The c function tag lets you define a single return value and one or more input parameters passed to a function. As part of the function definition, you include the data type of the return value and input parameters. 3. Parameter passing call by value, call by reference; Call by Value Calling mechanism Arguments are evaluated for their values Local variables created for each parameter Values resulting from arguments copied to new parameter variables When function call ends, parameter variables are discarded During function execution, value of parameters may diverge from argument values (function does not affect arguments) Call by Reference Calling mechanism Variable locations for arguments determined Parameter names added to the location for each argument When function call ends, extra names are discarded During function call, changes to referenced variables persist even after function ends 4. Return statement: The form of the return statement is return ["(" <expr> ["," <expr>]* ")"] The return statement terminates execution of the containing procedure or iterator. There must be the same number of expressions as there are return result types listed in the routine's header, and their types must be subtypes of the corresponding listed types. (If return is used in an iterator, no results can be given; iterators do not have return result types.) The expressions (if any) are evaluated in an unspecified order, and the objects obtained become the results of the procedure. 5. Scope, visibility and life-time rules for various types of variable: The scope rules for modules define relationships among the names within the partitions. There are four choices. All local names visible globally. All external names visible locally. Only local explicitly exported names visible globally. Only external names explicitly imported are visible locally 6. Static variable: The static variable is not destroyed on exit from the function, instead its value is preserved, and becomes available again when the function is next called. Static variables are declared as local variables, but the declaration is preceded by the word static static int counter;

Static variables can be initialised as normal, the initialization is performed once only, when the program starts up. 7. Calling a function; The arguments passed to the functions have been passed by value. This means that when calling a function with parameters, what we have passed to the function were copies of their values but never the variables themselves. For example, suppose that we called our first function addition using the following code: int x=5, y=3, z; z = addition ( x , y ); What we did in this case was to call to function addition passing the values of x and y, i.e. 5 and 3 respectively, but not the variables x and y themselves.

This way, when the function addition is called, the value of its local variables a and b become 5 and 3 respectively, but any modification to either a or b within the function addition will not have any effect in the values of x and y outside it, because variables x and y were not themselves passed to the function, but only copies of their values at the moment the function was called. 8. Recursion basics: Recursion is the process a procedure goes through when one of the steps of the procedure involves rerunning the entire same procedure. A procedure that goes through recursion is said to be recursive. Something is also said to be recursive when it is the result of a recursive procedure. A procedure is a set of steps that are to be taken based on a set of rules. The running of a procedure involves actually following the rules and performing the steps. 9. Comparison with iteration: When writing code to do repetitive tasks, the two primary approaches are iteration and recursion. Generally you can use either one interchangeably, but potentially with different performance and complexity. A recursive function calls itself (possibly more than once), with different parameters, and defines an exit clause that is guaranteed to be reached. An iterative function includes a loop, which iterates a pre-determined number of times, or checks for an exit clause every time through. The advantages and disadvantages of the two are not always obvious, and you should really take it on a case-by-case basis. 1. Recursion may be slower, and use greater resources, because of the extra function calls. 2. Recursion may lead to simpler, shorter, easier-to-understand functions, especially for mathematicians who are comfortable with induction formulae. 10. Types of recursion- direct, indirect, tree and tail recursion: There are many ways to categorize a recursive function. Listed below are some of the most common. Linear Recursive A linear recursive function is a function that only makes a single call to itself each time the function runs (as opposed to one that would call itself multiple times during its execution). The factorial function is a good example of linear recursion. Another example of a linear recursive function would be one to compute the square root of a number using Newton's method (assume EPSILON to be a very small number close to 0):

double my_sqrt(double x, double a) { double difference = a*x-x; if (difference < 0.0) difference = -difference; if (difference < EPSILON) return(a); else return(my_sqrt(x,(a+x/a)/2.0)); } Tail recursive Tail recursion is a form of linear recursion. In tail recursion, the recursive call is the last thing the function does. Often, the value of the recursive call is returned. As such, tail recursive functions can often be easily implemented in an iterative manner; by taking out the recursive call and replacing it with a loop, the same effect can generally be achieved. In fact, a good compiler can recognize tail recursion and convert it to iteration in order to optimize the performance of the code. A good example of a tail recursive function is a function to compute the GCD, or Greatest Common Denominator, of two numbers: int gcd(int m, int n) { int r; if (m < n) return gcd(n,m); r = m%n; if (r == 0) return(n); else return(gcd(n,r)); } Binary Recursive Some recursive functions don't just have one call to themself, they have two (or more). Functions with two recursive calls are referred to as binary recursive functions. The mathematical combinations operation is a good example of a function that can quickly be implemented as a binary recursive function. The number of combinations, often represented as nCk where we are choosing n elements out of a set of k elements, can be implemented as follows: int choose(int n, int k) { if (k == 0 || n == k) return(1); else return(choose(n-1,k) + choose(n-1,k-1)); } Exponential recursion An exponential recursive function is one that, if you were to draw out a representation of all the function calls, would have an exponential number of calls in relation to the size of the data set (exponential meaning if there were n elements, there would be O(an) function calls where a is a positive number). A good example an exponentially recursive function is a function to compute all the permutations of a data set. Let's write a function to take an array of n integers and print out every permutation of it. void print_array(int arr[], int n)

{ int i; for(i=0; i<n; i) printf("%d ", arr[i]); printf("\n"); } void print_permutations(int arr[], int n, int i) { int j, swap; print_array(arr, n); for(j=i+1; j<n; j) { swap = arr[i]; arr[i] = arr[j]; arr[j] = swap; print_permutations(arr, n, i+1); swap = arr[i]; arr[i] = arr[j]; arr[j] = swap; } } To run this function on an array arr of length n, we'd do print_permutations(arr, n, 0) where the 0 tells it to start at the beginning of the array. Nested Recursion In nested recursion, one of the arguments to the recursive function is the recursive function itself! These functions tend to grow extremely fast. A good example is the classic mathematical function, "Ackerman's function. It grows very quickly (even for small values of x and y, Ackermann(x,y) is extremely large) and it cannot be computed with only definite iteration (a completely defined for() loop for example); it requires indefinite iteration (recursion, for example). Ackerman's function int ackerman(int m, int n) { if (m == 0) return(n+1); else if (n == 0) return(ackerman(m-1,1)); else return(ackerman(m-1,ackerman(m,n-1))); } Try computing ackerman(4,2) by hand... have fun! Mutual Recursion A recursive function doesn't necessarily need to call itself. Some recursive functions work in pairs or even larger groups. For example, function A calls function B which calls function C which in turn calls function A. A simple example of mutual recursion is a set of function to determine whether an integer is even or odd. How do we know if a number is even? Well, we know 0 is even. And we also know that if a number n is even, then n - 1 must be odd. How do we know if a number is odd? It's not even! int is_even(unsigned int n) { if (n==0) return 1; else return(is_odd(n-1)); }

int is_odd(unsigned int n) { return (!iseven(n)); } I told you recursion was powerful! Of course, this is just an illustration. The above situation isn't the best example of when we'd want to use recursion instead of iteration or a closed form solution. A more efficient set of function to determine whether an integer is even or odd would be the following: int is_even(unsigned int n) { if (n % 2 == 0) return 1; else return 0; } int is_odd(unsigned int n) { if (n % 2 != 0) return 1; else return 0; } UNIT-IV 1) Break: We often come across situations where we want to jump out of a loop instantly, without waiting to get back to the conditional test. The keyword break allows us to do this. When the keyword break is encountered inside any c loop, control automatically passes to the first statement. 2) Continue: In some programming situations we want to take the control to the beginning of the loop, by passing the statements inside the loop which have not yet been executed. The keyword continue allows us to do this. When the keyword continue is encountered inside any c loop, control automatically passes to the beginning of the loop. 3) exit (): exit() is used to terminate the process. 4) goto: A goto statement can cause program control to end up almost anywhere in the program, for reasons that are often hard to unravel. Goto can be avoided with good programming skills. 5) Pointers - & and * operators, Pointer expression, and Pointer arithmetic: The first things to do with pointers are to declare a pointer variable, set it to point somewhere, and finally manipulate the value that it points to. A simple pointer declaration looks like this: int *ip; This declaration looks like our earlier declarations, with one obvious difference: that asterisk. The asterisk means that ip, the variable we're declaring, is not of type int, but rather of type pointer-to-int. We may think of setting a pointer variable to point to another variable as a two-step process: first we generate a pointer to that other variable, then we assign this new pointer to the pointer variable.

Pointers (that is, pointer values) are generated with the ``address-of'' operator &, which we can also think of as the ``pointer-to'' operator. We demonstrate this by declaring (and initializing) an int variable i, and then setting ip to point to it: int i = 5; ip = &i; The assignment expression ip = &i; contains both parts of the ``two-step process'': &i generates a pointer to i, and the assignment operator assigns the new pointer to (that is, places it ``in'') the variable ip. Now ip ``points to'' i, which we can illustrate with this picture:

i is a variable of type int, so the value in its box is a number, 5. ip is a variable of type pointer-toint, so the ``value'' in its box is an arrow pointing at another box. Referring once again back to the ``two-step process'' for setting a pointer variable: the & operator draws us the arrowhead pointing at i's box, and the assignment operator =, with the pointer variable ip on its left, anchors the other end of the arrow in ip's box. We discover the value pointed to by a pointer using the ``contents-of'' operator, *. Placed in front of a pointer, the * operator accesses the value pointed to by that pointer. In other words, if ip is a pointer, then the expression *ip gives us whatever it is that's in the variable or location pointed to by ip. For example, we could write something like printf("%d\n", *ip); which would print 5, since ip points to i, and i is (at the moment) 5. (You may wonder how the asterisk * can be the pointer contents-of operator when it is also the multiplication operator. There is no ambiguity here: it is the multiplication operator when it sits between two variables, and it is the contents-of operator when it sits in front of a single variable. The situation is analogous to the minus sign: between two variables or expressions it's the subtraction operator, but in front of a single operator or expression it's the negation operator. Technical terms you may hear for these distinct roles are unary and binary: a binary operator applies to two operands, usually on either side of it, while a unary operator applies to a single operand.) The contents-of operator * does not merely fetch values through pointers; it can also set values through pointers. We can write something like *ip = 7; which means ``set whatever ip points to to 7.'' Again, the * tells us to go to the location pointed to by ip, but this time, the location isn't the one to fetch from--we're on the left-hand sign of an assignment operator, so *ip tells us the location to store to. (The situation is no different from array subscripting expressions such as a[3] which we've already seen appearing on both sides of assignments.) The result of the assignment *ip = 7 is that i's value is changed to 7, and the picture changes to:

If we called printf("%d\n", *ip) again, it would now print 7. At this point, you may be wondering why we're going through this rigamarole--if we wanted to set i to 7, why didn't we do it directly? We'll begin to explore that next, but first let's notice the

difference between changing a pointer (that is, changing what variable it points to) and changing the value at the location it points to. When we wrote *ip = 7, we changed the value pointed to by ip, but if we declare another variable j: int j = 3; and write ip = &j; we've changed ip itself. The picture now looks like this:

We have to be careful when we say that a pointer assignment changes ``what the pointer points to.'' Our earlier assignment *ip = 7; changed the value pointed to by ip, but this more recent assignment ip = &j; has changed what variable ip points to. It's true that ``what ip points to'' has changed, but this time, it has changed for a different reason. Neither i (which is still 7) nor j (which is still 3) has changed. (What has changed is ip's value.) If we again call printf("%d\n", *ip); this time it will print 3. We can also assign pointer values to other pointer variables. If we declare a second pointer variable: int *ip2; then we can say ip2 = ip; Now ip2 points where ip does; we've essentially made a ``copy'' of the arrow:

Now, if we set ip to point back to i again: ip = &i; the two arrows point to different places:

We can now see that the two assignments ip2 = ip; and *ip2 = *ip;

do two very different things. The first would make ip2 again point to where ip points (in other words, back to i again). The second would store, at the location pointed to by ip2, a copy of the value pointed to by ip; in other words (if ip and ip2 still point to i and j respectively) it would set j to i's value, or 7. It's important to keep very clear in your mind the distinction between a pointer and what it points to. The two are like apples and oranges (or perhaps oil and water); you can't mix them. You can't ``set ip to 5'' by writing something like ip = 5; /* WRONG */ 5 is an integer, but ip is a pointer. You probably wanted to ``set the value pointed to by ip to 5,'' which you express by writing *ip = 5; Similarly, you can't ``see what ip is'' by writing printf("%d\n", ip); /* WRONG */ Again, ip is a pointer-to-int, but %d expects an int. To print what ip points to, use printf("%d\n", *ip); Finally, a few more notes about pointer declarations. The * in a pointer declaration is related to, but different from, the contents-of operator *. After we declare a pointer variable int *ip; the expression ip = &i sets what ip points to (that is, which location it points to), while the expression *ip = 5 sets the value of the location pointed to by ip. On the other hand, if we declare a pointer variable and include an initializer: int *ip3 = &i; we're setting the initial value for ip3, which is where ip3 will point, so that initial value is a pointer. (In other words, the * in the declaration int *ip3 = &i; is not the contents-of operator, it's the indicator that ip3 is a pointer.) 6) Dynamic memory management functions like malloc (), calloc (), free (); In C, you allocate dynamic memory via the library functions malloc, calloc, and realloc. You must explicitly pass the size of the objects you're working with to these functions. The standard header <stdlib.h> declares four functions for using dynamic memory: 1. void *malloc(size_t siz) Returns a pointer to the first of siz bytes. Used for allocating single objects. 2. void *calloc(size_t nelems, size_t elem_size) Returns a pointer to nelems*elem_size bytes, initialized to zero. Used for allocating arrays of objects. 3. void *realloc(void *ptr, size_t siz) Used to expand or shrink a heap allocation. ptr must have originated from a previous call to malloc or calloc, except that if ptr is null, the result is the same as malloc(siz). If there is enough space for the new allocation, realloc copies the original data to the new location, then returns the new address. 4. void free(void *ptr) Makes previously allocated heap memory available for reuse. ptr must have been returned by a previous call to one of the above allocation functions. free(NULL) is a no-op. e of the objects you're working with to these functions. 7) String: In computing, C strings are character sequences stored as one-dimensional character arrays and terminated with a null character ('\0', called NUL in ASCII).

The common functions are described below: char *stpcpy (const char *dest,const char *src) -- Copy one string into another. int strcmp(const char *string1,const char *string2) - Compare string1 and string2 to determine alphabetic order. char *strcpy(const char *string1,const char *string2) -- Copy string2 to stringl. char *strerror(int errnum) -- Get error message corresponding to specified error number. int strlen(const char *string) -- Determine the length of a string. char *strncat(const char *string1, char *string2, size_t n) -- Append n characters from string2 to stringl. int strncmp(const char *string1, char *string2, size_t n) -- Compare first n characters of two strings. char *strncpy(const char *string1,const char *string2, size_t n) -- Copy first n characters of string2 to stringl . int strcasecmp(const char *s1, const char *s2) -- case insensitive version of strcmp(). int strncasecmp(const char *s1, const char *s2, int n) -- case insensitive version of strncmp(). 8) Pointer v/s array; An array is actually a pointer to the 0th element of the array. Dereferencing the array name will give the 0th element. This gives us a range of equivalent notations for array access. In the following examples, arr is an array.

There are some differences between arrays and pointers. The array is treated as a constant in the function where it is declared. This means that we can modify the values in the array, but not the array itself, so statements like arr ++ are illegal, but arr[n] ++ is legal. Since an array is like a pointer, we can pass an array to a function, and modify elements of that array without having to worry about referencing and de-referencing. Since the array is implemented as a hidden pointer, all the difficult stuff gets done automatically. A function which expects to be passed an array can declare that parameter in one of two ways. Either of these definitions is independent of the size of the array being passed. This is met most frequently in the case of character strings, which are implemented as an array of type char. This could be declared as char string[]; but is most frequently written as char *string; In the same way, the argument vector argv is an array of strings which can be supplied to function main. It can be declared as one of the following. 9) Pointer to pointer: When we use "pass by pointer" to pass a pointer to a function, only a copy of the pointer is passed to the function. We can say "pass by pointer" is passing a pointer using "pass by value". In most cases, this do not present a problem. But problem comes when you modify the pointer inside the function, instead of modifying the variable it points to by de-referencing, because when you modify the pointer, you are only modifying a copy of the pointer and the original pointer still remains unmodified. 10) Structure basic, declaration, Structures in C are similar to records in Pascal. For example:

struct gun { char name[50]; int magazinesize; float calibre; }; struct gun arnies; defines a new structure gun and makes arnies an instance of it. NOTE: that gun is a tag for the structure that serves as shorthand for future declarations. We now only need to say struct gun and the body of the structure is implied as we do to make the arnies variable. The tag is optional. Variables can also be declared between the } and ; of a struct declaration, i.e.: struct gun { char name[50]; int magazinesize; float calibre; } arnies; struct's can be pre-initialised at declaration: struct gun arnies={"Uzi",30,7}; which gives arnie a 7mm. Uzi with 30 rounds of ammunition. To access a member (or field) of a struct, C provides the . operator. For example, to give arnie more rounds of ammunition: arnies.magazineSize=100; 11) Union basic, declaration; A union is a variable which may hold (at different times) objects of different sizes and types. C uses the union statement to create unions, for example: union number { short shortnumber; long longnumber; double floatnumber; } anumber defines a union called number and an instance of it called anumber. number is a union tag and acts in the same way as a tag for a structure. Members can be accessed in the following way: printf("%ld n",anumber.longnumber); This clearly displays the value of longnumber 12) Enumerated data type: Enumerated types contain a list of constants that can be addressed in integer values. We can declare types and variables as follows. enum days {mon, tues, ..., sun} week; enum days week1, week2;

NOTE: As with arrays first enumerated name has index value 0. So mon has value 0, tues 1, and so on. week1 and week2 are variables. 13) Typedef; The use of typedef is a simple macro-like facility for declaring new names for data types, including user-defined data types. Typical examples are shown below :typedef long typedef double typedef struct { } BIGINT; REAL; point double x; double y; POINT;

14) Command line arguments: When a command is entered in a command window, it is executed by a command-line interpreter. The operation of a command interpreter is quite complex, but as a first approximation, it interpreter breaks up a command into words separated by spaces. The first word is treated as the name of a program. The interpreter searches for the program and starts it executing with the command words passed as arguments. A C program is executed by calling its main () function. The function is called with one argument that indicates how many words are in the command and another argument that is an array containing the command words. In order to access the command words, the main() function must have a prototype similar to the following. int main(int argc, char * argv[]) The names argc and argv are usually used for the parameters, but a programmer could use different names. The command words can be accessed as argv[0] through argv[argc - 1]. The program name is the first word on the command line, which is argv[0]. The command-line arguments are argv[1] through argv[argc - 1]. UNIT-V 1. File handling: We frequently use files for storing information which can be processed by our programs. In order to store information permanently and retrieve it we need to use files. Files are not only used for data. Our programs are also stored in files. The editor which you use to enter your program and save it, simply manipulates files for you. Specifying the file you wish to use is referred to as opening the file. When you open a file you must also specify what you wish to do with it i.e. Read from the file, Write to the file, or both. Because you may use a number of different files in your program, you must specify when reading or writing which file you wish to use. This is accomplished by using a variable called a file pointer. Every file you open has its own file pointer variable. When you wish to write to a file you specify the file by using its file pointer variable. You declare these file pointer variables as follows: FILE *fopen(), *fp1, *fp2, *fp3;

The variables fp1, fp2, fp3 are file pointers. You may use any name you wish 2. Related functions : File I/O :The Standard I/O Library provides similar routines for file I/O to those used for standard I/O. The routine getc(fp) is similar to getchar() and putc(c,fp) is similar to putchar(c). /* file.c: Display contents of a file on screen */ #include <stdio.h> void main() { FILE *fopen(), *fp; int c ; fp = fopen( prog.c, r ); c = getc( fp ) ; while ( c != EOF ) { putchar( c ); c = getc ( fp ); } fclose( fp ); } In this program, we open the file prog.c for reading. 3. Command Line Parameters: Arguments to main() Accessing the command line arguments is a very useful facility. It enables you to provide commands with arguments that the command can use e.g. the command % cat prog.c takes the argument "prog.c" and opens a file with that name, which it then displays. The command line argumenst include the command name itself so that in the above example, "cat" and "prog.c" are the command line arguments. The first argument i.e. "cat" is argument number zero, the next argument, "prog.c", is argument number one and so on. To access these arguments from within a C program, you pass parameters to the function main(). The use of arguments to main is a key feature of many C programs. The declaration of main looks like this: int main (int argc, char *argv[]) 4. printf : printf is the usual way of creating output to a screen from C. The declaration is int printf( const char * format, ... ); There must be a control string as the first argument, but it may be followed by any number of other arguments (including zero other arguments). printf is a member of a family of similar functions int sprintf( char * s, const char * format, ...); Writes to a string buffer supplied by the programmer. int fprintf( FILE * stream, const char * format, ...); writes to a file .

Format strings: In use, printf functions iterate along the control string, writing the characters to the output. When the iteration comes to a % character, it interprets the next few characters as a control. We know some of the simple controls %d %s output integer output a string

%x output an integer in hexadecimal (base 16) There are also some less commonly used conversion specifiers: %% output a literal % %p output a pointer (as a hex string on Solaris) %e %c output a double output a char as a letter

5. scanf : int scanf( const char * format, ...); and the rest of the family int sscanf( const char * src, const char * format, ...); int fscanf( FILE * src, const char * format, ...); scanf returns a useful value - the number of items successfully converted. The format string has the same layout as for printf. The function iterates along the format string: o if the format character is a simple character, expect that in the input. If it isn't there, return. o if the format character is a space, eat all the next whitespace characters, if any. o if the format character is %, convert from the input stream to that form. arguments for scanf Arguments for scanf must be pointers. This is a case where we are 'pushing' a value out of the function, rather than changing a local variable. The normal usage is char str[100]; int n, count ; count = scanf( " %d %s", &n, str) Conditional compilation:The #ifdef, #ifndef, #else, #elif and #endif directives can be used for conditional compilation. #define __WINDOWS__ #ifdef __WINDOWS__ #include <windows.h> #else #include <unistd.h> #endif

The first line defines a macro __WINDOWS__. The macro could be defined implicitly by the compiler, or specified on the compiler's command line, perhaps to control compilation of the program from a make file. 6. C preprocessor (cpp) is the preprocessor (Software that performs some preliminary processing on the input before it is processed by the main program) for the C programming language. In many C implementations, it is a separate program invoked by the compiler as the first part of translation. The preprocessor handles directives for source file inclusion (#include), macro definitions (#define), and conditional inclusion (#if). The language of preprocessor directives is not strictly specific to the grammar of C, so the C preprocessor can also be used independently to process other types of files.The transformations it makes on its input form the first four of C's so-called Phases of Translation. Though an implementation may choose to perform some or all phases simultaneously, it must behave as if it performed them one-by-one in order. 7. Conditional compilation directive like #if, #else, #elif, #endif, #ifdef and #ifndef: Conditional compilation directives allow you to delimit portions of code that are compiled if a condition is true. Syntax conditional-directive ::= #if constant-expression newline [group] #ifdef identifier newline [group] #ifndef identifier newline [group] #else newline [group] #elif constant-expression newline [group] #endif Description: You can use #if, #ifdef, or #ifndef to mark the beginning of the block of code that will only be compiled conditionally. An #else directive optionally sets aside an alternative group of statements. You mark the end of the block using an #endif directive. The structure of the conditional compilation directives can be shown using the #if directive. 8. Variable argument list functions.:To use a function with variable number of arguments, or more precisely, a function without a set number of arguments, you would use the cstdarg header file. There are four parts needed: va_list, which stores the list of arguments, va_start, which initializes the list, va_arg, which returns the next argument in the list, and va_end, which cleans up the variable argument list. Whenever a function is declared to have an indeterminate number of arguments, in place of the last argument you should place an ellipsis (which looks like '...'), so, int a_function ( int x, ... ); would tell the compiler the function should accept however many arguments that the programmer uses, as long as it is equal to at least one, the one being the first, x. va_list is like any other variable. For example, va_list a_list;

va_start is a macro which accepts two arguments, a va_list and the name of the variable that directly precedes the ellipsis (...). So, in the function a_function, to initialize a_list with va_start, you would write va_start ( a_list, x );

(iv) University paper

(v) Model paper MCA-103 PROGRAMMING AND PROBLEM SOLVING IN C Time: Three Hours Maximum Marks: 100 Minimum Pass Marks: 40

Note: Attempt any five questions. All questions carry equal marks. Q1. (a) (b) (c) Q2. (a) (b) Write an algorithm to calculate the factorial of a given number and also draw the flow chart. Differentiate between top-down and bottom up design. Explain characteristics of a good program. What are theory operations? Explain with example. Write a program that examines all the numbers from 1 to 999 displaying all those for which the sum of cubes of digits equal to the number itself. Equation 563 = 53 +63+ 33 Explain what do you mean by operation precedence. Write a program to sort the array of strings. Differentiate between break and continue statement. Explain various preprocessor directives with examples. Differentiate between macro and function. Also explain nested macros with example.

(c) Q3. (a) (b) Q4. (a) (b) Q5.

Write a program that concatenates two files, that is, append the contents of one file to the end of another and write the resulting third file. Explain the use of the following with example: (i) Malloc ( ) (ii) Calloc ( ) (iii) Size of operator


(iv) (v) (vi) (vii) (viii) (ix) (x) Q7. (a) (b) Q8.

free ( ) sscan f ( ) sprint f ( ) strlen ( ) static variable auto variable stremp ( ) Write a program that replaces two or more consecutive blanks is a string by a single blank. Explain call by value and call by reference.

Write short notes on any four of the following: (a) Structures (b) Enumerated data type (c) Storage classes (d) History of C (e) Control structures

(vi) List of Books 1. Kerninghan & Ritchie The C programming language, PHI 2. Schildt C:The Complete reference 4th ed TMH. 3. Cooper Mullish The Spirit of C, Jaico Publishing House, Delhi 4. Kanetkar Y. Let us C, BPB. 5. Kanetkar Y.: Pointers in C , BPB 6. Gottfried : Problem Solving in C, Schaum Series 7. Jones, Harrow Brooklish C Programming with Problem Solving, Wiley Dreamtech India.

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.


Academic Details of Course

MCA-104 Computer organization and Assembly Language Programming


Course Content Practical slot

Practical Record/Assignme nt/Quiz/Presentati on

Course Course Name No.

L (Hr s)

T (Hr s)

P (Hr s)

Theory Slot Theor y Marks 70 Test Marks 20

Total Marks

End Assign ment/ Sem/Prac Quiz tical Viva


Computer organization and Assembly Language Programmin g



UNIT-I 1. Representation of Information: Number systems 2. Integer and floating-point representation, 3. Character codes (ASCII, EBCDIC), 4. Error detection and correction codes: parity check code, cyclic redundancy code, Hamming code . 5. Basic Building Blocks: Boolean Algebra 6. Simplification of Boolean Function. 7. Combinational blocks: gates, multiplexers, decoders 8. Implementation of Boolean Function in form of gates etc. 9. Sequential building blocks: flip-flops, Registers: Buffer register, Right &Left Shift register, Bidirectional Shift register. 10. Counters : Ripple counter, Binary Counter,MOD-10 Counter, Ring Counter. 11. ALU, Random access memory etc. UNIT-II 1. Register Transfer Language and Micro-operations: concept of bus, data movement among registers. 2. A language to represent conditional data transfer, data movement from/to memory. 3. Design of simple Arithmetic & Logic Unit & Control Unit. 4. Arithmetic and logical operations Along with register transfer. 5. Timing in register transfer. UNIT-III 1. Architecture of a simple processor: A simple computer organization and instruction set. 2. Instruction formats. 3. Addressing modes. 4. Instruction cycle, instruction execution in terms of microinstructions.

5. 6. 7. 8.

Interrupt cycle ,concepts of interrupt and simple I/O organization. Synchronous & Asynchronous data transfer. Data Transfer Mode: Program Controlled, Interrupt driven. DMA(Direct Memory Access). implementation of processor using the building blocks.

UNIT-IV 1. Assembly Language programming: Pin Diagram of 8086. 2. Architecture of 8086. 3. Addressing Mode of 8086. 4. Detailed study of 8086/8088 assembly language, instruction set of 8086, loops and Comparisons, conditions and procedures. 5. Arithmetic operations in assembly language. 6. Simple Assembly Language program of 8086. 7. Illustrations using typical programs like: table search, subroutines, symbolic and numerical manipulations and I/O. UNIT-V 1. Memory organization: Secondary Memory, Primary Memory 2. Random access memory, Read Only memory basic cell of static and dynamic RAM, Building large memories using chips 3. Concept of segmentation & Paging. 4. Associative memory. 5. Cache memory organization. 6. Virtual memory organization.

(ii) Lecture Plan with References Subject Title Sub. Code Department Computer organization and Assembly Language Programming MCA-104 Department of MCA Session : Semester Branch Jul 2011 Dec 2011 I MCA

Lect. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18.

Topics to be covered Representation of Information Number Systems, Representation of Information Number Systems, Integer and floating-point representation, Character codes (ASCII, EBCDIC) Error detection Error correction codes : parity check code, Cyclic redundancy code, Hamming code Error correction codes : parity check code, Cyclic redundancy code, Hamming code Basic Building Blocks: Boolean Algebra Boolean Algebra continued.. Simplification of Boolean Function Combinational blocks: Gates Multiplexers Decoders, Implementation of Boolean Function in form of gates etc. Encoder, De-multiplexer Sequential building blocks: Flip-flops Flip-Flops continued Registers: Buffer register, Right & Left Shift register, Bidirectional Shift register.

Date of Completi on

Remarks R168 R1:68 R1:354 - 363 R1:73, R1:87 R1:87 R1:87 R1:87 R1:7-11 R1:7-11 R1:7-11 R1:4-6 R1:48-50 R1:43 R1:47 R1:22-R1:28 R1:22-R1:28 R1:50, R1:90 R1:50

19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41.

Counters: Ripple counter, Binary Counter, MOD-10 Counter Ring Counter Counters: Ripple counter, Binary Counter, MOD-10 Counter Ring Counter Designing of Counters ALU Random access memory etc. Register Transfer Language and Micro-operations: concept of Bus. Data movement among registers A language to represent conditional data transfer, data movement from/to memory Design of simple Arithmetic & Logic Unit & Control Unit Arithmetic and logical operations along with register transfer Timing in register transfer. Architecture of a simple processor: A simple computer organization and instruction set Instruction formats Addressing modes Instruction cycle, instruction execution in terms of microinstructions Interrupt cycle, concepts of interrupt and simple I/O organization Synchronous & Asynchronous data transfer Data Transfer Mode: Program Controlled, Interrupt driven DMA ( Direct Memory Access) Implementation of processor using the building blocks. Assembly Language programming: Pin Diagram of 8086, Architecture of 8086 Assembly Language programming: Pin Diagram of 8086, Architecture of 8086 Addressing Mode of 8086 Detailed study of 8086/8088 assembly language instruction set of 8086, loops and Comparisons, conditions and procedures Continued. Detailed study of 8086/8088 assembly language instruction set of 8086, loops and Comparisons,

R1:56-58 R1:56-58 R1:32-36 R1:116-117, R1:241-245 R1:60-61 R1:448-450 R1:94-114 R1:94-114 R1:116-117 R1:94-114 R1:136-138 R1:3 R1:255, R1:322 R1:260-263 R1:310-311 R1:153-156 R1:412-413 R1:396 R1:273-274 R1:415-420 R2-14 R3:167-168, R2-14 R3:167-168, R2:36-40 R2:40-65 R3:45-67 R2:40-65 R3:45-67

conditions and procedures 42. 43. 44. 45. 46. 47. 48. 49. 50. Arithmetic operations in assembly language Simple Assembly Language program of 8086 Illustrations using typical programs like: table search, subroutines, symbolic and numerical manipulations and I/O Memory organization. Secondary Memory, Primary Memory Random access memory, Read Only memory basic cell of static and dynamic RAM, Building Large memories Using chips Concept of segmentation & Paging Associative memory Cache memory organization Virtual memory organization R2:48-57 R1:65-67 R2:85-116 R3:65-67 R2:85-116 R3:45-67 R1:445-486 R1:448 R1:473-478 R1:456-462 R1:462-469 R1:469

References Books
R1: R2:

M. Morris Mano, Computer System Architecture, PHI, 3rd edition, 1993 A.K. Ray & K.M. Bhurchadi, Advanced Microprocessor & peripherals.

R3:Douglas V Hall, Microprocessors & interfacing Programming and Hardware, TMH

(iii) Unit-wise blow up UNIT-I


Number System:The binary system is the number system based on 2 symbols. Computer storage uses different means of recording information based on a series of electronic components that are able to hold a charge. At any time the component can be in one of two states, charged or not charged. Any data stored in a computer is stored as a series of binary values whether it is text, numbers, pictures, sound or video. Binary numbers use only the symbols 1 and 0.One binary digit is referred to as a bit. (Binary digit).A binary number can be described as a 'number to the base 2' e.g. 10112.The representation of values using 2 symbols follows the same rules as other number systems e.g. decimal, octal. Character codes :Digital computers represent and manipulate all forms of data as a collection of numerical values. In the case of text, alphanumerical and punctuation characters are each assigned a numerical equivalent, and this collection of character-to-number mappings is referred to as a code. the American Standards Association (ASA) began to consider the problem of defining a standard character code mapping that could be used to facilitate the representation, storing, and interchanging of textual data between different computers and peripheral devices. In 1963, the ASA which changed its name to the American National Standards Institute (ANSI) in 1969 announced the first version of the American Standard Code for Information Interchange (ASCII). However, this first version of the ASCII code (which is pronounced ask-key) left many things such as the lower case Latin letters undefined, and it wasn't until 1968 that the currently used ASCII standard of 96 printing characters and 32 control characters was defined: Error detection and correction codes: error correction and detection has great practical importance in maintaining data (information) integrity across noisy channels and less-than-reliable storage media. Error detection is the ability to detect errors caused by noise or other impairments during transmission from the transmitter to the receiver. Error correction has an additional feature that enables identification and correction of the errors. Error detection always precedes error correction. Combinational blocks: gates, multiplexers, decoders: A combinational circuit (block, component) consists of logic gates and processes n input signals The simplest combinational blocks are collections of gates. For example, an n-bit NAND gate: Flip-Flop: Flip-flops can be either simple or clocked. Simple flip-flops consist of two cross-coupled inverting elements transistors, or NAND, or NOR-gates perhaps augmented by some enable/disable (gating) mechanism. Clocked devices are specially designed for synchronous (timediscrete) systems and therefore ignore its inputs except at the transition of a dedicated clock signal (known as clocking, pulsing, or strobing). This causes the flip-flop to either change or retain its output signal based upon the values of the input signals at the transition. Some flip-flops change output on the rising edge of the clock, others on the falling edge.





Flip-flops can be further divided into types that have found common applicability in both asynchronous and clocked sequential systems: the SR ("set-reset"), D ("data"), T ("toggle"), and JK types are the common ones; all of which may be synthetisized from (most) other types by a few logic gates UNIT-II 1. Register Transfer and Microoperations Register Transfer Language Digital systems are composed of modules that are constructed from digital components, such as registers, decoders, arithmetic elements, and control logic The modules are interconnected with common data and control paths to form a digital computer system The operations executed on data stored in registers are called micro operations A micro operation is an elementary operation performed on the information stored in one or more registers Examples are shift, count, clear, and load Some of the digital components from before are registers that implement microoperations The internal hardware organization of a digital computer is best defined by specifying o The set of registers it contains and their functions o The sequence of micro operations performed on the binary information stored o The control that initiates the sequence of micro operations

Use symbols, rather than words, to specify the sequence of micro operations The symbolic notation used is called a register transfer language A programming language is a procedure for writing symbols to specify a given computational process Define symbols for various types of microoperations and describe associated hardware that can implement the microoperations

2. Register Transfer Designate computer registers by capital letters to denote its function The register that holds an address for the memory unit is called MAR The program counter register is called PC IR is the instruction register and R1 is a processor register The individual flip-flops in an n-bit register are numbered in sequence from 0 to n-1

3. Bus and Memory Transfers Rather than connecting wires between all registers, a common bus is used A bus structure consists of a set of common lines, one for each bit of a register Control signals determine which register is selected by the bus during each transfer

Multiplexers can be used to construct a common bus In general, a bys system will multiplex k registers of n bits each to produce an n-line common bus This requires n multiplexers one for each bit The size of each multiplexer must be k x 1 The number of select lines required is log k To transfer information from the bus to a register, the bus lines are connected to the inputs of all destination registers and the corresponding load control line must be activated Rather than listing each step as BUS C, R1 BUS, use R1 C, since the bus is implied Multiplexers select the source register whose binary information is then placed on the bus The select lines are connected to the selection inputs of the multiplexers and choose the bits of one register. UNIT-III

1. Architecture of a basic processor: Modern processors are rich in features that lead to an overall high execution speed for a given application. An analysis of their architectures is generally complex; each feature has an effect dependent on the others and it is difficult to quantify the benefits of the feature in isolation. In this dissertation, we investigate processor architectures for next generation systems; the obvious starting point is to study and evaluate previous architectural proposals. We start from a very basic processor, and then refine it by systematically adding new features. By this means, we hope to simplify the presentation and qualitative analysis of each feature. Our simple processor follows the single-issue RISC strategy: instructions are fetched one by one from memory and they specify either an operation on data stored in the processor register-file or an I/O operation on external memory. It is a single-stage processor: instructions are fetched only when previous ones have been completed. The architecture for such a machine is straightforward. Instruction Format: An instruction is one, two, or three half words in length and must be located in main storage on an integral half word boundary. Each instruction is in one of five basic formats: RR, RX, RS, SI, and S. Some instructions contain fields that vary slightly from the basic format, and in some instructions the operation performed does not follow the general rules stated in this section. All such exceptions are explicitly identified in the individual instruction descriptions. The format names express, in general terms, the classes of operands which participate in the operation: RR denotes a register-to-register operation; RX. a register-and-indexed-storage operation; RS, a register-and-storage operation; SI, a storage-and- immediate operation. The S format denotes an operation using all implied operand and storage.

The first byte and, in the S format, the first two bytes of an instruction contain the operation code (op code). For some instructions in the S format, all or a portion of the second byte is ignored. The first two bits of the operation code specify the length and format of an instruction 2. DMA: Direct memory access is system that can control the memory system without using the CPU. On a specified stimulus, the module will move data from one memory location or region to another memory location or region. While it is limited in its flexibility, there are many situations where automated memory access is much faster than using the CPU to manage the transfers. Systems like the ADC, DAC and PWM capturing all require frequent and regular movements of memory out of their respective systems. The DMA can be configured to handle moving the collected data out of the peripheral module and into more useful memory locations (like arrays). Only memory can be accessed this way, but most peripheral systems, data registers, and control registers are accessed as if they were memory. The DMA is intended to be used in low power mode because it uses the same memory bus as the CPU and only one or the other can use the memory at the same time. The DMA system is organized into three largely independent parts. Though the three compete for the same memory bus, they have can be configured for independent triggers and memory regions.


1. Assembly Language Programming: Unlike the other programming languages catalogued here, assembly language is not a single language, but rather a group of languages. Each processor family (and sometimes individual processors within a processor family) has its own assembly language. In contrast to high level languages, data structures and program structures in assembly language are created by directly implementing them on the underlying hardware. So, instead of cataloguing the data structures and program structures that can be built (in assembly language you can build any structures you so desire, including new structures nobody else has ever created), we will compare and contrast the hardware capabilities of various processor families. This web page does not attempt to teach how to program in assembly language. Because of the close relationship between assembly languages and the underlying hardware, this web page will discuss hardware implementation as well as software. If you arent fairly familiar with how computers work, you should probably first read basics of computer hardware or this page wont make any sense at all.

Comparison of assembly and high level languages: Assembly languages are close to a one to one correspondence between symbolic instructions and executable machine codes. Assembly languages also include directives to the assembler, directives to the linker, directives for organizing data space, and macros. Macros can be used to combine several assembly language instructions into a high level language-like construct (as well as other purposes). There are cases where a symbolic instruction is translated into more than one machine instruction. But in general, symbolic assembly language instructions correspond to individual executable machine instructions. High level languages are abstract. Typically a single high level instruction is translated into several (sometimes dozens or in rare cases even hundreds) executable machine language instructions. Some early high level languages had a close correspondence between high level instructions and machine language instructions. For example, most of the early COBOL instructions translated into a very obvious and small set of machine instructions. The trend over time has been for high level languages to increase in abstraction. Modern object oriented programming languages are highly abstract (although, interestingly, some key object oriented programming constructs do translate into a very compact set of machine instructions). Assembly language is much harder to program than high level languages. The programmer must pay attention to far more detail and must have an intimate knowledge of the processor in use. But high quality hand crafted assembly language programs can run much faster and use much less memory and other resources than a similar program written in a high level language. Speed increases of two to 20 times faster are fairly common, and increases of hundreds of times faster are occassionally possible. Assembly language programming also gives direct access to key machine features essential for implementing certain kinds of low level routines, such as an operating system kernel or microkernel, device drivers, and machine control. 2. Availability: Assemblers are available for just about every processor ever made. Native assemblers produce object code on the same hardware that the object code will run on. Cross assemblers produce object code on different hardware that the object code will run on. Structure: format: free form or column (depends on the assembly language) Nature: procedural language with one to one correspondence between language mnemonics and executable machine instructions. Assembler languages occupy a unique place in the computing world. Since most assembler-language statements are symbolic of individual machine-language instructions, the assembler-language programmer has the full power of the computer at his disposal in a way that users of other languages do not. Perhaps the most glaring difference among the three types of languages [high level, assembly, and machine] is that as we move from high-level languages to lower levels, the code gets harder to read (with understanding). The major advantages of high-level languages are that they are easy to read and are machine independent. The instructions are written in a combination of English and ordinary mathematical notation, and programs can be run with minor, if any, changes on different computers

The second most visible difference among the different types of languages is that several lines of assembly language are needed to encode one line of a high-level language program.

Kinds of processors: Processors can broadly be divided into the categories of: CISC, RISC, hybrid, and special purpose. Complex Instruction Set Computers (CISC) have a large instruction set, with hardware support for a wide variety of operations. In scientific, engineering, and mathematical operations with hand coded assembly language (and some business applications with hand coded assembly language), CISC processors usually perform the most work in the shortest time. Reduced Instruction Set Computers (RISC) have a small, compact instruction set. In most business applications and in programs created by compilers from high level language source, RISC processors usually perform the most work in the shortest time. Hybrid processors are some combination of CISC and RISC approaches, attempting to balance the advantages of each approach. Special purpose processors are optimized to perform specific functions. Digital signal processors and various kinds of co-processors are the most common kinds of special purpose processors

UNIT-V Computer-memory: Although memory is technically any form of electronic storage, it is used most often to identify fast, temporary forms of storage. If your computer's CPU had to constantly access the hard drive to retrieve every piece of data it needs, it would operate very slowly. When the information is kept in memory, the CPU can access it much more quickly. Most forms of memory are intended to store data temporarily.

As you can see in the diagram above, the CPU accesses memory according to a distinct hierarchy. Whether it comes from permanent storage (the hard drive) or input (the keyboard), most data goes in random access memory (RAM) first. The CPU then stores pieces of data it will need to access, often in a cache, and maintains certain special instructions in the register All of the components in your computer, such as the CPU, the hard drive and the operating system, work together as a team, and memory is one of the most essential parts of this team. From the moment you turn your computer on until the time you shut it down, your CPU is constantly using memory. Let's take a look at a typical scenario:


You turn the computer on.

The computer loads data from read-only memory (ROM) and performs a power-on self-test (POST) to make sure all the major components are functioning properly. As part of this test, the memory controller checks all of the memory addresses with a quick read/write operation to ensure that there are no errors in the memory chips. Read/write means that data is written to a bit and then read from that bit. The computer loads the basic input/output system (BIOS) from ROM. The BIOS provides the most basic information about storage devices, boot sequence, security, Plug and Play (auto device recognition) capability and a few other items. The computer loads the operating system (OS) from the hard drive into the system's RAM. Generally, the critical parts of the operating system are maintained in RAM as long as the computer is on. This allows the CPU to have immediate access to the operating system, which enhances the performance and functionality of the overall system. When you open an application, it is loaded into RAM. To conserve RAM usage, many applications load only the essential parts of the program initially and then load other pieces as needed. After an application is loaded, any files that are opened for use in that application are loaded into RAM. When you save a file and close the application, the file is written to the specified storage device, and then it and the application are purged from RAM.

(iv)University Paper

M. C. A. (First Semester) EXAMINATION, Jan./Feb., 2007 (New Course) COMPUTER ORGANIZATION AND ASSEMBLY PROGRAMMING [MCA-104(N)] Time: Three Hours Maximum Marks: 100 Minimum Pass Marks: 40 Note: Attempt any one question from each Unit. All questions carry equal marks. Unit-I 1. (a) Convert the following ? (i) (11010.11)2, (736.5)8 to decimal. 4 10 2 4 (ii) F3A7C2 hexadecimal number to binary and octal. (iii) 225.255 decimal number to octal and hexadecimal. (b) Explain the following (in brief) : (i) Ripple counter (ii) Binary counter (iii) Shift registers Or (a) Obtain 9's complement to the following eight-digit decimal number: (i) 00000000 (ii) 90997 4
(b) (c)


Show this subtraction in binary form: 4710 - 2310.

3 4 9

Show the binary addition of (750)10 and (538)10 using 16 bit numbers. (i) Parity check code (ii) Cyclic redundancy code

(d) Explain the following : (iii) Hamming code

Unit-II (a) Explain the register transfer micro-operations as: 10 (i) (b) parallel transfer (ii) Bus transfer (iii) Memory transfer (iv) Serial transfer A digital system has 16 registers each with 32 bits. It is necessary to provide parallel data transfer from each register to each other register: 10 (i) (ii)

How many lines are needed for direct parallel transfer? How many lines are needed for transfer along common bus?

Or Explain half adder and full adder. How a full adder can be converted to full s Subtractor? 10

(b) The 8 bit registers AR, BR, CR and DR initially have the following values: AR= 10101101 BR = 1000 1000 CR = 1011 1010 DR= 11101010 Determine the 8-bit values in each register after the execution of the following sequence of micro-operations: AR<-AR + BR CR <.- CR DR (AND) AR <- AR - CR AR <- AR BR (exclusive or) Unit-III 3. (a) Explain the examples : (i) Register (ii) Register indirect (iii) Immediate (iv) Direct (v) Indirect 10 A = (B +C) * (D + E) (b) Write code to implement the expression: following addressing modes with 10 10

On 3 -, 2 -, 1 - and 0 - address and general register machines. Or (a) Discuss asynchronous data transfer. Also explain the terms: (i) Strobe control (ii) Handshaking 10 (iii) Cycle stealing (b) Differentiate between the following: (i) (ii) Program controlled transfer and DMA transfer Interrupt initiated transfer and data transfer under program control UNIT-IV 4. (a) Explain the architecture of 8086 microprocessor. Explain the function of registers available in 8086. 10 (b) Write an 8086 assembly language program for transferring a block of 255 numbers to another block. with suitable comments. 10 Or (a)



Draw pin diagram of 8086.

(ii) Explain addressing modes of 8086. 10 Write an assembly language program to add three nos. 25h, 12h and 15h and take average of them. 10 Unit--V

5. (a) Explain the working of associative memory. 10 (b) An address space is specified by 16 bits and corresponding memory space by 12 bits : 10 (i) How many words are there in address space and memory space ? (ii) If a page consists of 256 words, how many pages and blocks are there in system? Or (a) Explain memory hierarchy and explain write through and write back method with respect to cache memory. 10 The access time of a cache memory is 100 ns and that of main memory is 1000 ns. It is estimated that 80% memory requests are for read and remaining 20% for write. Hit ratio for read is 0.9. A write through procedure is used. What is the average access time of the system considering only read cycles? 10

(v) Model Paper

M. C. A. (I Semester)
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE PROGRAMMING Time : Three Hours Maximum Marks : 100 Minimum Pass Marks : 40 Note: Attempt any one question from each Unit. All questions carry equal marks. UNIT-I 1. (a) Simplify the following expression using Boolean algebra: (i) A B + A ( C D + C D ) (ii) (B C + A D ) ( A B + C D ) (b) Convert the following ? (i) (10011.111)2, (872.5)8 to decimal. (ii) 3A57B2 hexadecimal number to binary and octal. (iii) 225.255 decimal number to octal and hexadecimal. OR (a) Design 4 : 16 Decoder using 2 : 4 Decoders. (b) Explain working of Master-Slave J-K flip-flop. Justify using tuning diagram.

UNIT-II 2. (a) Explain register transfer languages. Show the block diagram of hardware that implements the following register transfer statement. Y T2 : R2 <- R1, R1 <- R2 (b) Register Rl contents are 10110110 and R2 contents are 11001101. Write final contents of all the registers after performing the following micro operations: (i) (ii) Shift left on Rl, R2 then Rotate left on Rl, R2 then

(iii) R3 <- R1 + R2 then (iv) Shift Right R3 OR

(a) The 8 bit registers AR, BR, CR and DR initially have the following values : AR= 11110010 BR = 11111111 CR = 10111001 DR= 11101010 Determine the 8-bit values in each register after the execution of the following sequence of micro-operations : AR<-AR + BR CR <- CR DR (AND) BR <- BR+1 AR <- AR - CR (b) Explain Arithmetic micro operation. What are various categories in which micro operation can be classified? UNIT-III 3. (a) Explain the following addressing modes with examples: (i) Direct (ii) Indirect (iii) Relative (iv) Indexed addressing (v) Base register addressing mode (b) An instruction is stored at location 300 with its address field, at locations 301. The address field has value 400. A processor register Rl contains the number 200. Evaluate; the effective address if the addressing mode of the instruction is (i) direct (ii) immediate (iii) relative (iv) register indirect (v) index with Rl as index register. OR (a) Differentiate between the following: (i) Program controlled transfer and DMA transfer. (ii) Interrupt initiated transfer and data transfer under program control (b) Explain instruction cycle. What are the various phases of each instruction basic computer? Also explain basic computer instruction format. cycle in

UNIT-IV 4.(a) Explain various addressing modes of 8086 (b) Write an 8086 Assembly language program to find the larger of two numbers. OR (a) Draw & Explain architecture of 8086. (b) Write an ALP to arrange 10 numbers in ascending. UNIT-V 5.(a) Explain virtual memory. Draw a mapping table for mapping a virtual address of 20 bits to physical address of 15 bits. (b) Describe in words and by means of block diagram how matched word can be read out from an associative memory. OR (a) An address space is specified by 16 bits and corresponding memory space by 12 bits : 10 (i) How many words are there in address space and memory space ? (ii) If a page consists of 256 words, how many pages and blocks are there in system (b) Explain the working of cache memory.


List of Books

M. Morris Mano, Computer System Architecture, PHI, 3rd edition, 1993

2. Govindarajalu Computer Architecture & Organisation. 3. Liu and Gibson, 8086/8088 Micro processor Assembly Language. 4. M.Mano Digital Logic & Computer Design 5. Malvino, Digital Computer Electronics.

Web References
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.


Academic Details of Course

MCA-105 Communication Skills

(i) Course Course Name No. L (Hr s) T (Hr s) P (Hr s)

Course Contents Practical slot

Practical Record/Assignme nt/Quiz/Presentati on

Theory Slot Theor y Marks 70 Test Marks 20 (ii)

Total Marks

End Assign ment/ Sem/Prac Quiz tical Viva


Communicati on skills



UNIT I Communication: 1. Meaning and process of communication, 2. Importance of effective communication, 3. Communication situation, 4. Barriers to communication. 5. Objective of communication, 6. types of communication, 7. principles of communication, 8. Essentials of effective communication. UNIT II Media of Communication: 1. Written, oral, 2. face-to-face, 3. visual, audio-Visual, 4. merits and demerits of written and oral communication. UNIT III Communication Skills: 1. Developing communication skills; 2. Listening; Speaking; 3. Reading Writing ( Oral & Written). 4. Body language; Utility of aids in Communication. UNIT IV Spoken Skills: 1. Preparing for oral presentation, 2. conducting presentations; 3. Debates; Seminar; Speeches; Lectures; 4. Interviews; Telephonic Conversation; 5. Negotiations; Group Discussions. UNIT V Written Skills: 1. Preparing of bio-data, 2. seminar, paper, bibliography, and official correspondence;

3. 4. 5. 6.

Mechanics of Writing; Formal & Informal Writings, letters; paragraphing, precise, report writing, technical reports, length of written reports, organizing reports, writing technical reports; Creative writing;

(ii) Lecture Plan with references Subject Title Sub. Code Department Lect. Communication Skill MCA-105 Department of MCA Topics to be covered Session Semester Branch Jul 2011Dec 2011 I MCA Remarks MCA Sec B R1: EC 1-3 R1: EC 4-5 R1: EC 2 R1: EC 53-61 R1: EC 7-20 R1: EC 36-51 R1: EC 63-75 R1: TC 1-26 R1: EC 23-31 R1: OC 66-67 R1: EC 1-13 Notes R2: 460 -477 R2: 478 -479 + Exercises 15. 16. 17. 18. 19. 20. 21. 22. Debates, Seminar, Speeches , Lectures Interviews Telephonic Conversation/ Negotiation Group Discussion Preparing for biodata Seminar, paper, bibliography Official correspondence (Letter writing) Mechanics of writing Exercise/Note R1: OC 26-36 Notes ( R1: OC 48) R2: 36-66 R2: 495 -520 Notes R2: 175 -283 R1: TC 27-30

Date of Completion MCA Sec A

1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.

Meaning & process of communication Importance of effective communication Communication situation Barriers to communication Objectives of communication Types of communication Principles of communication Essentials of effective communication Media of communication Developing communication skills Listening Speaking, Reading, Writing Body language / Utility of aids Preparing for oral presentation Conducting presentation

23. 24. 25. 26 27. 28. 29. 30.

Paragraphing & Prcis Report writing Technical Reports Length of written repots Organizing Reports Creative writing Common errors in language Revision

R1: PW 1-27 R2: 319 -417 R2: 418 -445 R1: WC 14-37 R1: WC 14-37 Notes Notes

References Book R1: R2: Essentials of Business Communication: Rajendra Pal & IS Korlahalli Business Communication & Product: Mary E. Guffey

(iii) Unit wise blow up Unit I


Process of communication: It involves sender, receiver, and medium and can be one-way & two-way process. Two ways process is effective as it involves feedback by the receiver. Importance of Communication: In any organization, communication is essential for enhanced production, efficient working of managers to promote human relations, to provide TQM, for perfect marketing, to boast morale of employees, to generate spirit of understanding and for external communication. Communication Situation: involves sender, Receiver understanding & feedback. Communication situation cannot happen in the absence of any four elements.



4. Barriers to communication Physical (Noise time distance) Semantic (language related) Organizational (Strict rules of regulations, Non conduction of meeting) Psychological (Attitude & emotions poor retention)

5. Objective of Communication Information Counseling Advice Order Suggestion Persuasion Motivation Education Reprimand Negotiation

6. Type of Communication Formal Vertical Horizontal Consensus Informal/Grapevine Single Gossip Probability

7. Principle of Communication Thought Clarity Expression Concise Complete Correct Courteous

8. Essentials of Communication Should process strong feed back system. Information should be timely dispersed. Proper media should be used. Open communication should be encouraged. Suitable language & pictures should be used. Effective listening should be practiced. Unit II 1. Media of Communication Oral Communication Face to face communication Telephone Conversation Radio broadcasts Meetings Conferences Interviews G.D Public speaking Oral Communication provides immediate feedback Written Communication Letters Memos

Circulars Manuals Reports Notices Forms Questionnaires

Visual & audio Visual Communication Telecasts , short films, video tapes ,AV communication is best suited for mass education & publicity. It is useful for illiterates. Message gets easily stored in the mind of the receiver. Unit - III 1. Developing Communication Skills Skills of listening, speaking, reading, writing have been stressed in the unit. Tips to improve them are suggested in detail body language or nonverbal communication has also been discussed in the unit- Eye contact gustiness & postine give added supplementary inputs to the verbal communication. So its utility cannot under estimate. Aids used in presentation can be of different types with ranging advantages. Unit - IV 1. Spoken skills Oral presentation its objectives & conduction are dealt in the unit. Main points of effective presentation cover clarity of thought, use of proper language, proper eyecontact, tone, nature of audience, btyle of addressing & correct use of AV aids. Forms of oral presentation are : 2. Interview Defined as a formal meeting between two people to discuss important matter the word to made of 2 words. Inter + View = meaning between + knowing.

Speech, Seminar, Conference

Objectives of interview can be evaluation of the applicant, appraisal of existing employees performance, repumanding the employees against complaint or counselling the employees having trouble, orienting fresh employees.

4. Types of interviews Selection

Appraisal Repumand Orientation Exit Grievance Counselling 2. Telephonic Conversation Tip to remember during telephonic conversation. Announce name clearly & inform the purpose. Dont chew gum or tobacco Use a cheerful tone. Seek active feedback from the receiver Note message accurately, if jotting down details. Negotiation takes place in groups which do not agree & with the help of mediator, a consensus is tried to reach in them. 4. Group Discussion In a group discussion remember to : Divide the topics to logical & well balanced parts. Anticipate questions that are likely to be directed against you. Unless you are the first speaker refer to the previous speaker. Direct your speech to a larger audience. Stay within your time limit. Dont loose goal. 5. Discussion Skills Take Initiative Listen actively Have knowledge of subject matter Communication Be short & simple & deliberate & slow


Unit V Bio-data indicates the applicants personal details, educational qualification, specialization, experience, reference & other relevant information. 1. Sections of Resume 1. Heading 2. Body 3. Conclusion Resume can be functional thematic, skill based or chronological. 2. In a resume take care of the following points : Sufficient readability White space Special formal Tense writing style Special typography Reverse chronological order Consistency of phrasing & Punctuation Grammar, spelling & usage References of the known gazette persons.

Paper presentation & seminar tips have to be studied in detail. Bibliography is a list of books, pewodicals & other reference sources which are used or consulted by the author before or during the preparation of a report. 3. Bibliography should contain Name of the author & initials Title of the publication Publishers name & address Editors Year of publication


Official correspondence: Comprise Letters, memos, circulars, notices, press release & reports.

5. Business letters are made up of : Senders address Date Reference No. Receivers address Salutation Body Close

Letters can be calling & sending quotations placing an order, complaint, letter, adjustment letter & applications. General tips for writing these letters and practical solved letters are dealt in detail
Reports can be Formal Informal




oral Informative Interpretive




Interpretive Special Routine


Routine Special Routine





Good reports must be clear, correct, unbiased with accurate facts and scientific in approach. Routine reports have a usual format & can be confidential, Progress, Inventory, Medical report where as special reports are written due to some unforeseen circumstances like accident, theft etc. Scientific or Interpretive reports can be divided into three parts. I. Front Matter Cover Frontispiece

Forwarding letter Certificate of declaration Preface Acknowledgment Contents


Middle Matter Introduction Methodology Results Discussion Recommendation Back Matter Index Glossary Appendix List of References or Bibliography


Prcis is a condensed matter of an unseen passage. A suitable title is given to the passage and important points are stated in signal words as paragraph.

(iv) University paper

(iv) Time: Three Hours

Model paper MCA-105 Communication Skills

Maximum Marks: 100 Minimum Pass Marks: 40 Note: Attempt any five questions. All question carry equal marks Q1. Define communication. What are the communication skills a manager must require for success in his work? Q2. In what way can ethical and legal aspects of communication create problems for an organization? Q3. What is meant by body language? Explain with reference to silence, facial expression, gestures and postures? Q4. Why is it necessary for a businessman to make use of a combination of the various media of communication? Q5. In what way would you prepare yourself if called for a job interview? Q6. Discuss the importance of learning group communication skills. Q7. Assume that you have decided to establish a manufacturing unit in your town and that you wish to avail of the loan facility under the self-employment scheme of the government of India. Draft a technical proposal for the production of an item of your choice, seeking loan from the Regional Director of the Industrial Corporations of your state. Invent the details you consider necessary. Q8. The results of a college have been very poor for the last five years. The Managing Committee of the Education Society which runs the college has asked the Principal to make a recommendatory report for improving the results. Draft a report including a brief statement of finance requir


List of Books


Rajendra Pal and J.S.Korlahalli Essentials of Business Communication. Sultan Chand & Sons Publishers, New Delhi.

2. 3. 4. 5.

U.S.Rai & S.M.Rai Business Communication. Himalaya Publishing House. Menzal and D.H.Jones Writing a technical paper. Mc Graw Hill, 1961. Strategy and Skill Business Communication, Prentice Hall New Jersey, 1987. Scot Ober Contemporary Business Communication, Wiley India.

Web References
1. 2. 3. 4. 5. dia_Studies/There_are_five_types_of_communicationWritten_letters_memoranda_L805 34.html

6. 7. 8. 9. 10. 11.