Friday, 29 November 2019

what is interrupt?

An interrupt is special signal which sent to the CPU to perform on it by the software and hardware. 
The processor respond by the suspending it's current activities, saving its state and executing a small program called an interrupt handle(or interrupt service routine, ISR) to deal with the event. 
This interruption is temporary, after the interrupt handler finishes, the processor resumes execution of the previous thread. 
Interrupt are basically two types-:

1-: External Interrupt
2-: Internal  Interrupt

Thursday, 7 November 2019

what is DMA & DMA controller? How it works?

DMA(Direct Memory Access) -


The  transfer of data between a fast storage device such as magnetic disk and memory is often limited by the speed of the CPU . Removing the CPU from the path and letting all the periferal devices manage the memory buses directly would improve the speed of transfer. This transfer technique is called DMA.
During DMA transfer, the CPU is idle and has no control of the memory buses. 


DMA controller- The DMA controller needs the usual circuits

DMA has many function as follows-:
 BR- Bus Request
BG- Bus grant
BT- Burst transfer
CS- cycle stealing


Bus request- CPU that facilitate the DMA                            transfer . 

Wednesday, 6 November 2019

What is synchronous data transfer?

Synchronous data transfer-:
      Sender and receiver use the same clock signal

1) - support high data transfer rate.
2) - needs clock signal between the                   sender  and the receiver
3) -  requires master/slave configuration

what is inheritance?

An object can reuse the properties of other objects which belong to another class. It is known as inheritance. With inheritance we can reuse an existing class to build a new class. A new class or sub class shares common properties with the class from which it derived. A existing class is known as parent class and a new class is known as derived class. 
When a class inherits from one parent class is known as single inheritance but when derived class have more parent class it is called multiple inheritance. 

what is polymorphism?

Polymorphism means that some of the functions perform their action differently  in different classes. It is very unique and powerful concept to revise something without changing it. Such as class 'shape' have sub classes circle, triangle etc and 'draw () ' is a method of 'shape'  class which is shared by all the sub classes at 'shape'.

Tuesday, 5 November 2019

What is handshaking in architecture?

There is a sequence of signals that might occur when a user at a terminal wants to send some data to the computer.

After terminal power is turned on and the terminal runs any self check, it asserts the data terminal ready  signal to tell the modem it is ready.

Wednesday, 11 September 2019

What is data structure?

Data is simply set of values . When the organized data is collected together is called data structure.
Data structure depends upon the organization of data, the data can be organized in many ways,
The logical or mathematical model of a special organization of data is also called data structure.
While organizing data, the structure should be simple enough that one can effectively process the data when necessary.
ADT(abstract data type) is a useful tool for specifying the logical properties of a data type. It is a well specified collection of data and a group of operations that can be performed upto the data.

The data structure are classified in the following two categories:
• Linear data structure
• Non-liner data structure

Linear data structure- In linear data structure data is processed sequentilly
one by one. It includes following types of data structure:
1.Array
2.Linked list
3.Stacks and Queues

Non-liner data structure- A data structure in which operation like insertion, deletion is not done in sequential fashion.
It includes following types of data structure:
• Graphs
• Tree
    

Sunday, 8 September 2019

How to write a program to find the factorial of given numbers?

#include<stdio.h>
#include<conio.h>
void main()
{
  int I, n, f;
  clrscr(); 
  printf("Enter the number ");
  scanf("%d",&n);
   While(i<= n)
   {
      f= f*i;
      i++
   }
  printf(" The factorial if the number is=% d\n",n, f);
getch();
}





What is register?

Register is just like a small memory they are used to store data or bit in binary form 0 and 1 .
A register is a group of flip-flop. Each flip-flop is storing one bit of information. We can use register to store the binary information there are many types of register are- :
1- Accumulator(ACC)
2- General purpose register
3- Pointer counter(PC)
4- Stack pointer(SP)
5- Instruction register
6- Temporary register
7- Index register
8- Instruction formate


