UNIT-1

 

>> Machine language is a low level language which uses only 1's and 0's and it is very difficult to do tasks with it 

eg:- to write 120 we have to write it in binary.

>> Assembly language is intermideate between low level and high level language as it uses symbols.

>> High level language is designed for humans and also called close to humans..


>> Compiler converts High level language code to machine code at one go before program is run.

>> Interpreter converts above code to machine code statement by statement when program is running.

so it is slower then compiler.



>> Performance often draws the line between what is feasible and what is impossible

>>The word ALGORITHM comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al Khowarizmi.


>>unformatted function don't use %d, %s etc in them but formatted do.

>>if a = 123

    %5d - ' 123'

    %-5d - '123 '

    %3.3f - '123.000'

    %3.2f - '123.00'








>> Can math operations be performed on a void pointer?(No)

           adding 2 numbers without using plus sign.


>>Type cast function should not be used in const and volatile declaration

>>setting a bit means - koi ek binary number hai 10110 so agr mko right se 4th position wali bit ko set krna hai mtlb usko 1 me convert krna aur agr phle se hi 1 hai to vaise hi chd denge.

>> clearing a bit  means opposite of setting a bit mtlb bit ko 0 me change kr denge.

>>toggle a bit means agr uss position p bit 1 hai to 0 kr denge aur age 0 hai to 1 kr denge.

#include<stdio.h>


int main()

{

    int x, k, set, clear, toggle;

    printf("Enter number\n");

    scanf("%d", &x);

    printf("Enter the postion from right you want to set, clear or toggle.\n");

    scanf("%d", &k);

    //setting a bit

    set = x | (1<<(k-1));

    //clearing a bit

    clear = x & (~(1<<(k-1)));

    //toggling a bit

    toggle = x ^ (1<<(k-1));

    

    printf("set = %d\n", set);

    printf("clear = %d\n", clear);

    printf("toggle = %d\n", toggle);

}


>>int main()

       {

           double b = 5 % 3 & 4 + 5 * 6;

           printf("%lf", b);

           return 0;

       }

output:- 2.000000

Comments