knoowgle logo
HOME
TOPICS
CONTRIBUTE ADVERTISE
T & C
KNOOWGLE

C-Programing Sample test 2

  1. what is the output of the following program
  2. void print(int ** arr)
    {
       print(”0 %f, 1 %f, 2 %f “,arr[0][0],arr[0][1],arr[0][2]);
    }
    main()
    {
      int a[ ][ ]={ {1,2,3}, {4,5,6} }
      int ** arr=a;
      print(arr);
      arr++;
      print(arr);
    }

    (a)  1 2 3 4 5 6
    (b)  1 2.0 3.0 4 5.0 6.0
    (c)  unknown
    (d)  The statements would not compile.


  3. Where is the variable string stored
  4. void func(void)
    {
      char string [ ] = "This is a string";
    }

    (a)  stack
    (b)  heap
    (c)  code or text segment as per implementation
    (d)  created when func is called, stored in function stack space and destroyed as it goes out.


  5.           main()
  6. {
    int i=6;
    int *p=&i;
    free(p);
    printf(”%d”,i);
    }

    (a)  No Error
    (b)  Free can’t be used for p
    (c)  Compiler Error
    (d)  In printf we should use *p instead of i.

  7. What is the output of the following
  8. main()
    {
       int i=5;
       i=!i>3;
       printf(”%d”,i);
    }

    (a) 0
    (b) 5
    (c) 3
    (d) Error

  9. What is the output of the following         
    main()
    {
       int a[10];
       3[a] = 10;
       printf(”%d”,*(a+3));
    }

  10. (a) 3
    (b) 0
    (c) 10
    (d) Compiler Error



    Click here for answers

Google
 
Web www.knoowgle.com
Contributed by: www.knoowgle.com
Copyright 2006 knoowgle.com