Wednesday, 28 August 2019

What is computer organization?

Computer organization is concerned with the way of the hardware components operate and the way they are connected togather to from the computer system. The various components are assumed.
" To setup between hardware, operating       system and software is known as computer organization. "

On the other hand we can say computer organization, after completing the physical structure of the computer system. We have to setup every device component on a suitable location and according to the sequential order.
After connecting all the devices to eachother we have to supply functionality means the system is operend by operator system (is called system software) and to execute the program (is called application software)
Means-
The operating system is the interface between the software and hardware this whole phenomena.

Monday, 26 August 2019

How to write a program to multiply two matrics?

#include<stdio.h>
#include<conio.h>
void main()
{
   int a[i][j], b[i][j], c[i][j], I, j, k;
   int sum=0;
   clrscr();
   printf("nEnter the first matric:n");
    for(i= 0; i<3; i++)
    {
       for(j= 0; j<3; j++)
       scanf("%d", &a[i][j]);
     }    
printf("nEnter the second matric:n");         for(i= 0; i<3; i++)
    {
       for(j= 0; j<3; j++)
       scanf("%d", &b[i][j]);
     }    
printf("The first matric is:n");
  for(i= 0; i<3; i++);
      {
            for(j= 0; j<3; j++)
            printf("%d", a[i][j]);
            printf ("n");
       }
printf("The second matric is:n");
   for(i= 0; i<3; i++)
      {
         for(j= 0; j<4; j++)
         printf("%d", a[i][j]);
         printf ("n");
     }
        for(i= 0; i<3; i++)
       for(j= 0; j<=2; j++)
     {
        sum= 0;
        for(k= 0; k<=2; k++)
        sum= sum+ a[i][j]*b[i][j];
        sum=c[i][j];
     }
printf("The multiplication of two matrics:nn");
         for(i= 0; i<3; i++)
    {
       for(j= 0; j<3; j++)
      printf("%d ", c[i][j]);
       printf ("n");
    }
getch();
}

Thursday, 8 August 2019

What is storage classes??

The register Storage Class         

The register storage class is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and can't have the unary '&' operator applied to it (as it does not have a memory location).
 

The static Storage Class

The static storage class instructs the compiler to keep a local variable in existence during the life-time of the program instead of creating and destroying it each time it comes into and goes out of scope. Therefore, making local variables static allows them to maintain their values between function calls.

The static modifier may also be applied to global variables. When this is done, it causes that variable's scope to be restricted to the file in which it is declared.

In C programming, when static is used on a class data member, it causes only one copy of that member to be shared by all the objects of its class.

Wednesday, 31 July 2019

How to write a program to find the factorial of a given number?

#include<stdio.h>
#include<conio.h>
void main()
{
  int i, fact=1, num;
  printf("Enter the number/n");
  scanf("%d", &num);
    if(num=0)
           fact=1
    else
        {
            for(i=1;i<=num;i++)
     {
         fact*i
}
}
   printf("factorial of number%d=%5 d/n",num, fact);
getch();
}

What is conditional compilation? How does it help a programmer?

               Conditional Compilation
There may be situations when we went to compile some parts of the code based on some condition. We know that before compilation the source code passes through the preprocessor to supply only some parts of the code to the compiler for compilation.
These conditions are checked during the preprocessing phase. The directive used in conditional compilation are:
#ifdef
#ifdef
#if
#else

Saturday, 27 July 2019

ANSI Standard Libraries


1.   stdio.h: I/O functions:


a.    getchar() returns the next character typed on the keyboard.


b.    putchar() outputs a single character to the screen.


c.    printf() as previously described


d.    scanf() as previously described


2.    string.h: String functions


a.    strcat() concatenates a copy of str2 to str1


b.    strcmp() compares two strings


c.    strcpy() copys contents of str2 to str1


3.    ctype.h: Character functions


a.    isdigit() returns non-0 if arg is digit 0 to 9


