Computer Concept & Programming In C - Unit I - 6

Q.9. Write a C program to swap two integer variable without using third variable.  (2009-10)
Ans. /* A program to swap two integer variables without using third variable */
# include < stdio.h>
# include < conio.h>
void main ( )
{
    int a, b;
    clrscr ( );
    printf (“\n Enter 1st number”);
    scanf (“% d”, & a);
    printf (“\n Enter 2nd number”);
    scanf (“% d”, & b);
    a = a + b;
    b = a - b;
    a = a - b;
    printf / “\n The number after swapping:”);
    printf (“\n 1st number % d”, a);
    printf (“\n 2nd number % d”, b);
    getch ( );
}

Q.10 What do you understand by digital computers? Explain components of a digital computer with the help of block diagram.
Related Questions -
Q. Define digital computer. List the basic operations performed by computer.    
                                                                                                                (AKTU. 2013-14)
Q. Draw a neat schematic of a digital computer and explain the role of each functional unit.                                                                                                                    (AKTU. 2010-11)
Q. Explain the role of control unit of CPU in computer system. (AKTU. 2012 - 13)
Ans. Digital computers: -
A digital computer is a digital information processing system.
  • The general-purpose digital computer is the best-known example of the digital function.
  • Digits are discrete elements in the early computer design.
  • The term digital computers thus emerged.
  • Discrete elements of information are represented by physical quantities called signals.
  • Voltages and currents are the most common electrical signals.
  • Binary signals are the most popular digital signals in modern electronic digital systems. Two discrete values are (high/low), (true/false), (1/0).
  • A binary digit is called a bit.
The block diagram of a digital computer is



 The functioning of the various components is described below.
1. Memory: - Stores temporary data RWM (Read Write Memory).
2. Permanent Storage: - Stores data permanently (Hard Disk).
3. Registers: - Stores information for processor temporarily.
4. Arithmetic and Logical Unit (ALU): - Performs arithmetical, (+, -, *, /) and logical (AND, OR, NOT) operations.
5. Control Unit: - Co-ordinates the working of ALU and register directly and also other devices indirectly.
6. Input/Output devices: - Provides Input / Output facilities to computer and users.