You are on page 1of 12

Digital Logic

and
Programming in C
(Choice Based Credit System (CBCS) Pattern) – New Syllabus
(For B. Sc. Computer Science, BCA, B.Sc., Electronics, B.Sc. Physics, M.Sc. Computer
Science, MCA and B.E. Courses)

By

Dr. P.Rizwan Ahmed, MCA. M.Sc., M.A.(HR)., M.Phil., Ph.D,


Head of the Department
Department of Computer Applications and
Post Graduate Department of Information Technology
Mazharul Uloom College, Ambur
CONTENTS

Preface
Acknowledgement
Part – I Digital Logic
Chapter 1 Number Systems

1.1 Introduction
1.2 Number System
1.2.1 Binary Number System
1.2.2 Octal Number System
1.2.3 Decimal Number System
1.2.4 Hexadecimal Number System
1.3 Representation of Numbers Systems
1.4 Number Base Conversions
1.4.1 Decimal to Binary Conversion (Integer)
1.4.2 Decimal to Binary Conversion (Fraction)
1.4.3 Binary to Decimal Conversion (Integer)
1.4.4 Binary to Decimal Conversion (Fraction)
1.4.5 Octal to Decimal Conversion (Integer)
1.4.6 Octal to Decimal Conversion (Fraction)
1.4.7 Decimal to Octal Conversion (Integer)
1.4.8 Decimal to Octal Conversion (Fraction)
1.4.9 Decimal to Hexadecimal Conversion (Integer)
1.4.10 Decimal to Hexadecimal Conversion (Fraction)
1.4.11 Hexadecimal to Decimal Conversion (Integer)
1.4.12 Hexadecimal to Decimal Conversion (Fraction)
1.4.13 Octal to Binary Conversion (Integer)
1.4.14 Octal to Binary Conversion (Fraction)
1.4.15 Binary to Octal Conversion (Integer)
1.4.16 Binary to Octal Conversion (Fraction)
1.4.17 Hexadecimal to Binary Conversion (Integer)
1.4.18 Hexadecimal to Binary Conversion (Fraction)
1.4.19 Binary to Hexadecimal Conversion (Integer)
1.4.20 Binary to Hexadecimal Conversion (Fraction)
1.4.21 Hexadecimal to Octal Conversion (Integer)
1.4.22 Hexadecimal to Octal Conversion (Fraction)
1.4.23 Octal to Hexadecimal Conversion (Integer)
1.4.24 Octal to Hexadecimal Conversion (Fraction)
1.5 Binary Arithmetic
1.5.1 Binary Addition
1.5.2 Binary Subtraction
1.5.3 Binary Multiplication
1.5.4 Binary Division
1.6 Floating Point Representation
1.7 Complements
1.7.1. r’s Complement
1.7.1.1 1’s Complement
1.7.1.2 Subtraction using 1’s Complement
1.7.2 2’s Complement
1.7.2.1 Subtraction using 2’s Complement
1.7.3 Comparison of 1’s Complement and 2’s Complement
1.7.4 (r-1)’s Complement
1.7.4.1 9’s Complement
1.7.4.2 10’s Complement
1.7.4.3 Subtraction using 9’s complement
1.7.4.4 Subtraction using 10’s complement
1.8 Binary Codes
1.9 Needs for Binary Codes
1.10 Advantages of Binary Code
1.11 Classification of Binary Codes
1.11.1Weighted Code
1.11.2 BCD Code
1.11.2.1 8421 Code
1.11.2.2 2421 Code
1.11.2.3 5211 Code
1.11.3 Non-weighted Codes
1.11.3.1 Excess-3(XS-3) Code
1.11.3.2 Excess-3 Arithmetic
1.11.3.3 Gray Code
1.11.4 Application of Gray Code
1.12 Reflective Codes
1.13 Sequential Codes
1.14 Alphanumeric Codes
1.14.1 ASCII Code
1.14.2 EBCDIC Code
1.14.3 Hollerith Code
1.15 Error-Detecting and Error-Correcting Code
1.15.1 Error Detecting Codes
1.15.2 Error Correcting Codes

Summary
Review Question
Chapter 2 Arithmetic Circuits

2.1 Arithmetic Circuits


2.2 Adders
2.2.1 Half Adder
2.2.2 Full Adder
2.3 Subtractor
2.3.1 Half Subtractor
2.3.2 Full Subtractor
2.4 Binary Parallel Adder
2.5 BCD Adder
2.6 Parallel Binary Subtractor
Summary
Review Questions

Chapter 3 Digital Logic Gates

3.1 Logic Levels


3.1.1 Positive logic system
3.1.2 Negative logic system
3.2 Basic Logic Gates
3.2.1 AND Gate
3.2.2 OR Gate
3.2.3 NOT Gate
3.3 Universal Gates / Universal Building Blocks (UBB)
3.3.1 NAND Gate
3.3.2 NOR Gate
3.4 EX-OR Gate
3.5 EX-NOR Gate
Summary
Review Questions

Chapter 4 Combinational Logic Circuits – Boolean algebra – Karunaugh Map

