Introduction to Programming (IOPS332C, 2-1-1)

 

AUTUMN 2020-2021
Lecture: Wednesday (11:10 AM-1:10 PM); Tut: Monday (5:00 PM - 7:00 PM); Lab: Tuesay (5:00 PM - 7:00 PM)

Lectures/ Tut and Lab evaluation to be held Online via Google Meet

Announcements, Assignment submission and Quiz evaluations via Google Classroom

 

 

 

 

Course Objective:

The course introduces students to the theoretical and practical knowledge of programming using C programming language as an implementation tool. It aims at providing students with understanding of programming essentials, psedo codes and algorithms, data types, elementary control structures and functions used within the framework of imperative and structural programming paradigms.

Course Outline:


Component Unit
Component 1 Unit 1 : Introduction to digital computers; introduction to programming - variables, assignments; expressions; input/output; conditionals and branching; iteration;
Component 1 Unit 2: functions; recursion; arrays; introduction to pointers; structures;
Component 2 Unit 1 : introduction to data-procedure encapsulation; dynamic allocation; linked structures;
Component 2 Unit 2: introduction to data structures - stacks and queues; time and space requirements.


Tools and Language

The vehicular language used for the course would be "C". All codes, assignments and lab exercises will be implemented in C language only.
The computer systems for the course are the machines in Lab 5042.
The preferred operating system for the tutorials and lab would be Ubuntu and the prefered editor would be Gedit or Emacs

Linux Distribution

It is a good idea to have linux installed on your machine. The 'C' compiler comes as default with the distribution. Be sure to choose it, if it is not selected by defaults, from the 'Development' items during installation. If you forget to install and desired package at the time of installation then use sudo apt-get install to select and install new packages. You need to be a root (super) user to do this (sudo gives you temporary root user permission).
Linux can co-exist with windows, if you have that already installed. Otherwise, if you like to have both then you should install windows first and linux next. Windows sometimes disturbs other installed systems.
A recent Ubuntu distribution is available [here]

Compiler

Most students prefer using non-ANSI-compliant compilers such as Turbo C while working at home. We strongly discourage doing so. Microsoft's Visual C++ compiler is good and recommended for use. But this compiler is proprietary and free copies of it cannot be obtained. The GNU range of compilers and the emacs editor can, however, be freely downloaded from the Internet. You are encouraged to download and install them in your machines, and use these software instead of non-standard software.

Editor

The preferred editors for the tutorial and lab sessions would be either Emacs , Gedit or vi
Gedit and vi are pre-installed with any Ubutu distribution.
To install Emacs in the Ubuntu environment : Open a terminal and type sudo apt-get install emacs

Working in the Windows environment

Students preferring to work in the Windows environment are encouraged to try ANSI-C compliant Compilers only and are asked to visit the lab page of the course to know how to download and install GCC compiler in the Windows environment. They may also want to visit the page to know about downloading and installing Emacs

 

 

References:

 

1.      Brian W. Kerninghan Dennis M. Ritchie, The C Programming Language, Prentice Hall of India.

2.      E. Balaguruswamy, Programming in ANSI C, Tata McGraw-Hill.

3.      R. G. Dromey, How to Solve it by Computer, Prentice-Hall of India. .

4.      Ellis Horowitz, Satraj Sahni and Susan Anderson-Freed, , Fundamentals of Data Structures in C, W. H. Freeman and Company.

5.      Seymour Lipschutz , Data Structures, Schaum's Outlines Series, Tata McGraw-Hill.

6.      PDS notes @IIT KGP

 

 

 

 

Important Instructions:

1.         Classes will be conducted using slide presentation as well as chalk-board. Official slide sets and miscellaneous study materials from some of the main text books will be uploaded on the web site on a regular basis.

2.         Every student is expected to have access to at least the book : The C Programming Language, by Ritchie and Kerningham.

3.         Attendance in the classes is mandatory. If the attendance of a student falls below 75%, he/she may will be dropped from the course after Component 2

4.         The course will consist of laboratory and take-home assignments, which has to be done very seriously. If a student does not submit the assignments, his/her grade will remain as incomplete.

5.         Grading Policy :

o   30%: Component 1 - Closed book exam (10%); Take home assignment (10%) and Lab assignment (10%)

o   30%: Component 2 - Closed book exam (10%); Take home assignment (10%) and Lab assignment (10%)

o   40%: Component 3 - Closed book written exam

