• ( 2 ) The elements in the array of the following code are
      int array[5] = {5};

    • 1) 5, 5, 5, 5, 5
    • 2) 5, 0, 0, 0, 0
    • 3) 5, (garbage), (garbage), (garbage), (garbage)
    • 4) (garbage), (garbage), (garbage), (garbage), 5
    • Discussion in forum
      Answer : 2) 5, 0, 0, 0, 0
      Solution :








      discussion


      Answer : 2) 5, 0, 0, 0, 0

    • ( 3 ) Comment on an array of void data type:

    • 1) It can store any data-type
    • 2) It only stores element of similar data type to first element
    • 3) It acquires the data type with the highest precision in it
    • 4) You cannot have an array of void data type
    • Discussion in forum
      Answer : 4) You cannot have an array of void data type
      Solution :








      discussion


      Answer : 4) You cannot have an array of void data type

    • ( 4 ) What will be the output of the program ?
      #include
      int main()
      {
      int arr[1] = {10};
      printf("%d", 0[arr]);
      return 0;
      }

    • 1) 1
    • 2) 0
    • 3) 10
    • 4) 6
    • Discussion in forum
      Answer : 3) 10
      Solution :








      discussion


      Answer : 3) 10

    • ( 5 ) Which of the following correctly declares an array?

    • 1) int anarray[10];
    • 2) int anarray;
    • 3) anarray{10};
    • 4) array anarray[10];
    • Discussion in forum
      Answer : 1) int anarray[10];
      Solution :








      discussion


      Answer : 1) int anarray[10];

    • ( 7 ) Which of the following is correct way to define the function fun() in the below program?
      #include
      void main()
      {
      int a[3][4];
      fun(a);
      }

    • 1) void fun(int p[][4]){}
    • 2) void fun(int *p[4]){}
    • 3) void fun(int *p[][4]){}
    • 4) void fun(int *p[3][4]){}
    • Discussion in forum
      Answer : 1) void fun(int p[][4]){}
      Solution :








      discussion


      Answer : 1) void fun(int p[][4]){}

    • ( 8 ) Advantage of a multi-dimension array over pointer array.

    • 1) Pre-defined size
    • 2) Input can be taken from user.
    • 3) Faster Access.
    • 4) All of the above
    • Discussion in forum
      Answer : 4) All of the above
      Solution :








      discussion


      Answer : 4) All of the above

    • ( 9 ) What will be output if you will execute following c code?
      #include
      void main()
      {
      int const SIZE=5;
      int expr;
      double value[SIZE]={2.0,4.0,6.0,8.0,10.0};
      expr=1|2|3|4;
      printf("%f",value[expr]);
      }

    • 1) 2.000000
    • 2) 4.000000
    • 3) 6.000000
    • 4) Compilation error
    • Discussion in forum
      Answer : 4) Compilation error
      Solution :








      discussion


      Answer : 4) Compilation error

    • ( 10 ) What will be output if you will execute following c code?
      #include
      #define var 3
      void main()
      {
      char *cricket[var+~0]={"clarke","kallis"};
      char *ptr=cricket[1+~0];
      printf("%c",*++ptr);
      }

    • 1) k
    • 2) a
    • 3) l
    • 4) i
    • Discussion in forum
      Answer : 3) l
      Solution :








      discussion


      Answer : 3) l





Top