Programming Fundamentals For Design and Verification
Programming Fundamentals For Design and Verification
Text Book:
No specific courseware for module, faculty may share some course materials.
Reference book:
Session 1:
Introduction to C, History, Standards
Overview of C Basics: Variables, Data Types, Constants, Qualifiers, Operators, Control
Structures etc.
Pointers:
Concept of pointers
Pointer arithmetic
Chain of pointers
Pointer to const, const pointers
Void pointer, NULL pointer
Assignment:
1. If a five-digit number is input through the keyboard, write a program to calculate the sum of its
digits.
PG DVLSI Page 1 of 4
ACTS, Pune
Suggested Teaching Guidelines for
Session 2:
Arrays : 1D, 2D arrays, Pointers & Arrays
Assignment:
1. Write a recursive function to obtain the running sum of first 25 natural numbers.
2. Write a program to pick up the largest number from any 5 row by 5 column matrix.
3. Write a program that interchanges the odd and even components of an array.
Session 3:
Functions
o Overview of functions
o Scope & Lifetime of variables
o Recursion
o Function pointers
o External linkage
C Preprocessor
Assignment:
1. A 5-digit positive integer is entered through the keyboard, write a function to calculate sum of
digits of the 5-digit number:
(1) Without using recursion
(2) Using recursion
2. A positive integer is entered through the keyboard, write a program to obtain the prime factors of
the number. Modify the function suitably to obtain the prime factors recursively.
3. Given three variables x, y, z write a function to circularly shift their values to right. In other words
if x = 5, y = 8, z = 10 after circular shift y = 5, z = 8, x =10 after circular shift y = 5, z = 8 and x =
10. Call the function with variables a, b, c to circularly shift values.
4. Write a program to test whether a character entered is a small case letter or not.
Session 4:
Strings
Structures & unions
Dynamic Memory management
Assignment:
1. Write a program that extracts part of the given string from the specified position. For example, if
the sting is "Working with strings is fun", then if from position 4, 4 characters are to be extracted
then the program should return string as "king". Moreover, if the position from where the string is
to be extracted is given and the number of characters to be extracted is 0 then the program
should extract entire string from the specified position.
2. Write a program that replaces two or more consecutive blanks in a string by a single blank. For
example, if the input is
PG DVLSI Page 2 of 4
ACTS, Pune
Suggested Teaching Guidelines for
Session 5:
Introduction to C++
New features in C++
Reference variables, new & delete operators
C++ functions (Overloading, Default arguments, Inline functions, extern "C" block)
Session 6:
Variables & Functions
Public, Private access specifiers
Constructors & destructors
Copy constructor
namespace
Assignment – Lab:
Write a Student class and use it in your program. Store the data of ten students and display the
sorted data according to their roll numbers, date of births, and total marks.
Session 7:
this keyword
Static members
Friend functions & classes
Const functions, mutable variables
Explicit constructors
Session 8:
overloading unary, binary operators
overloading as friend functions
overloading <<, >>
Type Conversions
Assignment – Lab:
Write Date and Time classes that allows you to add, subtract, read and print simple dates in
dd/mm/yyyy and time in hh:mm:ss forms. Use function overloading in your program.
Assignments to overload =, ==, +, ++, --, <<, >> and [ ] operators.
PG DVLSI Page 3 of 4
ACTS, Pune
Suggested Teaching Guidelines for
Session 9:
Inheritance
Types of inheritance
Overriding
Protected members
Constructors in inheritance
Assignment – Lab:
Design a hierarchy of computer printers. Use multiple inheritance in your hierarchy. Also use
friend functions and classes in your program.
Session 10:
Virtual functions
Virtual destructors
Pure Virtual functions
Virtual Inheritance
Assignment – Lab:
Using virtual and pure virtual functions implement hierarchy of computer printers.
Session 11:
Class Template
Function Template
Assignment – Lab:
Write a program using class template.
PG DVLSI Page 4 of 4