softsol sample programming placement paper

Upload: puli-naveen

Post on 04-Apr-2018

223 views

Category:

Documents


1 download

TRANSCRIPT

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    1/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    SoftSol Programming Latest Sample Placement Paper"Correct" Answers Highlighted In Bold

    1.int zap (int n)

    {

    if (n

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    2/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    }

    }

    return 0;

    }

    A) 1, 1, 1, 1

    2, 2, 2, 2

    2, 2, 2, 2

    3, 3, 3, 3

    B) 1, 2, 1, 2

    2, 3, 2, 3

    3, 4, 3, 4

    4, 2, 4, 2

    C) 1, 2, 3, 4

    2, 3, 4, 1

    3, 4, 1, 2

    4, 1, 2, 3

    D) 1, 1, 1, 1

    2, 3, 2, 3

    3, 2, 3, 2

    4, 4, 4, 4

    4.static char *i;

    i=malloc(sizeof(char));

    find the error;A)void B) malloc

    returns void

    C)malloc D)malloc returns

    null

    5.Find output .

    Int *ptr=&const;

    A)const B)*ptr C) error D)no output

    6.What will be the output of the program?class conditional {

    public static void main(String args[]) {

    int i = 20;

    int j = 55;

    int z = 0;

    z = i < j ? i : j; // ternary operator

    System.out.println("The value assigned is " + z);

    }}

    A) The value

    assigned is 20

    B) The value

    assigned is 55

    C) The value

    assigned is 0

    D) The value

    assigned is 200

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    3/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    7.Find output ..

    Function(i=10);

    A)10 B) error C)const D) no output

    8.What is the output of the following program?

    public class Question {

    public static void main(String args[]) {

    String s1 = "abc";

    String s2 = "def";

    String s3 = s1.concat(s2.toUpperCase( ) );

    System.out.println(s1+s2+s3);}

    }

    A) abcabcDEFDEF B) abcdefabcDEF C) abcdefabcdef D)None

    9.sum(int x)

    {int t;

    if(x

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    4/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    } finally {

    System.out.println("Finally");

    }

    A) Prints out:

    Exception

    B) Prints out:

    Finally

    C) Prints out:

    Exception Finally

    D) No output

    11.What is int (*ptr) [] ()?

    Main()

    {int a[]={0,2,4,6,8};

    int *ptr;

    ptr=a;

    printf(%d, *((char *) ptr+4));}

    Find output?

    A) 6 B) 2 C)4 D) 8

    12. What will be the output of the program?

    #include

    #include

    main()

    {

    char *s1 = "alpha", *s2 = "alpha";

    if(!strcmp(s1,s2)) printf("yes\n");

    }

    A) yes B)alpha C)s1 D)s2

    13.Which takes the same memory space regardless of the type of

    operating system?

    Char* char int float

    main()

    { int I=3;

    while(I--)

    {int I=100;

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    5/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    I--;

    Printf(%d, I);

    }

    }

    Find output.

    99 98 97 error ANS= 99 99 99

    A) 99 99 99 B) 100 99 98 C)99 98 97 D)98 97 99

    14.What will be the output of the program?

    #include

    #define MAXI 100

    main(){int done,i,x=6;

    done=i=0;

    for(i = 0; (i< MAXI) && (x/=2)>1; i++)

    done++;

    printf("%d %d\n",i,done);

    }

    A)6 B)1 0 0 C) 1 1 D)2 1

    15. What will be the output of the program?

    main()

    {char ch;

    for(ch=0;ch

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    6/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    int i;

    for(i=0;i

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    7/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    19. What will be the output of the program?

    #include

    struct _tag

    {

    int i;

    union

    {

    int a;

    int b;

    }c;

    } a;main()

    {

    a.c.a=10;

    printf("test %d\n",a.c.b);

    }

    A)test 0 B) test 10 C)a D)b

    20. What will be the output of the program?#include

    #include

    main()

    {

    char strp[] = "Never ever say no";

    char *chp, c='e';

    int i,j;

    chp = strrchr(strp, c);i = chp-strp;

    for(j=0;j

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    8/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    21. What will be the output of the program?

    #include

    main()

    {

    int a=10,b;

    b=a>=5?100:200;

    printf("%d\n",b);

    }

    A)50 B) 100 C)200 D)10

    22. What will be the output of the program?

    #include

    main()

    {

    int i = 10;

    printf(" %d %d %d \n", ++i, i++, ++i);

    }

    A) 11 11 13 B)11 13 13 C) 13 13 11 D) 13 11 13

    23. What will be the output of the program?

    #include

    main()

    {

    int a;

    a = (1,45,012);

    printf("%d", a);

    }

    A)100 B)45 C) 10 D) 102

    24. What will be the output of the program?

    #include

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    9/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    #include

    main()

    {

    char str[] ="DESIS India pvt. ltd.";

    const char *str1= str;

    strcpy(str1,"DESHAW");

    printf("str is %s",str);

    }

    A) str is

    DESHAW

    B) is str

    DESHAW

    C) DESHAW

    str is

    D) str DESHAW

    25. What will be the output of the program?#include

    main()

    {

    int i = 1;

    switch(i) {

    printf("\nHello, ");

    case 1: printf("One, ");

    i++;break;

    case 2: printf("Two");

    break;

    }

    }

    A) One, B)Two C)Hello D)No output

    26. What will be the output of the program?

    #include

    main()

    {

    int a[3] = {1,2,3};

    int i= 2;

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    10/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    printf("\n %d %d\n", a[i], i[a]);

    }

    A)1 2 B)3 2 C) 3 3 D)3 127. What will be the output of the program?

    #include

    #define scanf "%s DE Shaw"

    main()

    {

    printf(scanf,scanf);

    }

    A) DE %s Shaw

    DE Shaw

    B) %s DE Shaw

    DE Shaw

    C) %s Shaw DE

    Shaw DE

    D) %s DE Shaw

    Shaw DE

    28. What will be the output of the program?

    #include

    main()

    {

    int x;

    x = printf("%d\n",x=printf("%d\n",100));

    printf("%d\n",x);

    }

    A) 100

    4

    2

    B) 2

    4

    100

    C) 4

    2

    100

    D)100

    29. What will be the output of the program?

    #include

    fun(){

    printf("Yes\n");

    }

    #define fun() printf("No\n")

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    11/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    main()

    {

    fun();

    (fun)();

    }

    A) No

    Yes

    B) Yes

    Yes

    C) Yes

    No

    D) No

    No

    30. What will be the output of the program?

    #include

    main()

    {int x = 10,y=2,z;

    z=x/*y+y*/+y;

    printf("%d\n",z);

    }

    A)11 B)10 C) 12 D)2

    31. What will be the output of the program?

    #include #define DESHAWCURRENTDEBUGLEVEL 1

    void main(void)

    {

    int i = 10 ;

    int j = 15 ;

    #ifdef DESHAWCURRENTDEBUGLEVEL

    printf("%d\n",i);

    #elseprintf("%d\n",j);

    #endif

    }

    A) 10 B)1 C)100 D)15

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    12/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    32. What will be the output of the program?

    #include

    main()

    {

    int a[] = {0,1,2,3,4};

    int *p[] = {a,a+1,a+2,a+3,a+4};

    int **pp = p;

    printf("%d, %d, %d ", *pp-a, pp-p, **pp);

    pp++; pp++;;++pp;*++pp;

    printf("%d, %d, %d ", pp-p, *pp-a, **pp);

    }A)4, 0, 0, 4, 4, 4 B)0, 0, 0, 0, 4, 4 C) 0, 0, 0 4, 4, 4 D)0, 1, 2, 3, 4, 1

    33. What will be the output of the program?

    #include

    #include

    #include

    main()

    {

    int *p, *c, i;

    i = 5;

    p = malloc(sizeof(i));

    printf("\n%d",*p);

    *p = 10;

    printf("\n%d %d",i,*p);

    c = calloc(2,i);

    printf("\n%d\n",*c);

    }

    A)0

    5 10

    0

    B) 5 10

    0

    0

    C) 5 10

    1

    0

    D) 0

    10

    0

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    13/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    34. What will be the output of the program?

    #include

    main()

    {

    char *pk;

    const char* p;

    const char c = 'a';

    char c1='b';

    p=&c1;

    pk = &c;

    printf("%c %c",*pk,*p);}

    A)b a B) a b C)pk a D)a a b

    35. What will be the output of the program?

    #include

    main()

    {

    int i=4;

    if (i>5) printf("Hi");

    else f(i);

    }

    f(int j)

    {

    if (j>=4) f(j-1);

    else if(j==0)return;

    printf("Hi");return;

    }

    A) HiHi B)Hi C)iH D)iHiH

  • 7/29/2019 SoftSol Sample Programming Placement Paper

    14/14

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    Visit www.latestoffcampus.com for placement papers, interview tips & job updates. To get free

    updates to mail http://groups.google.com/group/latestoffcampus/subscribeLive updates on

    Facebook @ www.facebook.com/LatestOffCampus

    36. What will be the output of the program?

    #include

    main()

    {

    int a = 10, b = 5,c = 3,d = 3;

    if ((a