1. Question:What is difference between uninitialized pointer and null pointer? 

    Answer
    An uninitialized pointer is a pointer which points unknown memory location while null pointer is pointer which points a null value or base address of segment. For example: 
    
    int *p;   //Uninitialized pointer
    int *q= (int *)0;  //Null pointer
    #include<stdio.h>
    int *r=NULL;   //Null pointer
    
    What will be output of following c program?
    #include<string.h>
    #include<stdio.h>
    int main(){
        char *p;  //Uninitialized pointer
        char *q=NULL;   //Null pointer;
        strcpy(p,"cquestionbank");
        strcpy(q,"cquestionbank");
        
        printf("%s  %s",p,q);
        return 0;
    }
    Output: cquestionbank (null)






    1. Report
  2. Question:What are the parameter passing conventions in c? 

    Answer
    Explanation:
    1. pascal: In this style function name should (not necessary ) in the uppercase .First parameter of function call is passed to the first parameter of function definition and so on. 
    
    2. cdecl: In this style function name can be both in the upper case or lower case. First parameter of function call is passed to the last parameter of function definition. It is default parameter passing convention.
    Examples: 
    
    1. What will be output of following program?
    int main(){
    static int a=25;
    void cdecl conv1() ;
    void pascal conv2();
    conv1(a);
    conv2(a);
    return 0;
    }
    void cdecl conv1(int a,int b){
    printf("%d %d",a,b);
    }
    void pascal conv2(int a,int b){
    printf("\n%d %d",a,b);
    }
    Output: 25 0 0 25 (2) What will be output of following program?
    void cdecl fun1(int,int);
    void pascal fun2(int,int);
    int main(){
        int a=5,b=5;
       
        fun1(a,++a);
        fun2(b,++b);
       return 0;
    }
    void cdecl fun1(int p,int q){
        printf("cdecl:  %d %d \n",p,q);
    }
    void pascal fun2(int p,int q){
        printf("pascal: %d %d",p,q);
    }
    Output: cdecl:  6 6 pascal: 5 6 (3) What will be output of following program?
    void cdecl fun1(int,int);
    void pascal fun2(int,int);
    int main(){
        int a=5,b=5;
       
        fun1(a,++a);
        fun2(b,++b);
        return 0;
    }
    void cdecl fun1(int p,int q){
        printf("cdecl:  %d %d \n",p,q);
    }
    void pascal fun2(int p,int q){
        printf("pascal: %d %d",p,q);
    }
    Output: cdecl:  6 6 pascal: 5 6 (4) What will be output of following program?
    void convention(int,int,int);
    int main(){
        int a=5;
       
        convention(a,++a,a++);
        return 0;
    
    void  convention(int p,int q,int r){
        printf("%d %d %d",p,q,r);
    }
    Output: 7 7 5 (5) What will be output of following program?
    void pascal convention(int,int,int);
    int main(){
        int a=5;
       
        convention(a,++a,a++);
        return 0;}
    void pascal  convention(int p,int q,int r){
        printf("%d %d %d",p,q,r);
    }
    Output: 5 6 6 (6) What will be output of following program?
    void pascal convention(int,int);
    int main(){
        int a=1;
       
        convention(a,++a);
        return 0;
    }
    void pascal  convention(int a,int b){
        printf("%d %d",a,b);
    }
    Output: 1 2 (7) What will be output of following program?
    void convention(int,int);
    int main(){
        int a=1;
       
        convention(a,++a);
        return 0;}
    void  convention(int a,int b){
        printf("%d %d",a,b);
    }
    Output: 2 2






    1. Report
  3. Question:What is the far pointer in c? 

    Answer
    Explanation:
    The pointer which can point or access whole the residence memory of RAM i.e. which can access all 16 segments is known as far pointer.
    
    
    Size of far pointer is 4 byte or 32 bit. Examples:
    
    (1) What will be output of following c program?
    int main(){
    int x=10;
    int far *ptr;
    ptr=&x;
    printf("%d",sizeof ptr);
    return 0;
    }
    Output: 4 (2)What will be output of following c program?
    int main(){
    int far *near*ptr;
    printf("%d %d",sizeof(ptr) ,sizeof(*ptr));
    return 0;
    }
    Output: 4 2 Explanation: ptr is far pointer while *ptr is near pointer. (3)What will be output of following c program?
    int main(){
    int far *p,far *q;
    printf("%d %d",sizeof(p) ,sizeof(q));
    }
    Output: 4 4 First 16 bit stores: Segment number Next 16 bit stores: Offset address Example:
    int main(){
    int x=100;
    int far *ptr;
    ptr=&x;
    printf("%Fp",ptr);
    return 0;
    }
    Output: 8FD8:FFF4 Here 8FD8 is segment address and FFF4 is offset address in hexadecimal number format. Note: %Fp is used for print offset and segment address of pointer in printf function in hexadecimal number format. In the header file dos.h there are three macro functions to get the offset address and segment address from far pointer and vice versa. 1. FP_OFF(): To get offset address from far address.<br />2. FP_SEG(): To get segment address from far address. 3. MK_FP(): To make far address from segment and offset address. Examples: (1) What will be output of following c program?
    #include "dos.h"
    int main(){
    int i=25;
    int far*ptr=&i;
    printf("%X %X",FP_SEG(ptr),FP_OFF(ptr));
    }
    Output: Any segment and offset address in hexadecimal number format respectively. 2)What will be output of following c program?
    #include "dos.h"
    int main(){
    int i=25;
    int far*ptr=&i;
    unsigned int s,o;
    s=FP_SEG(ptr);
    o=FP_OFF(ptr);
    printf("%Fp",MK_FP(s,o));
    return 0;
    }
    Output: 8FD9:FFF4 (Assume) Note: We cannot guess what will be offset address; segment address and far address of any far pointer .These address are decided by operating system. Limitation of far pointer: We cannot change or modify the segment address of given far address by applying any arithmetic operation on it. That is by using arithmetic operator we cannot jump from one segment to other segment. If you will increment the far address beyond the maximum value of its offset address instead of incrementing segment address it will repeat its offset address in cyclic order. Example: (q) What will be output of following c program?
    int main(){
    int i;
    char far *ptr=(char *)0xB800FFFA;
    for(i=0;i<=10;i++){
    printf("%Fp \n",ptr);
    ptr++;
    }
    return 0;
    }
    Output: B800:FFFA B800:FFFB B800:FFFC B800:FFFD B800:FFFE B800:FFFF B800:0000 B800:0001 B800:0002 B800:0003 B800:0004 This property of far pointer is called cyclic nature of far pointer within same segment. Important points about far pointer: 1. Far pointer compares both offset address and segment address with relational operators. Examples: (1) What will be output of following c program?
    int main(){
    int far *p=(int *)0X70230000;
    int far *q=(int *)0XB0210000;
    if(p==q)
    printf("Both pointers are equal");
    else
    printf("Both pointers are not equal");
    return 0;
    }
    Output: Both pointers are not equal (2) What will be output of following c program?
    int main(){
    int far *p=(int *)0X70230000;
    int far *q=(int *)0XB0210000;
    int near *x,near*y;
    x=(int near *)p;
    y=(int near *)q;
    if(x==y)
    printf("Both pointer are equal");
    else
    printf("Both pointer are not equal");
    return 0;
    }
    Output: Both pointers are equal 2. Far pointer doesn’t normalize.






    1. Report
  4. Question:Definition of Palindrome number or What is palindrome number? 

    Answer
    A number is called palindrome number if it is remain same when its digits are reversed. For example 121 is palindrome number. When we will reverse its digit it will remain same number i.e. 121
    Palindrome numbers examples: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191 etc.






    1. Report
  5. Question:What is an Armstrong number? Define according to c programming point of view 

    Answer
    Those numbers which sum of the cube of its digits is equal to that number are known as Armstrong numbers. For example 153 since 1^3 + 5^3 + 3^3 = 1+ 125 + 9 =153
    Other Armstrong numbers: 370,371,407 etc.
    In general definition:
    Those numbers which sum of its digits to power of number of its digits is equal to that number are known as Armstrong numbers.Example 1: 153
    Total digits in 153 is 3
    And 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153Example 2: 1634
    Total digits in 1634 is 4
    And 1^4 + 6^4 + 3^4 +4^4 = 1 + 1296 + 81 + 64 =1634
    Examples of Armstrong numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834, 1741725






    1. Report
Copyright © 2025. Powered by Intellect Software Ltd