b.    isalpha() returns non-0 if arg is a letter of the alphabet


c.    isalnum() returns non-0 if arg is a letter or digit


d.    islower() returns non-0 if arg is lowercase letter


e.    isupper() returns non-0 if arg is uppercase letter


4.    math.h: Mathematics functions


a.    acos() returns arc cosine of arg


b.    asin() returns arc sine of arg


c.    atan() returns arc tangent of arg


d.    cos() returns cosine of arg


e.    exp() returns natural logarithim e


f.     fabs() returns absolute value of num


g.    sqrt() returns square root of num


5.    time.h: Time and Date functions


a.    time() returns current calender time of system


b.    difftime() returns difference in secs between two times


c.    clock() returns number of system clock cycles since program execution


6.    stdlib.h:Miscellaneous functions


a.    malloc() provides dynamic memory allocation, covered in future sections


b.    rand() as already described previously


c.    srand() used to set the starting point for rand()


How to write a program in c to check whether the given number is odd or even?

#include<stdio.h>
#include<conio.h>
void main()
{
   int num;
  clrscr();
  printf("Enter any number ");
  scanf("%d",&num);
   if(num%2==0)
      printf("%d is even.",num);
  else
       printf("%d is odd.",num);
    getch();
}

Output
  Enter any number: 5
     5 is odd.

What is preprocessor?

The preprocessor is not a part of c compiler. It is an unique feature of c language. Preprocessor is a program that processes the code before it passes through the compiler. Preprocessor makes the program easy to read, modify, portable and more efficient by providing their tools.

Preprocessor directives-

Directives                       Function
#define          defines a macro substitution
#undef           undefines a macro
#include        specifies a file to be included
#ifdef            tests for macro definition
#endef          specifies the end of #if
#ifendef        tests weather the macro                               
                     is not def
#if              tests a compile time condition
#else       specify alternatives when # if  

                 test fail

Thursday, 25 July 2019

What is header files?

                        Header File

A header file is a file with extension .h which contains C function declarations and macro definitions to be shared between several source files. There are two types of header files: the files that the programmer writes and the files that comes with your compiler.

You request to use a header file in your program by including it with the C preprocessing directive #include, like you have seen inclusion of stdio.h header file, which comes along with your compiler.

Including a header file is equal to copying the content of the header file but we do not do it because it will be error-prone and it is not a good idea to copy the content of a header file in the source files, especially if we have multiple source files in a program.

A simple practice in C or C++ programs is that we keep all the constants, macros, system wide global variables, and function prototypes in the header files and include that header file wherever it is required.

What is function?

                         Function

The group of instructions and statement
which perform any task togather.
Every c program has at least one function, which is main(),  all the most trivial programs can define additional function.

Defining aFunction

The general form of a function definition in C programming language is as follows:

return_type function_name( parameter list )


{

body of the function

}

A function definition in C programming consists of a function header and a function body. Here are all the parts of a function:

 

o   Return Type: A function may return a value. The return_type is the data type of the value the function returns. Some functions perform the desired operations without returning a value. In this case, the return_type is the keyword void.

 

o   Function Name: This is the actual name of the function. The function name and the parameter list together constitute the function signature.

 

 

o   Parameters: A parameter is like a placeholder. When a function is invoked, you pass a value to the parameter. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a function. Parameters are optional; that is, a function may contain no parameters.

 

o   Function Body: The function body contains a collection of statements that define what the function does.

 

 

Example

Given below is the source code for a function called max(). This function takes two parameters num1 and num2 and returns the maximum value between the two:

 

/* function returning the max between two numbers */


int max(int num1, int num2)

{

/* local variable declaration */

int result;

if (num1 > num2)

result = num1;

else

result = num2;

return result;

}

Saturday, 13 July 2019

What is array?

Arrays a type of data structure that can store a fixed-size sequential collection of elements of the same type.
We can't take any array with a half of data types.
All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.

The bracket [  ] denotes to the compiler that for an array.

