CAM101: INTRODUCTION TO COMPUTER PROGRAMMING THROUGH C

ODD SEMESTERS  (updated July 2010)

 

 

General Course Information:  

 

 

Course Credits     : 07 (04 Theory + 03 Laboratory)

Classes                : Theory - 04 & Laboratory - 06 per week.

Location              : Theory - CS2, Laboratory – CCML.

Assessment          : Periodical Tests, Assignments and Semester End Examination.  

Overlaps with       : CSB01, MBIF101 & B.Sc.04-A

Course Objectives & Prerequisites:  

This course aims to introduce the students with Computer Programming Concepts, taking C language as the medium. The course lays emphasis on foundations & basic principles of Computer Programming. Beginning with elementary concepts, students will be presented with detailed discussions on a variety of programming constructs and advanced features of the C language.  

This course serves as first course in Computer programming and does not requires any special knowledge of Computer Science, except a basic familiarity with Digital Computers and Binary Numbers.   

Course Syllabus:  

Basic Programming Concepts: Introduction to the basic ideas of problem solving and programming using principles of top-down modular design, Flowcharts, Abstraction Mechanisms, Stepwise Refinement. Syntactic Elements of a Language, General Syntactic Criterion, Formal Definition of Syntax, Semantics, Storage Management.  

Introduction to Programming Language C: Data Types, Instruction and its Types, Storage Classes, Operators and  Hierarchy of Operations, Expressions in  C,  Control   and   Repetitive   Statements, break, continue,  Functions: User Defined Functions and Library Functions, Local and Global Variables, Parameter Passing, Pointers, Arrays, Strings, C Preprocessors, Structures, Input and Output in C, C-Library.  

Introduction to the Major Programming Paradigms: Imperative Language, Object Oriented Languages, Functional Languages, Logic Languages, Parallel Languages etc.  

Text Books:  

 

1. Kernighan & Ritchie, The C Programming Language, Pearson Education, 2/e.  

2. Y. Kanetkar, Let Us C, BPB Publications.

 

 

Reference Books:  

 

1. R. Sethi, Programming Languages, Addison-Wesley, 1996

2. B.S.Gottfried, Schaum's Outline of Theory and Problems of Programming with C, Tata McGraw-Hill.

3. H.Schildt, C Made Easy, Osborne McGraw-Hill.

Lecture Plan:  

Day  

Topics

1 & 2

Introductory Lecture: Basic Discussion about Data Processing & Digital Computers, Layered View of Computing System, Evolution of Software, Programming Languages, Compilers & Interpreters, Operating System.

A set of Slides for introductory topics  (PPT)

A brief lecture note on introductory topics  (PDF

3

Programming Basics: Stored Program Concept, Programming Languages, Idea of Syntax and Semantics, Alphabets.

4

Problem Solving: Idea of Algorithms, Flowcharts, Having a feel of Programming through Simple Programs.

5 & 6

The C Programming Language: Data Types, Variables & Constants, Operators, Expressions, C Statements, Writing Simple C Programs.

7, 8 & 9

Control Structures: Sequence, Selection and Repetition Logic; C Constructs for Decisions, Nested if-else, Switch-Case, Complex Conditions, Loops, Nesting of Loops, Break and Continue, Pre & Post Increment and Decrement Operators.

10 & 11

Arrays: Array Declaration, Accessing Elements, Entering Data, Searching, Sorting, Matrix Operations.

12 & 13

Pointers: Address of and Value at Address Operators, Pointer Arithmetic, Arrays and Pointers.

14 & 15

Functions: User Defined and Library Functions, Defining Functions, Call by Value and Call by Reference, Arrays as Parameter, Recursive Functions.

16

Strings: Reading and Writing String Variables, String Manipulation, Library Functions for String Processing, Writing Own Library Functions.

17 & 18

Arrays, Pointers and Functions all Together.

19

Periodical Test 1.

20

Scope of Variables, Storage Classes, More Data Types, Type casting.

21

Structures.

22

Preprocessing: Macros, File Inclusion and Conditional Compilation.

23

I/O Functions: Console I/O, Disk I/O and Port I/O, Opening and Closing a File, File Opening Modes.

24

File Processing: Reading and Writing, Record I/O, File Pointer Manipulation, Command Line Arguments.

25

Dynamic Memory Allocation.

26

Bitwise Operations.

27

Leftover: Union , Enumeration, Functions with Variable Number of Arguments, Pointers to Functions and Functions Returning Pointers.

28

C Standard Library, Multi file Programs.

29

Periodical Test 2.

30

Graphics in C.

31

UNIX & C.

32

Programming Paradigms, Language Implementation, Structured Programming.

Laboratory Assignment 01  

(To be submitted before 1st periodical test)

1.      Write a Program to compute the Factorial value of a given integer. Use it to sum a given series.

 

2.      Write a Program to implement Sequential & Binary Search techniques on a given list of numbers.

 

3.      Write a Program to sort a given list of numbers in ascending order, using:

         (a) Bubble Sort       (b) Selection Sort        (c) Quick Sort        (d) Merge Sort

 

4.      Write a Program to perform following matrix operations:

         (a)   Compute transpose of a matrix

         (b)   Multiply two matrices.

 

5.      Write a Program to perform the following String Processing:

         (a)    To read a line of text and count the number of characters & words in it.

         (b)   To search for all the occurrences of a given sub string and replace it by its reverse.

 

6.      Write a Program to convert a positive integer into its Binary, Octal & Hexadecimal equivalent.

 

7.      Write a Program to solve the Tower of Hanoi problem for a given number of disks.

 

8.      Write a Program to copy the contents of one file to another. The program should read the file names at

         command prompt.

 

9.      Write a function rightrot (x , n) that returns the value of the integer x rotated to the right by n bit positions.

 

10.    Write a Program to create a linked list of items. Write functions for displaying the contents and inserting &

         deleting an item from the list.

 

11.    Write a Program to create a Stack containing numbers. Write appropriate functions for Push and Pop

         operations.

 

12.    Write a Program to create a Queue of items. Write appropriate functions for insertion and deletion

         operations. 

Laboratory Assignment 02

(To be submitted before 2nd periodical test)

1. Write a Program to check a C program for rudimentary syntax errors like unbalanced parentheses, brackets

     and braces. Ignore the Comment  lines.

 

2. Write a Program for Date Conversion, i.e., if a date (dd-mm-yyyy) is entered from the keyboard, the

     program should return the day of the month and the day of the year. The program should check for invalid

     dates and should take into account the leap years.

 

3. Write a Program expr which evaluates a reverse Polish expression from the command line, where each

     operator or operand is a separate argument. For ex.   expr 2 3 4 + * should evaluate to 2 * (3 + 4).

 

4. Write a Cross reference program that prints a list of all words in a document, and, for each word, a list of

     the line numbers on which it occurs.

 

5. Write a Program in C on UNIX which returns ids of a process, its parent and of all its children.

 

6. Write the C equivalent for UNIX command  ls to list the files in a directory.

 

Semester End Examination

3rd - 4th Week of November

Question Papers (Previous years)

mca 2004            mca 2005            mbif 2005

(PDF Files)