6.         Take home assignments : They will be assigned at the beginning of a module (announcements will be made on the course web-site every week). These assignments will not only help you in development of an in-depth idea of each topic of the course but will also serve to prepare for your written examinations.
There will be two kinds of take home assignments :
(i) Homework assignments - To be done individually. These assignments need not be submitted but it is expected that the students complete them in order to have better understanding of the concepts covered in lecture sessions. Interact with your TAs during tutorial sessions to clear your doubts regarding the homework assignments.
(ii) Group Assignments - To be done in groups of four (max). These problems will be more harder problems involving rigorous mathematical/analytical treatement or implementation based assignments. Each Unit will have two such assignments which have to be completed within a given deadline and will be evaluated in each tutorial class.

6.         Tutorial Classes : The tutorial classes scheduled every week will have a dual role in the course. First they will serve as doubt clearing sessions where the TAs will interact with the students to clear their doubts and discuss the homework assignments. The second purpose of the tutorial classes would be to assess the understanding of the concepts though evaluation of the group assignments.

7.         The lab classes will mainly consist of implementation of programming concepts discussed in class and the assignments covered in tutorial sessions. Visit the Lab Page of the course website for details.

        

        

        

        

        

 

 

 

Lecture Slides:

The lecture slides provided here are mainly borrowed from the different lecture slides available at the Programming and Data Structure (PDS) course repository of IIT Kharagpur

-----------

Sl. No.

Topic

Practice Problems (Homework)

Tutorial/Codes for Practice

Helpful Resources

1.

Introduction

[ Slides ]


[ Video Lecture ]

Homework Set 1

Tut-0

my_first_program.c


2.

Fundamental Concepts in Programming

[ Slides ]


[ Video Lecture ]

Homework Set 2

Tut-1

read_input_keyboard.c

centigrade_to_fahrenheit.c

3.


Introducing C : Identifiers and Data Types

[ Slides ]


[ Video Lecture ]

Homework Set 3


Tut-2


prog6.c

prog7.c

prog8.c


4.

Expression and Assignment


[ Slides ]


[ Video Lecture ]


Homework Set 4

5.

Control Structures - Decision Making


[ Slides ]


[ Video Lecture ]


Homework Set 5

prog9.c

prog10.c

prog11.c


prog12.c

prog13.c

prog14.c


6.

Control Structures - Iteration


[ Slides 1]


[ Slides 2]


[ Video Lecture ]


Homework Set 6

factorial

fibonacci

Decimal to Binary

Half Pyramid

Prime no. detection

Using the getchar()

7.






8.

Functions 1


[ Slides ]


[ Video Lecture ]


Functions 2 : Recursion

[ Slides ]

[ Video Lecture ]


Homework Set 7



Homework Set 8

Random Number Generator

Power

Calculating Ncr

Factorial:Iterative

Factorial:Recursive

GCD:Iterative

GCD:Recursive

Swap failure

Tower of Hanoi

9.






10.

Arrays in C


[ Slides ]


[ Video Lecture ]


Passing Arrays to Functions

[ Slides ]

[ Video Lecture ]


Homework Set 9



Homework Set 10

Array Example 1

Array Example 2

Array Example 3

Minimum within an Array of Nos.

Passing Arrays to Function using Call by Value

Passing Arrays to Function using Call by Reference

11.





12.

Character Arrays: Strings

[ Slides ]

[ Video Lecture ]


2-D Arrays


[ Slides ]



[ Video Lecture ]


Homework Set 11




Homework Set 12




Count Upper Case

String Compare

Matrix Addition

13.





14.

Pointers 1

[ Slides ]

[ Video Lecture ]


Pointers 2

[ Slides ]

[ Video Lecture ]


Homework Set 13




Homework Set 14




intro_pointers.c

pointer_attributes.c

pointer_array.c

array_update.c

return_pointer.c

array_of_pointers.c

call_reference_using_pointers.c

pointer_to_pointerrs.c

pointers_in_2d_arrays.c




15.





16.

Strings Revisited - Pointers for Strings


[ Slides ]



Command Line Arguments



[ Slides ]



[ Video Lecture ]






Homework Set 15







using_strings.c

17.

Structures

[ Slides ]



[ Video Lecture ]



Homework Set 17




accessing_members_of_strucutres.c

arrays_in_structures.c

arrays_of_structures.c

comparing_strcture_variables.c

passing_structures_to_functions.c

pointer2strcuture.c

18.

Dynamic Memory Allocation

[ Slides ]



[ Video Lecture ]



Homework Set 18




19.

File Handling in C

[ Slides ]



[ Video Lecture ]



Homework Set 19




reading_from_a_file.c

writing_to_a_file.c

reading_a_binary_file.c

use_of_fseek.c