Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger


Sunday, 20 July 2008

Aptitude - General Paper - 5

C,C++ & Unix paper:

C++ paper:

  1. cin is an

    a.function

    b.object

    c.class.

  2. what is the use of scope resolution operator?

  3. advantage of inline function?

  4. copy constructor is ans:call by value.

  5. ques on vertual destructor?

  6. inautix one ques?

  7. one q, on container class?

  8. con,t remember the ques but the ans is Virtual base class

C paper

  1. How will u terminate the statement? ans: ;

  2. select the wrong one

    a.a+=1;

    b.a*=2;

    c.a**=1;(ans)

    d.a>>=1;

  3. main()

    {

    int n,i=1;

    switch(n)

    {

    case 1:

    some stuff;

    case 2:

    some stuff;

    default:

    i=10;

    }

    printf("i=%d",i);

    }

    what will be value of i; ans:non of the above



    4.pick ut the wrong one

    #typedef some stuff

    {

    ---

    };

  4. pick ut the wrong one

    #typedef some stuff

    {

    ---

    };

  5. one q,s on do loop?

  6. pick the odd one

    a.malloc

    b.calloc

    c.new(ans)

  7. char *ptr;

    p=malloc(20);

    How will u de allocate the memory?

    a.delete.

    b.free.

  8. main()

    {

    char **p=="Hello";

    printf("%s",**p);

    }Ans: Garbage or nothing

  9. main()

    {

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

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

    }Ans: Garbage Value

  10. main()

    {

    int x==5;

    printf("%d%d",x++,++x);

    }Ans==6 6

  11. main()

    {

    int x==4;

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

    }Ans: 4 4 5

  12. main()

    {

    union

    {

    int i;

    char p;

    struct

    {

    int t;

    char e;

    char o;

    };

    };

    printf("%d\n",sizeof(l) );

    }Ans: 4

  13. main()

    {

    int i==0,n==6;

    while(n--0);

    i+==n;

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

    }Ans: -1

  14. main()

    {

    char a[]=="Hello";

    printf("%c\n",*a++);

    }

    Ans: Error

  15. a=3,b=2,c=1;

    What,s the value of k?

    k= a< b < c-1;

    Ans: 0

  16. main()

    {

    int a==3;

    do

    {

    printf("%d", a);

    a= 1;

    } while(a0);

    }

    Ans: 3

  17. It is not "exact" Question; But the given Answers is:

    a) PASS1 PASS2

    b) PASS1 FAIL1

    c)FAIL1 FAIL2

    d)FAIL1 PASS2

    main()

    {

    char c==-32;

    int i==-64;

    unsigned u==-26;

    if(ci)

    printf("PASS1");

    if( i < c)

    printf("PASS2");

    else

    printf("FAIL1");

    if(i
    printf("PASS2");

    else

    printf("FAIL2");

    }Ans: PASS1 PASS2 PASS1

  18. main()

    {

    int i==0;

    for( i==0; i<= ;i++)

    {

    switch(i)

    {

    case 0: i+==5;

    case 1: i+==2;

    case 2: i+==5;

    default: i+==4;

    break;

    }

    printf("%d",i);

    }

    Ans: 16 21

  19. main()

    {

    int i==4;

    switch(i)

    {

    case 1:

    printf("HEllo"):

    case default: // "case" should not come with "default"

    printf("****");

    }

    }

    Ans: Error

  20. main()

    {

    int sum= 0,count;

    for(count= 1;sum+= count)

    printf("%d\t",sum);

    }

    Ans: Error

  21. #define cond(a) a=e && a<=0

    main()

    {

    char s=,R,;

    if( cond(s) )

    printf("UPPER CASE");

    else

    printf("LOWER CASE");

    } Ans:UPPER CASE

  22. .main()

    {

    static int i==5;

    printf("%d\t",i--);

    if( i)

    main();

    }Ans: 5 4 3 2 1

  23. main()

    {

    char *a1=="new",*a2=="dictionary",*t;

    swap(a1,a2);

    printf("(%s%s)",a1,a2);

    t=¡;

    a1=¢;

    a2= t;

    printf("-(%s%s)",a1,a2);

    }

    swap( char *s1,char *s2)

    {

    char *temp;

    s1==s2;

    s2=s1;

    temp= s1;

    }

    Ans: (newdictionary)-(dictionarynew)

  24. main()

    {

    char *a1= "new",*a2= "dictionary",*t;

    swap(a1,a2);

    printf("(%s%s)",a1,a2);

    t=¡;

    a1=¢;

    a2=t;

    printf("-(%s%s)",a1,a2);



    }

    swap( char *s1,char *s2)

    {

    char *temp;

    s1= s2;

    s2= s1;

    temp= s1;

    }

    Ans: (newdictionary)-(dictionarynew)

  25. main()

    {

    int a[]=={ 10,20,30,40,50};

    char*p==(char*)a;

    printf("%d", * ( (int *) p+4);

    }Ans: 50

UNIX paper:

  1. How will u do version maintaince? sccs(source code control system)

  2. a program in shell script? find the o/p.

  3. awk $2

  4. which signal u can,t catch?ans:sigkill

  5. core dump is due to ?ans:segmentation fault.

  6. .echo "todays date is ,date,"; o/p = ?

  7. process synchronisation is done by ?ans:s,phore

  8. process synchronisation is done by ?ans:s,phore

No comments:

Post a Comment