Digital Logic and Programming in C PDF
Digital Logic and Programming in C PDF
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
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
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
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
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 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
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
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
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