Advanced Computer Programming

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Prof. Rakesh
P
Prof. Rakesh
Community Contributor
Quizzes Created: 4 | Total Attempts: 1,791
Questions: 25 | Attempts: 538

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

    Correct Answer
    B. 0
    Explanation
    The correct answer is 0. In most programming languages, arrays are zero-indexed, meaning that the first element of an array has an index of 0. This means that if we have an array with n elements, the indices will range from 0 to n-1.

    Rate this question:

  • 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

    Correct Answer
    D. Compiler error
    Explanation
    The given code will result in a compiler error. This is because the array "a" is declared without a size, which is not allowed in C. The size of the array needs to be specified when declaring it.

    Rate this question:

  • 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

    Correct Answer
    A. 1,5
    Explanation
    The output of the given C program is "1,5". This is because the program declares two arrays, "a" and "b", and initializes them with different values. The printf statement then prints the first elements of both arrays, which are 1 from array "a" and 5 from array "b".

    Rate this question:

  • 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

    Correct Answer
    C. 65,65
    Explanation
    The program declares a character array called "grade" and initializes it with the values 'A', 'B', and 'C'. The first printf statement prints the value of the first element of the array using the dereference operator (*grade), which is the ASCII value of 'A', which is 65. The second printf statement prints the value of the first element of the array using the index notation (grade[0]), which again is the ASCII value of 'A', which is 65. Therefore, the output of the program is "GRADE=65, GRADE=65".

    Rate this question:

  • 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

    Correct Answer
    C. 10, 12, 14
    Explanation
    The program initializes an integer array 'a' with values 10, 12, and 14. It then enters a while loop that runs as long as the variable 'i' is less than 3. Inside the loop, it prints the value of 'i[a]', which is equivalent to 'a[i]'. Since 'i' starts at 0 and increments by 1 each iteration, the program prints the values of 'a' in order: 10, 12, 14. Therefore, the output of the program is "10, 12, 14".

    Rate this question:

  • 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

    Correct Answer
    D. Compiler error
    Explanation
    The given program will result in a compiler error. This is because arrays cannot be assigned to each other directly in C. The line "b=a;" is trying to assign the array "a" to the array "b", which is not allowed.

    Rate this question:

  • 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

    Correct Answer
    D. Compiler error
    Explanation
    The given C program has a compiler error. The correct way to declare and initialize an array in C is by using square brackets [], not parentheses (). Therefore, the line "int ary(3)=[20,30,40];" should be changed to "int ary[3]={20,30,40};".

    Rate this question:

  • 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

    Correct Answer
    D. Compiler error
    Explanation
    The given C program will result in a compiler error. This is because the array "grade" is declared as a character array but it is initialized with multiple characters instead of a string. In C, a string should be enclosed in double quotes. Therefore, the correct way to initialize the array would be: char grade[] = "ABC";

    Rate this question:

  • 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.

    Correct Answer
    D. All the above.
    Explanation
    The need for C arrays is to avoid creating multiple separate variables and getting confused while using them. With a single array variable, all elements of the array can be easily accessed. This improves code maintainability for programmers and maintainers. Therefore, the correct answer is "All the above."

    Rate this question:

  • 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

    Correct Answer
    D. All of these
    Explanation
    A multidimensional array in C Language is an array of arrays. It is like a matrix or table with rows and columns. To access a specific element in the array, the index starts from 0 for both rows and columns. Therefore, to access the element in the 3rd row and 2nd column, the index would be ary[2][1]. So, the correct answer is "All of these" as all the statements mentioned in the options are true about a multidimensional array in C Language.

    Rate this question:

  • 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()

    Correct Answer
    B. malloc()
    Explanation
    The function used to allocate memory to an array at run time without initializing array elements is malloc(). This function is used in C programming language to dynamically allocate memory for a specified number of bytes. It returns a pointer to the allocated memory, which can then be used to access and manipulate the array elements. Unlike calloc(), malloc() does not initialize the allocated memory to zero.

    Rate this question:

  • 12. 

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

    • A.

      1

    • B.

      2

    • C.

      5

    • D.

      10

    Correct Answer
    B. 2
    Explanation
    The dimension of the C array int ary[10][5] is 2. This is because the array has two dimensions - the first dimension has a size of 10 and the second dimension has a size of 5.

    Rate this question:

  • 13. 

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

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      5

    Correct Answer
    A. 1
    Explanation
    The dimension of the given C array is 4. This is because the array "ary" contains 4 elements: 1, 3, 5, and 7.

    Rate this question:

  • 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.

    Correct Answer
    A. ary[10] is a single dimensional array. cry[10][10] is a Multidimensional array.
    Explanation
    The correct answer is that ary[10] is a single dimensional array and cry[10][10] is a multidimensional array. This is because ary[10] is declared as a one-dimensional array with a size of 10, while cry[10][10] is declared as a two-dimensional array with dimensions of 10 by 10.

    Rate this question:

  • 15. 

    Choose correct C while loop syntax.

    • A.

      while(condition) {     //statements }

    • B.

      {     //statements }while(condition)

    • C.

      while(condition); {     //statements }

    • D.

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

    Correct Answer
    A. while(condition) {     //statements }
    Explanation
    The correct answer is "while(condition) { //statements }" because this is the standard syntax for a while loop in C. The loop will continue executing as long as the condition is true, and the statements inside the loop will be executed repeatedly until the condition becomes false.

    Rate this question:

  • 16. 

    A function which calls itself is called a ___ function.

    • A.

      Self Function

    • B.

      Auto Function

    • C.

      Recursive Function

    • D.

      Static Function

    Correct Answer
    C. Recursive Function
    Explanation
    A function which calls itself is called a recursive function.

    Rate this question:

  • 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

    Correct Answer
    D. All of these
    Explanation
    The correct answer is "All of these". This means that all of the statements provided are correct about Functions in C Language. A function is a group of C statements that can be reused multiple times. Every function has a return type, and every function may or may not return a value.

    Rate this question:

  • 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

    Correct Answer
    A. Only One Value
    Explanation
    A C function can only return one value at a time. This is because C does not support multiple return values. If a function needs to return multiple values, it can use pointers or structures to achieve that.

    Rate this question:

  • 19. 

    Every C Program should contain which function.?

    • A.

      printf()

    • B.

      show()

    • C.

      scanf()

    • D.

      main()

    Correct Answer
    D. main()
    Explanation
    The correct answer is "main()". In C programming, every program should contain a main() function. This function is the entry point of the program and is executed first when the program is run. It is mandatory to have a main() function in every C program.

    Rate this question:

  • 20. 

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

    • A.

      1

    • B.

      2

    • C.

      3

    • D.

      4

    Correct Answer
    A. 1
    Explanation
    A C program must have at least one function, which is the main function. The main function is the entry point of the program and it is where the execution of the program begins. Without the main function, the program cannot be executed. Therefore, the minimum number of functions required in a C program is 1.

    Rate this question:

  • 21. 

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

    • A.

      Definite arguments

    • B.

      Formal arguments

    • C.

      Actual arguments

    • D.

      Ideal arguments

    Correct Answer
    B. Formal arguments
    Explanation
    Formal arguments are the arguments received by a function in C language. These arguments are declared in the function prototype and function definition. They act as placeholders for the actual arguments that are passed to the function when it is called.

    Rate this question:

  • 22. 

    Choose a non Library C function below.

    • A.

      printf()

    • B.

      scanf()

    • C.

      fprintf()

    • D.

      printf2()

    Correct Answer
    D. printf2()
    Explanation
    The function printf2() is not a standard C library function. It is not included in the standard C library and is not recognized by the compiler. Therefore, it is a non-library C function.

    Rate this question:

  • 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

    Correct Answer
    D. Recursive Function
    Explanation
    The given C function is calling itself, which is known as recursion. Recursion is a process in which a function calls itself as a subroutine. Therefore, the correct answer is "Recursive Function".

    Rate this question:

  • 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

    Correct Answer
    C. Both Library and User Defined
    Explanation
    The correct answer is "Both Library and User Defined". In C language, there are two types of functions - library functions and user-defined functions. Library functions are built-in functions provided by the C programming language and are stored in libraries. These functions can be directly used in a program without the need for any additional code. User-defined functions, on the other hand, are created by the programmer to perform specific tasks. These functions are defined and implemented by the programmer and can be reused multiple times in the program.

    Rate this question:

  • 25. 

    Array of Arrays is also called.?

    • A.

      Multi Data Array

    • B.

      Multi Size Array

    • C.

      Multi Dimensional Array

    • D.

      Multi Byte Array

    Correct Answer
    C. Multi Dimensional Array
    Explanation
    An array of arrays is also known as a multi-dimensional array. This type of array allows for the organization of data in multiple dimensions, such as rows and columns. Each element in a multi-dimensional array can be accessed using multiple indices. This type of array is commonly used in programming languages to represent matrices or tables of data.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 21, 2020
    Quiz Created by
    Prof. Rakesh
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.