SASKEN Written Test: Technical Aptitude; Questions and Answers with Explanations PDFs

nrrbeassistance.blogspot.com - Nareddula Rajeev Reddy (NRR)
Please Like and/ Share and/ G+1. Hi, welcome to nrrbeassistance.blogspot.com. Dear viewer, especially for you, here is the SASKEN Written Test: Technical Aptitude; Questions and Answers with Explanations and PDFs Download.

1. main()    {        int a = 10,*j;        void *k;        j = k =&a;        j++;        k++;        printf("\n %u %u",j,k);    }        A.compiler error            B.syntax error            C.memory address            D.noo out put

    Answer: A

    Explanation:     cannot increment a void pointer

2. What will be the output of the program?    #include    int i;    int fun1(int);    int fun2(int);    int main()    {        extern int j;        int i=3;        fun1(i);        printf("%d,", i);        fun2(i);        printf("%d", i);        return 0;    }    int fun1(int j)    {        printf("%d,", ++j);        return 0;    }    int fun2(int i)    {        printf("%d,", ++i);        return 0;    }    int j=1;        A.3, 4, 4, 3            B.4, 3, 4, 3            C.3, 3, 4, 4            D.3, 4, 3, 4

    Answer: B

3. main(){    int i =3;    for(; i ++ = 0;)    printf("%d",i);}        A.compiler error            B.syntax error            C.some garbage value        D.no out put

    Answer: A

    Explanation:     Lvalue required in function main

4. Point out the error in the program    #include    int main()    {        int f(int);        int b;        b = f(20);        printf("%d\n", b);        return 0;    }    int f(int a)    {        a > 20? return(10): return(20);    }        A.Error: Prototype declaration        B.No error        C.Error: return statement cannot be used with conditional operators        D.None of above

    Answer: C

    Explanation:     In a ternary operator, we cannot use the return statement. The ternary operator requires expressions but not code.

5. What will be output of following c program?<p> </p>    #define max    int main()    {        printf("%d",max);        return 0;    }        A.0            B.null                C.Garbage            D.Compilation error

    Answer: D

6. What will be the output of the program?    #include    int i;    int fun();    int main()    {        while(i)        {            fun();            main();        }        printf("Hello\n");        return 0;    }    int fun()    {        printf("Hi");    }        A.Hello            B.Hi Hello                C.No output            D.Infinite loop

    Answer: A

