Advanced Computer Programming

25 Questions | Total Attempts: 376

SettingsSettingsSettings
Advanced Computer Programming - Quiz

Array, Pointer and Function


Questions and Answers
  • 1. 
    An array Index starts with.?
    • A. 

      -1

    • B. 

      0

    • C. 

      1

    • D. 

      2

  • 2. 
    What is the output of C Program.? int main() {     int a[];     a[4] = {1,2,3,4};     printf("%d", a[0]); }
    • A. 

      1

    • B. 

      2

    • C. 

      4

    • D. 

      Compiler error

  • 3. 
    What is the output of C Program.? int main() {     int a[] = {1,2,3,4};     int b[4] = {5,6,7,8};     printf("%d,%d", a[0], b[0]); }
    • A. 

      1,5

    • B. 

      2,6

    • C. 

      0,0

    • D. 

      Compiler error

  • 4. 
    What is the output of C program.? int main() {     char grade[] = {'A','B','C'};     printf("GRADE=%d, ", *grade);     printf("GRADE=%d", grade[0]); }
    • A. 

      A,A

    • B. 

      65,A

    • C. 

      65,65

    • D. 

      None of the above

  • 5. 
    What is the output of C program.? int main() {     int a[3] = {10,12,14};     int i=0;     while(i<3)     {         printf("%d ", i[a]);         i++;     } }
    • A. 

      14, 12, 10

    • B. 

      10, 10, 10

    • C. 

      10, 12, 14

    • D. 

      None of the above

  • 6. 
    What is the output of C program with arrays.? int main() {     int a[3] = {20,30,40};     int b[3];     b=a;     printf("%d", b[0]); }
    • A. 

      20

    • B. 

      30

    • C. 

      address of 0th element.

    • D. 

      Compiler error

  • 7. 
    What is the output of C program with arrays.? int main() {     int ary(3)=[20,30,40];     printf("%d", a(1)); }
    • A. 

      30

    • B. 

      20

    • C. 

      0

    • D. 

      Compiler error

  • 8. 
    What is the output of C program with arrays.? int main() {    char grade={'A','B','C'};    printf("%c", grade[0]); }
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      Compiler error

  • 9. 
    What is the need for C arrays.?
    • A. 

      You need not create so many separate variables and get confused while using.

    • B. 

      Using a single Array variable, you can access all elements of the array easily.

    • C. 

      Code maintainability is easy for programmers and maintainers.

    • D. 

      All the above.

  • 10. 
    What is a multidimensional array in C Language.?
    • A. 

      It is like a matrix or table with rows and columns

    • B. 

      It is an array of arrays

    • C. 

      To access 3rd tow 2nd element use ary[2][1] as the index starts from 0 row or column

    • D. 

      All of these

  • 11. 
    What is the function used to allocate memory to an array at run time without initializing array elements.?
    • A. 

      calloc()

    • B. 

      malloc()

    • C. 

      palloc()

    • D. 

      kalloc()

  • 12. 
    What is the dimension of the C array int ary[10][5].?
    • A. 

      1

    • B. 

      2

    • C. 

      5

    • D. 

      10

  • 13. 
    What is the dimension of the below C Array.? int ary[]={1,3,5,7};
    • A. 

      1

    • B. 

      2

    • C. 

      3

    • D. 

      5

  • 14. 
    Difference between C Arrays, ary[10] and cry[10][10] is.?
    • A. 

      ary[10] is a single dimensional array. cry[10][10] is a Multidimensional array.

    • B. 

      ary[10] is a multidimensional array. cry[10][10] is a single dimensional array.

    • C. 

      Size of ary[10] is sizeof(10* int). Size of cry[10][10] is sizeof(10*int).

    • D. 

      None of the above.

  • 15. 
    Choose correct C while loop syntax.
    • A. 

      while(condition) {     //statements }

    • B. 

      {     //statements }while(condition)

    • C. 

      while(condition); {     //statements }

    • D. 

      while() {     if(condition)     {         //statements     } }

  • 16. 
    A function which calls itself is called a ___ function.
    • A. 

      Self Function

    • B. 

      Auto Function

    • C. 

      Recursive Function

    • D. 

      Static Function

  • 17. 
    Choose correct statement about Functions in C Language.
    • A. 

      A Function is a group of c statements which can be reused any number of times

    • B. 

      Every Function has a return type.

    • C. 

      Every Function may no may not return a value.

    • D. 

      All of these

  • 18. 
    How many values can a C Function return at a time.?
    • A. 

      Only One Value

    • B. 

      Maximum of two values

    • C. 

      Maximum of three values

    • D. 

      Maximum of 8 values

  • 19. 
    Every C Program should contain which function.?
    • A. 

      printf()

    • B. 

      show()

    • C. 

      scanf()

    • D. 

      main()

  • 20. 
    What is the minimum number of functions to be present in a C Program.?
    • A. 

      1

    • B. 

      2

    • C. 

      3

    • D. 

      4

  • 21. 
    Arguments received by a function in C language are called ___ arguments.
    • A. 

      Definite arguments

    • B. 

      Formal arguments

    • C. 

      Actual arguments

    • D. 

      Ideal arguments

  • 22. 
    Choose a non Library C function below.
    • A. 

      printf()

    • B. 

      scanf()

    • C. 

      fprintf()

    • D. 

      printf2()

  • 23. 
    What do you call this C Function calling itself.? int funny2() {     funny2(num); }
    • A. 

      Indefinite Function

    • B. 

      Definite Function

    • C. 

      Cursive Function

    • D. 

      Recursive Function

  • 24. 
    What are types of Functions in C Language.?
    • A. 

      Library Functions

    • B. 

      User Defined Functions

    • C. 

      Both Library and User Defined

    • D. 

      None of the above

  • 25. 
    Array of Arrays is also called.?
    • A. 

      Multi Data Array

    • B. 

      Multi Size Array

    • C. 

      Multi Dimensional Array

    • D. 

      Multi Byte Array

Back to Top Back to top