4.1 Combinational Logic Circuits


4.2 Boolean algebra
4.2.1Basic Definitions of Boolean algebra
4.2.2 Axiomatic Definition of Boolean algebra
4.3 Karnaugh Map (K-Map)
4.3.1 Two-Variable Karnaugh Maps
4.3.2 Three - Variable K. Map
4.3.3 Four - Variable K- Map
4.3.4 Product of Sums Simplification
4.3.5 Don’t Care Conditions
4.3.6 Advantages of K-Map
4.3.7 Disadvantages of K-Map
4.4 Minterms and Maxterms
4.4.1 Minterms
4.4.2 MaxTerms
4.5 Canonical Forms
4.5.1 Sum of Minterms(SoM)
4.5.2 Product of Maxterms (PoM
4.6 Construction and Properties
4.7 Implicants
4.7.1 Prime Implicant (PI)
4.7.2 Essential prime implicant (EPI)
4.8 Don’t Care Combinations
4.9 Sum of Products (SOP)
4.10 Product of Sums (POS
4.11 Conversion of Sum of Products Expressions into Canonical Form
4.12 Conversion of Product of Sums Expression into Canonical Form
Summary
Review Questions

Chapter 5 Sequential Circuits: Flip Flops

5.1 Sequential Circuits


5.1.1 Asynchronous Sequential Circuit
5.1.2 Synchronous Sequential Circuit
5.1.3 Comparison of Sequential Circuits and Combinational Circuits
5.1.4 Comparison of Synchronous Sequential Circuits and Asynchronous Sequential
Circuits
5.4 Flip Flops
5.4.1 Types of Flip-Flops
5.4.1.1 S-R (Set-Reset) Flip-flop
5.4.1.2 RS Flip-flop
5.4.1.3 Clocked RS Flip-Flop
5.4.1.4 J-K Flip-Flop
5.4.1.5 Master-Slave J-K Flip-fl op (JKMS)
5.4.1.6 D Flip-Flop (Delay Flip Flop)
5.4.1.7 T Flip-Flop
5.5 Master-Slave Flip-Flop
Summary
Review Questions
Chapter 6 Combinational Logic Circuits:( Multiplexer, Demultiplexer, Encode, Decoder)

6.1 Multiplexer
6.1.1 4-to-1 Multiplexer
6.1.2 8-to-1 Multiplexer
6.1.3 16 –to-1 Multiplexer
6.2 Demultiplexer
6.2.1 1-to-4 Demultiplexer
6.2.2 1-to-8 Demultiplexer
6.3 Decoder
6.3.1 Binary Decoder
6.3.2 3-to-8 line Decoder
6.3.3 1 –of – 16 Decoder
6.3.4 BCD -to- Decimal decoders
6.3.5 BCD to Seven Segment Decoder
6.4 Encoder
6.4.1 Octal –to-Binary Encoder
6.4.2 Decimal to Binary Encoder
6.5 Priority Encoder
Summary
Review Questions

Chapter 7 Sequential Circuits: Shift Registers and Counters

7.1 Register
7.2 Shift Register
7.2.1 Serial-in to Parallel-out (SIPO)
7.2.2 Serial-in to Serial-out (SISO)
7.2.3 Parallel-in to Serial-out (PISO)
7.2.4 Parallel-in to Parallel-out (PIPO)
7.3 Applications of Shift register
7.4 Counters
7.4.1 Synchronous Counter
7.4.2 Asynchronous Counter
7.5 Difference between Asynchronous Counter and Synchronous Counter
7.6 Ripple Counters or Asynchronous Counters
7.7 BCD Ripple Counter
7.8 Synchronous Counters
7.8.1 Binary Counter
7.8.2 Binary Up-Down Counter
7.8.4 Binary counter with parallel load
7.8.5 Shift Register Counter
7.8.5.1 Ring Counter
7.8.5.2 Johnson Counter (Twisted Counter)
Summary
Review Questions

Part - II Programming in C

Chapter 8 C Fundamentals

8.1 Introduction to C
8.2 History of C
8.3 Why use C?
8.4 Why Learn C?
8.5 Advantages / Features of C language
8.6 Structure of C -Program
8.7 Creation and Execution of a C-Program
8.8 Programming Elements
8.8.1 Character Set
8.8.2 Keywords
8.8.3 Identifiers
8.8.4 Constants
8.8.5 Escape Sequence
8.9 Data Types
8.9.1 Fundamental Data Types
8.9.2 Derived data types
8.9.3User-defined data types
8.10Variables
8.10.1 Rules for Defining Variables
8.10.2 Declaration of variable
8.10.3 Initialization of Variables / Assigning values to variables
8.10.4 Difference between Identifier and Variable
8.11 Type Conversion
8.12 Type Casting
8.13 Symbolic Constants
Summary
Review Question
Programming Exercise

Chapter 9 Operators, Expressions and Library Functions

9.1 Operators
9.1.1 Arithmetic Operators
9.1.2Relational Operators
9.1.3 Logical Operators
9.1.4 Assignment Operators
9.1.5 Increment and Decrement Operators
9.1.6 Bitwise Operators
9.1.7 Conditional Operator
9.1.8 Special Operators
9.2 Operator Precedence and Associativity
9.3 Sample C Program
9.4 Expressions
9.5 Evaluation of Expressions
9.5.1 Precedence of Arithmetic Operators
9.6 Library Functions
9.6.1 String Handling Functions
9.6.2 Mathematical Functions
Summary
Review Question
Programming Exercise

Chapter 10 Managing Input and Output Operations

10.1 Unformatted I/O Functions


10.1.1 Single Character I/O
10.1.1.1 Reading a Character: getchar()
10.1.1.2 Writing a Character: putchar()
10.2 String I/O functions
10.2.1 String Input: gets()
10.2.2 String Output : puts()
10.3 Formatted I/O functions
10.3.1 Formatted Input: scanf( )
10.3.2 Formatted Output :printf()
10.4 Sample C Programs
Summary
Review Question

Chapter 11 Decision Making – Branching – Looping

11.1 Control Statements


11.1.1 Decision – Making Statement
11.1.1.1 Simple if statement
11.1.1.2 if…else Statement
11.1.1.3 Nested-if Statement
11.1.1.4 Switch Statement
11.1.1.5 Difference between switch statement and if statement
11.1.1.6 Difference between switch and nested if statements
11.1.2.Looping Statement
11.1.2.1 While loop statement
11.1.2.2 Do - while
11.1.2.3 for loop
11.1.2.4 Difference between while and do-while loop
11.1.3 Jump Statement
11.1.3.1 Break statement
11.1.3.2 Continue Statement
11.1.3.3 Distinguish between Break and Continue
11.1.4 goto statements
11.2 Comma operator
11.3 Sample C Programs
Summary
Review Question
Programming Exercise

Chapter 12 Arrays

12.1 Arrays
12.1.1 Advantages and Disadvantages of Arrays
12.2 Characteristics of arrays
12.3 Types of Arrays
12.3.1 One dimensional array
12.3.2 Two dimensional arrays
12.3.3 Multidimensional arrays
12.4 Sample C Programs
Summary
Review Questions
Programming Exercise

Chapter 13 User Defined Functions

13.1 Introduction
13.2 Need for user defined functions
13.3 The form of C Functions
13.4 Return Statement / Return Values and their types
13.5 Function prototype
13.6 Calling a function
13.7Formal and Actual arguments
13.7.1 Formal arguments
13.7.2 Passing arguments
13.8 Category of User Defined Functions
13.8.1 Function with no arguments and no return value
13.8.2 Function with arguments and no return value
13.8.3 Function with no arguments and return value
13.8.4 Function with arguments and return value
13.9 Call by Value and Reference
13.9.1 Call by Value
13.9.2 Call by Reference
13.10 Difference between call by value and call by reference in c
13.11 Recursion
Summary
Review Questions
Programming Exercise

Chapter 14 Storage Classes

14.1 Storage Classes


14.1.1 Automatic
14.1.2 External
14.1.3 Register
14.1.4 Static
Summary
Review Questions

Chapter 15 Structure and Union

15.1 Structure
15.1.1 Defining structure
15.1.2 Structure declaration
15.1.3 Giving values to structure members
15.1.4 Structure Initialization
15.1.5 Difference between arrays and structure
15.2 Structures within Structures
15.3 Self-referential structure
15.4 Sample C Program
15.5 Union
15.5.1 Declaration of Union
15.6 Difference between Structure and Union
15.7 Difference between Structures and Arrays
Summary
Review Questions
Programming Exercise

Chatper-16 Pointers

16.1 Introduction
16.2 Definition
16.3 Advantages of Using Pointers
16.4 Application of Pointers
16.5 Accessing the address of the variable
16.6 Declaring and Initializing Pointers
16.7 Accessing a Variable through its Pointer
16.8 Pointer Operators
16.9 Operations on Pointers
16.9.1 Pointer Arithmetic and Pointer Expression
16.10 Arrays of Pointers
16.11 Pointers to functions
16.12 Pointers and Arrays
16.13 Pointers and Structures
16.14 Dynamic Memory Allocation
Summary
Review Questions

Chatper-17 File Management I n C

17.1 Introduction
17.2 File
17.2.1 Creating a file
17.2.2 Reading a file
17.2.3 Writing a file
17.2.4 Opening a file
17.2.5 Closing a file
17.3 I/O Operations on Files
17.4 File Handling Functions
17.5 Error handling during I/O operations
17.6 Random Access to Files
17.7 Command line input or arguments
Summary
Review Questions

APPENDIX A: Solved Programs

APPENDIX B: Practical Exercises for Thiruvalluvar University

APPENDIX C: Digital Logic Questions and Answers

APPENDIX D: Programming in C Questions and Answers

APPENDIX E: Digital Logic Objective Type Questions


APPENDIX F: Programming in C Objective Type Questions

APPENDIX G: Model Question Papers for Thiruvalluvar University

You might also like