7. What will be output of following c program?    void main()    {        int i;        for(i=0;i    A.01234            B.001234            C.0000                D.Infinite loop

    Answer: C

8. What will be the output of the program?    #include    int main()    {        int x, y, z;        x=y=z=1;        z = ++x || ++y && ++z;        printf("x=%d, y=%d, z=%d\n", x, y, z);        return 0;    }        A.x=2, y=1, z=1            B.x=2, y=2, z=1            C.x=2, y=2, z=2            D.error

    Answer: A

9. What will be output of following c program?    long fu(int);    char vect[]={1,2,3,4,5};    void main()    {        int i=1; i=fu(++i)+ ++vect[++i]+ ++i+fu(i++);        printf("%d",i);    }    long fu(int x)    {        return x*3;    }        A.31            B.32            C.33            D.34

    Answer: D

10. What will be the output of the program?    #include    int main()    {        unsigned int i = 65536;        while(i != 0)        printf("%d",++i);        printf("\n");        return 0;    }        A.Infinite loop        B.0 1 2 ... 65535            C.0 1 2 ... 32767 - 32766 -32765 -1 0        D.No output

    Answer: D

You can also see: Huawei Placement Papers

11.void main()    {        int a = 10, b =20;        char x = 1, y = 0;        if(a,b,x,y)        {            printf("Freshers World");        }    }What is the output?        A.res is printed            B.freshers world is printed            C.Compiler Error            D.Nothing is printed

    Answer: D

12. What is x in the following program?    #include int main()    {        typedef char (*(*arrfptr[3])())[10];        arrfptr x;        return 0;    }        A.x is a pointer            B.x is an array of three pointer        C.x is an array of three function pointers        D.Error in x declaration

    Answer: C

13. main()    {        char throught[2][30] ={ "Don't walk in front of me..",'i am not follow"};        printf("%c%c,*(thought[0]9),*(*(thought 0)5));    }What is the output of this program ?        A.kk        B.int**array2 = (int**)malloc(nrows*sizeof(int*));Don't walk in front of me            C.i may not follow            D.k

    Answer: D

14. What will be the output of the program ?    #include    int main()    {        int k=1;        printf("%d == 1 is" "%s\n", k, k==1?"TRUE":"FALSE");        return 0;    }        A.k == 1 is TRUE            B.1 == 1 is TRUE            C.1 == 1 is FALSE            D.K == 1 is FALSE

    Answer: B

15. main()    {        int i=5;        printf("%d",i = ++i==6);    }        A.5            B.1            C.6            D.compiler error

    Answer: B

16. Which files will get closed through the fclose() in the following program?    #include    int main()    {        FILE *fs, *ft, *fp;        fp = fopen("A.C", "r");        fs = fopen("B.C", "r");        ft = fopen("C.C", "r");        fclose(fp, fs, ft);        return 0;    }        A."A.C" "B.C" "C.C"            B."B.C" "C.C"            C."A.C"            D.Error in fclose()

    Answer: D

17. void main()    {        printf("sizeof(void *) = %d \n",sizeof(void*));        printf("sizeof(int *) = %d \n",sizeof(int*));        printf("sizeof(double*) = %d \n",sizeof(double*));        printf("sizeof(struct unknown *) = %d \n",sizeof(struct unknown*));    }        A.no out put        B.compiler error            C.sizeof(void *) = 2 sizeof(int *) = 2 sizeof(double *) = 2 sizeof(struct unknown *) = 2        D.syntax error

    Answer: C

18. Which of the following statements are correct about the program below?    #include    int main()    {        int size, i;        scanf("%d", &size);        int arr[size];        for(i=1; i        A.The code is erroneous since the subscript for array used in for loop is in the range 1 to size.        B.The code is erroneous since the values of array are getting scanned through the loop.        C.The code is erroneous since the statement declaring array is invalid.        D.The code is correct and runs successfully.

    Answer: C

19. # include     char *somefun1()    {        char temp[] ="string";        return temp;    }    char * somefun2()    {        char temp[] = { 's','t','r','i','n','g'};        return temp;    }    int main()    {        puts (somefun1());        puts(somefun2());    }        A.syntax error            B.some garbage value            C.compiler error            D.no out put

    Answer: B

20. What will be the output of the program?    #include    int fun(int(*)());    int main()    {        fun(main);        printf("Hi\n");        return 0;    }    int fun(int (*p)())    {        printf("Hello ");        return 0;    }        A.Infinite loop            B.Hi            C.Hello Hi            D.Error

    Answer: C

You can also see: HP Placement Papers

21. Point out the error, if any in the while loop.    #include    int main()    {        int i=1;        while()        {            printf("%d\n", i++);            if(i>10)            break;        }        return 0;    }        A.There should be a condition in the while loop        B.There should be at least a semicolon in the while        C.The while loop should be replaced with for loop.        D.No error

    Answer: A

22. What will be output of following c program?    void main()    {        int num,a=10;        num=a--- -a--;        printf("%d %d",num,a);    }        A.0 8            B.0 10            C.20 8            D.-1 10

    Answer: C

23. What will be output of following c program?     float avg(float,float,float);    void main()    {        float p=1,q=2,r=-2,a;        a=avg(p,(q=4,r=-12,q),r);        printf("%f",a);    }    float avg(float x,float y,float z)    {        return (x+y+z)/3;    }        A.0.111111        B.1.000000            C.-0.777777            D.-1.000000

    Answer: B

24. How many times "Freshersworld" is get printed?    #include    int main()    {        int x;        for(x=-1; x    A.Infinite times        B.11 times            C.0 times            D.10 times

    Answer: C

25. What will be output of following c program?    struct myStruct    {        int a;        char b;    }    *ptr;    int main()    {        struct myStruct ms={400,'A'};        printf("%d %d",ptr->a,ptr->b);        return 0;    }        A.400 A            B.400 6                C.400 97                D.0 0

    Answer: D

26. What will be the output of the program?    #include    int main()    {        int i;        i = scanf("%d %d", &i, &i);        printf("%d\n", i);        return 0;    }        A.1            B.2            C.Garbage value            D.Error: cannot assign scanf to variable

    Answer: B

    Explanation:     scanf() returns the number of variables to which you are provding the input. i = scanf("%d %d", &i, &i); Here Scanf() returns 2. So i = 2. printf("%d\n", i); Here it prints 2.

27. What will be output of following c program?     int main()    {        float x;        x=(int)1.1,(float)2.2,(int)3.3 ,5.4;        printf("%f",x);        return 0;    }        A.1.000000        B.5.400000            C.2.200000            D.3.300000

    Answer: A

28. Point out the correct statement which correctly allocates memory dynamically for 2D array following program?    int main()    {        int *p, i, j;        /* Add statement here */        for(i=0; i        A.p = (int*) malloc(3, 4);            B.p = (int*) malloc(3*sizeof(int));            C.p = malloc(3*4*sizeof(int));        D.p = (int*) malloc(3*4*sizeof(int));

    Answer: D

29. What will be output if you will compile and execute the following c code?    void main()    {        int i=320;        char *ptr=(char *)&i;        printf("%d",*ptr);    }        A.320            B.1            C.64            D.Compiler error

    Answer: A

30. What will be the output of the program?    #include    int main()    {        char *s;        char *fun();        s = fun();        printf("%s\n", s);        return 0;    }    char *fun()    {        char buffer[30];        strcpy(buffer, "RAM");        return (buffer);    }        A.0xffff            B.Garbage value            C.0xffee            D.Error

    Answer: B

Link: Download PDF | Learn More

Updates: Don’t miss, what you want? So kindly, 1. Like our Facebook, 2. Subscribe by E-mail, 3. Follow our Google+, 4. Twitter 5. YouTube, 6. Download our Toolbar, 7. Install our App and 8. Others.

Help: If you have any suggestions, requests and problems, please comment below or ask us here.


Alerts: Dear viewer, “Hard work never fails”. Along with hard work include smart work for your goal. Your hard work and our smart work, guarantee success. To get in touch with you, we have created a WhatsApp Group namedQuestion Answer Explanation”. Kindly send a message to +91-7893356131 as “add to Question Answer Explanation" to add you to this group.

Encourage us: Please don’t forget to G+1 and/ Like and/ Share and/ Recommend… thank you and all the best / best of luck for your bright future.

Our motto: Serve poor and needy whole heartedly – Nareddula Rajeev Reddy (NRR) and his team. 

Comments

Popular posts from this blog

Top Numerical Reasoning Questions and Answers

S.CHAND: English Grammar Composition E-Book PDF Free Download; (Student's Exercises - Activities)

Mahendra's Reasoning Ability Study Material PDF for banking (RBI, SBI, IBPS: PO, SO, Clerks), Railway RRB and other Competitive Examinations