Friday, January 9, 2015

Snapdeal Placement Papers - Interview Questions 2015

Snapdeal Placement Papers
Placement papers of Snapdeal 2015. Learn and practice the placement papers and interview questions answers of Snapdeal and find out how much you score before you appear for your next interview and written test.

Snapdeal Placement Papers - Interview Questions:

1. What will be output of the following program?
    int main()
    {
        float a=0.7;
        if(a<0.7)
        {
            printf("C");
        }
        else
        {
            printf("C++");
            return 0;
        }
    }

   
    A.c            B.c++            C.compiler error            D.Run time error

    Answer: A

    Explanation:
    0.7 is considered as double. where as a is considered to be float type. So a<0.7 is True.

2. Which of the statements is correct about the program?
    #include
    int main()
    {
        float a=3.14;
        char *j;
        j = (char*)&a;
        printf("%d\n", *j);
        return 0;
    }

   
    A.It prints ASCII value of the binary number present in the first byte of a float variable a.   
    B.It prints character equivalent of the binary number present in the first byte of a float variable a.   
    C.It will print 3   
    D.It will print a garbage value

    Answer: A

3. In the following program how long will the for loop get executed?
    #include<>stdio.h>
    int main()
    {
        int i;
        for(;scanf("%s", &i);
        printf("%d\n", i));
        return 0;
    }

   
    A.The for loop would not get executed at all    B.The for loop would get executed only once    C.The for loop would get executed 5 times    D.The for loop would get executed infinite times

    Answer: D

    Explanation:
    During the for loop execution scanf() ask input and then printf() prints that given input. This process will be continued repeatedly because, scanf() returns the number of input given, the condition is always true(user gives a input means it reurns     '1'). Hence this for loop would get executed infinite times.

4. What will be output of the following program?
    int main()
    {
        int a=0,b=10;
        if(a=0)
        {
            printf("true");
        }
        else
        {
            printf("false");
        }
    return 0;
    }

   
    A.true            B.false            C.cannot be determined            D.compiler error

    Answer: B

5. Output of following code?
    void main()
    {
        int a=5,b=10,c=1;
        if(a&&b>c)
        {
            printf("Freshers World");
        }
        else
        {
            break;
        }
    }

   
    A.Freshers World        B.It will print nothing        C.Run time error        D.Compilation error

    Answer: D

    Explanation:
    Keyword break is not syntactical part of if-else statement

6. Point out the error in the following program.
    #include
    int main()
    {
        display();
        return 0;
    }
    void display()
    {
        printf("Fresherswordl.com");
    }

   
    A.No error        B.display() doesn't get invoked        C.display() is called before it is defined        D.None of these

    Answer: C

7. What will be output when you will execute following c code?
    #include
    void main()
    {
        if(sizeof(void))
        printf("M. Muralilidaran");
        else
        printf("Harbhajan Singh");
    }

   
    A.M. Muralilidaran        B.Harbhajan Singh            C.Warning: Condition is always false        D.Compilation error

    Answer: D

    Explanation:
    It illegal to find size of void data type using sizeof operator.

8. What does the following code do?

    void afunction(int *x)
    {
        x=new int;
        *x=12;
    }
    int main()
    {
        int v=10;
        afunction(&v);
        cout<
    }

   
    A.Outputs 12            B.Outputs 10        C.Outputs the address of v            D.none of these
   
    Answer: B

9. What will be output when you will execute following c code?
    void main()
    {
        int a=10;
        if(printf("%d",a>=10)-10)
        for(;;)
        break;
        else;
    }
   

    A.It will print nothing        B.0            C.1            D.Compilation error: Misplaced else

    Answer: C

10. Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4
   
    A.Quick Sort            B.Bubble Sort        C.Merge Sort        D.none of these

    Answer: B




11. What will be output when you will execute following c code?
    void main()
    {
        int a=-5;
        unsigned int b=-5u;
        if(a==b)
        printf("Avatar");
        else
        printf("Alien");
    }

   
    A.Avatar            B.Alien            C.Run time error            D.Error: Illegal assignment

    Answer: A

12. Which of the following statements are correct about the program?
    #include
    int main()
    {
        unsigned int num;
        int c=0;
        scanf("%u", &num);
        for(;num;num>>=1)
        {
            if(num & 1)
            c++;
        }
        printf("%d", c);
        return 0;
    }

   
    A.It counts the number of bits that are ON (1) in the number num.        B.It counts the number of bits that are OFF (0) in the number num        C.It sets all bits in the number num to 1    D.Error

    Answer: A

13. What will be output of the following c program?
    int main()
    {
        int max-val=100;
        int min-val=10;
        int avg-val;
        avg-val = max-val + min-val / 2;
        printf("%d",avg-val);
        return 0;
    }

   
    A.55            B.105            C.60            D.Compilation error

    Answer: D

14. What will be the output of the program ?

    #include
    struct course { int courseno; char coursename[25]; };

    int main()

    { struct course c[] = { {102, "Java"},

    {103, "PHP"}, {104, "DotNet"} };

    printf("%d", c[1].courseno);

    printf("%s\n", (*(c+2)).coursename); return 0; }


   
    A.103 Dotnet            B.102 Java            C.103 PHP            D.104 DotNet

    Answer: A