The declaration of array -

Data_type <array name>[expression]
Ex-
         Int array[10]

Intialization of array
 
Int array[10]={1,5,8,9,6,0,3,4,2,7}

Types of array -

Arrays are important to C and should need a lot more attention. The following important concepts related to array should be clear to a C programmes.

 

Multidimensional arrays

C supports multidimensional arrays. The simplest form of the multidimensional array is the two-dimensional array.

Twodimensional array

The simplest form of multidimensional array is the two-dimensional array. A two-dimensional array is, in essence, a list of one-dimensional arrays. To declare a two-dimensional integer array of size [x][y], you would write something as follows:

type arrayName [ x ][ y ];


 

Where type can be any valid C data type and arrayName will be a valid C identifier. A two-dimensional array can be considered as a table which will have x number of rows and y number of columns.

What is pointers?

A pointer is a variable which denotes the address in the memory of another variable. 
When a pointer is declared it does not point anywhere. You must set it to point somewhere before you use it. 

#include <stdio.h>

int main ()

{

int var1;

char var2[10];

printf("Address of var1 variable: %x\n", &var1 );

printf("Address of var2 variable: %x\n", &var2 );

return 0;

}

 

include <stdio.h>

in the above code is compiled and executed, it produces the following result:

Address of var1 variable: bff5a400

Address of var2 variable: bff5a3f6




Application of pointer-

Accessing data by their address for example
Parameters are argument of function main. 

Null Pointer-

It is always a good practice to assign a NULL value to a pointer variable in case you do not have an exact address to be assigned. This is done at the time of variable declaration. A pointer that is assigned NULL is called a null pointer.

The NULL pointer is a constant with a value of zero defined in several standard libraries. Consider the following program:

 

#include <stdio.h>

int main ()

{

int *ptr = NULL;

printf("The value of ptr is : %x\n", ptr );

return 0;

}

 

When the above code is compiled and executed, it produces the following result:

 

The value of ptr is 0

Monday, 3 June 2019

What is operator?

Operator-
An operator is symbol which       
used to operate variables and data.
Operator symbols helps to the users for applying the commonds to complete mathematical manipulations.
C has many operators--
1 Arithmatic operator
2 Relational operator
3 Logic operator
4 Assignment operator
5 Increment &decrement operator
6 Bitwise operator

1.Arithmetic operator-:
       
In this operator mostly mathematical symbols like plus, minus etc.
Ex.
   Operator                       work of operator
       +                              For addition
        -                              For subtraction
        *                              For multiplication
         /                             For division
        %                (modulo) for find reminder

2.Relational operator-:

These types of operator shows the relationship among to the functions.

Operator                        work of operator
      <                                is less than
      <=                       is less than or equal to
      >                                is greater than
      >=                  is greater than or equal to
      ==                              is equal to
      !=                                is not equal to

3.Logic operator-:

Operator                        work of operator
   &&                                     logic AND
     ||                                      logic OR
     !                                        logic NOT

4. Assignment operator-:

Operator                        work of operator
    =                                   for assign a value
    *=                              multiply and assign
    /=                             divide and assign
   %=                              moduls and assign
    +=                              add and assign
     -=                              substrct and assign
5.Increment and Decrement operator-:

Operator                        work of operator
   ++                                   increment
    --                                    decrement

6.Bitwise operator-:

Operator                        work of operator

    &                                     AND
     |                                     Inclusive OR
     ^                                    Exclusive OR
    <<                                    Shift left
    >>                                    Shift right
     ~                                 One's compliment

Saturday, 1 June 2019

How to write a program to add two numbers?


#include<stdio.h>
#include<conio.h>
void main()
{
  int a, b, sum;
  clrscr();
   printf("Enter your two numbers =");
  scanf("%d%d",&a,&b);
   sum=a+b;
   printf ("The sum of numbers=%d",sum);
  getch();
}
Output is--
Enter your two numbers=5
                                            9
sum of two numbers=14