15. What will be output of the following c program?
    #include
    static num=5;
    int num;
    extern int num;
    int main()
    {
        printf("%d",num);
        return 0;
    }

   
    A.0            B.5            C.10            D.Compilation error

    Answer: B

    Explanation:
    Two or more global variables can have same name but we can initialize only one of them.

16. Which of the following statements correct about the below program?
    #include
    int main()
    {
        union a
        {
            int i;
            char ch[2];
        };
        union a u1 = {512};
        union a u2 = {0, 2};
        return 0;
    }
1: u2 CANNOT be initialized as shown.
2: u1 can be initialized as shown.
3: To initialize char ch[] of u2 '.' operator should be used.
4: The code causes an error 'Declaration syntax error'
   

A.1, 2
   
B.2, 3
   
C.1, 2, 3
   
D.1, 3, 4

    Answer: C

17. What will be output of the following c program?
    int main()
    {
        int xyz=20;
        int xyz;
        printf("%d",xyz);
        return 0;
    }

   
    A.20            B.0            C.Garbage        D.Compilation error

    Answer: D

    Explanation:
    Two local variables cannot have same name in same scope.

18. What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes?
    #include
    int main()
    {
        int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
        printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1));
        return 0;
    }

   
    A.448, 4, 4        B.520, 2, 2        C.1006, 2, 2        D.Error

    Answer: C

19. int main()
    {
        struct a
        {
            int a;
        };
        struct a b={10};
        printf("%d",b.a);
        return 0;
    }

   
    A.0            B.10            C.Garbage value        D.Compilation error

    Answer: B

    Explanation:
    Two variables can have same name in different scope.

20. What will be the output of the program ?
    #include
    int main()
    {
        char str[20] = "Hello";
        char *const p=str;
        *p='M';
        printf("%s\n", str);
        return 0;
    }

   
    A.Mello            B.Hello            C.HMello            D.MHello

    Answer: A




21. What will be output when you will execute following c code?
    #include
    void main()
    {
        int a=2;
        if(a--,--a,a)
        printf("The Dalai Lama");
        else
        printf("Jim Rogers");
    }
   

    A.The Dalai Lama        B.Jim Rogers        C.Run time error        D.Compilation error: Multiple parameters in if statement

    Answer: B

22. Which of the following data structures is on average the fastest for retrieving data:
   
    A.Binary Tree        B.Hash Table        C.Stack            D.none of these

    Answer: B

23. #include
    void main()
    {
        switch(*(1+"AB" "CD"+1))
        {
            case 'A':printf("Pulp Fiction");
            break;
            case 'B':printf("12 Angry Man");
            break;
            case 'C':printf("Casabance");
            break;
            case 'D':printf("Blood Diamond");
        }
    }

   
    A.Pulp Fiction        B.12 Angry Man        C.Casabance            D.Blood Diamond

    Answer: C

24. #include
    enum power{ Dalai, Vladimir=3, Barack, Hillary };
    void main()
    {
        float leader[Dalai+Hillary]={1.f,2.f,3.f,4.f,5.f};
        enum power p=Barack;
        printf("%0.f",leader[p>>1+1]);
    }

   
    A.1            B.2            C.3            D.Compilation error

    Answer: B

25. What will be output of following snippet?
    #define TRUE 1
    void main()
    {
        switch(TRUE)
        {
            printf("Freshers shine");
        }
    }

   
    A.Freshers shine        B.It will print nothing        C.Runtime error        D.Compilation error

    Answer: B

    Explanation:
    In c it is possible a switch case statement without any case but it is meaning less.

26. #include void main()
    {
        int arr[][3]={{1,2},{3,4,5},{5}};
        printf("%d %d %d",sizeof(arr),arr[0][2],arr[1][2]);
    }

   
    A.12 3 5            B.18 0 5            C.12 0 5            D.18 3 5

    Answer: B

27. What will be output of following snippet?
    #include
    void main()
    {
        int a=3,b=2;
        a=a==b==0;
        switch(1)
        {
            a=a+10;
        }
        sizeof(a++);
        printf("%d",a);
    }

   
    A.1            B.10            C.11            D.12

    Answer: A

    Explanation:
    Consider on the expression: a=a==b==0; a=(a==b)==0; //Since associate is right to left a =(3==2)==0 a=0==0 a=1

28. What will be output of following snippet?
    #include
    void main()
    {
        char arr[11]="The African Queen";
        printf("%s",arr);
    }

   
    A.The African Queen        B.The            C.The African        D.Compilation error

    Answer: D

29. What will be output of following snippet?
    #define MAN(x,y) (x)>(y)?(x):(y)
    void main()
    {
        int i=10,j=9,k=0;
        k=MAN(i++,++j);
        printf("%d %d %d",i,j,k);
        getch();
    }

   
    A.10,9,0            B.10,10,10            C.10,11,11        D.11 11 11

    Answer: D

30. What will be the output of the program?
    #include
    typedef struct error {int warning, err, exception;} ERROR;
    int main()
    {
        ERROR e;
        e.err=1;
        printf("%d\n", e.err);
        return 0;
    }

   
    A.0            B.1            C.2            D.error

    Answer: B

No comments:
Write comments