Friday, 31 May 2019

How to write a c program?

After writing any program first we know about what is program? And
What are the essential rules for writing a program in c?

Program-: The collection or group of instructions & informations is called a program.

These are the some important rules for the writing a program in c--

1. Never use capital letters.
2. Use ; in last of statement.
3. Use variable to define parameters
   a, x, y, p, q.... ✔
   ax, bx, xy...... ✔
   x1, x2, x5...... ✔
   3x, 6x, 2x......❌
4. Header file should be included.
     Two header files must be included
First-
         #include<stdio.h>
    Stdio means standard input/output.
   Where .h is the extension of header file.
    The work of this header file is --
    In this files Printf() ; and scanf(); are         executed.
Second-
              #include<conio.h>
      Conio means console input/output.
       The work of this header file is--
      In this file getch() ; and clrscr();         are executed.
. The purpose of getch(); is to hold the output on the console.
. The purpose of clrscr(); is to clear all the trash data on the console.

5. If we take integer type value then we have to use
         Int
        0-9
        %d
     If we take float type value then we have to use
          float
           0.1,.57,.886
          %f
If we take charecter type value then we have to use
           Char
            a-z
             %s

6. Program will start from main().
7. After main(); start the program with curly braces {_}.
8.

Let's take an example of c program---
      #include<stdio.h>    
      #include<conio.h>
        main()
          {
             printf("my name is A.");
             getch();
           }
Output of this program is
   my name is A.
 

Note-:#<include> is pre processor command. This statement tells the pre- processors to include the information contained in the file stdio.h before it is past for the compilation.

main() - main is a special function name. Every c program has main function somewhere in the program. This function will be executed first when the program is run.
           &- is used for the address of the          value where stored.
            If you are writing a c program in turbo c software then
    To compile your program press Alt+f9
      To run the program press Ctrl+f9.

Wednesday, 29 May 2019

What are the basics of c?

In this language we can write our programs very easily.
After starting a c program first we can understand the steps which are given below⬇
1. Variable- variable is an entity whose value kept on changing throughout the program execution. We can easily change the value of any variable in whole program. It is very special case of the program. Hence it is not a rule that the value shall change. The value of variable can be same throughout the program execution.
Then we can discuss the defrences between constant and variable,
Here if we follow opposite rules of variable then we discuss about Constant it means that the value of constant might remain same throughout the program.
We can't change the value of constant in the program execution.

Let's take an example....

We defined the variable named v in a program. Let's say v=5.
After some time we can change the value of v to 7 or v to 9.
Now v=7 is getting change in the program. But we can't change the value of v if it defined as a constant.
2.Keyword-
The words whose meaning has already been defined in the c compiler is called
keyword.
The key word also called reserved words.
There are 32 keyword available in c.
-------------------------------------------------------------------
There are some keyword given below..
Int, float, char,auto, break, return, void, union, if, do, short, case etc.

I think you understand about keyword but the word compiler is new.
So we want to know about this word compiler is a device which converts users language into binary language.
Because we all know that computer reads or understand only binary language.

Friday, 17 May 2019

What is C?

C is a programming language.
The creator and designer of this language is an American named Dennis  M.Ritchie.
He written the c language at AT&T Bell Laboratories in USA 1972.
C has invented for writing the Unix operating system.
The c language formalized in 1988 by the
ANSI (American National  Standerd Institute).
The Unix, Linux and RBDMS MYSQL operating system were total written in c.
At that time many languages were using  as Basic, Algol, Fortran, Pascal etc.  These are low leval languages.But when c language came in the programmers country. Then progammers prefered c language to others.
It becomes very popular among the peoples.
We can also called it mother language because every language belongs to c language.
C is base of all computer languages.
If we learn about this language then we can understand the concepts of all programming languages.
           Features of c language
.It is case sensitive language.
.C is middle leval language.
.C is structured programming language.
.It can handle low-level activities.
.It can be compiled many variety of computer platforms.