Programming For Problem Solving

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: 2,040
Questions: 30 | Attempts: 825

SettingsSettingsSettings
Programming For Problem Solving - Quiz

MCQ Test


Questions and Answers
  • 1. 

    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. This type of function is used to solve problems that can be broken down into smaller subproblems of the same type. The function calls itself repeatedly until a base case is reached, which stops the recursion. This allows the function to solve the problem by solving the smaller subproblems and combining their solutions.

    Rate this question:

  • 2. 

    What is the output of C Program with functions.? void show(); int main() {     show();     printf("ARGENTINA ");     return 0; } void show() {     printf("AFRICA "); }

    • A.

      ARGENTINA, AFRICA

    • B.

      AFRICA, ARGENTINA

    • C.

      ARGENTINA

    • D.

      Compiler error

    Correct Answer
    B. AFRICA, ARGENTINA
    Explanation
    The correct answer is "AFRICA, ARGENTINA". In this program, the function show() is called before the printf() statement in the main function. So, when the program is executed, the show() function is called first and it prints "AFRICA". Then, the printf() statement in the main function prints "ARGENTINA". Therefore, the output of the program is "AFRICA, ARGENTINA".

    Rate this question:

  • 3. 

    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 the return statement in C can only return a single value. If multiple values need to be returned, they can be packed into a data structure such as an array or a struct, and then the function can return that data structure.

    Rate this question:

  • 4. 

    What is the output of C Program with functions.? int show(); void main() {     int a;     printf("PISTA COUNT=");     a=show();     printf("%d", a); } int show() {     return 10; }

    • A.

      PISTA COUNT=

    • B.

      PISTA COUNT=0

    • C.

      PISTA COUNT=10

    • D.

      Compiler error

    Correct Answer
    C. PISTA COUNT=10
    Explanation
    The correct answer is "PISTA COUNT=10". In the given code, the function "show()" is defined and it returns the value 10. In the main function, the variable "a" is assigned the value returned by the "show()" function, which is 10. Then, the printf statement prints the value of "a", which is 10, after the string "PISTA COUNT=". Therefore, the output of the program is "PISTA COUNT=10".

    Rate this question:

  • 5. 

    Every C Program should contain which function.?

    • A.

      main()

    • B.

      printf()

    • C.

      show()

    • D.

      scanf()

    Correct Answer
    A. main()
    Explanation
    The main() function is the entry point of a C program. It is required in every C program and serves as the starting point of program execution. The main() function is where the program begins and from where other functions can be called. It is responsible for executing the statements inside its body and returning an integer value to the operating system.

    Rate this question:

  • 6. 

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

    • A.

      1

    • B.

      2

    • C.

      4

    • D.

      8

    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 is required for the program to execute. Without the main function, the program will not be able to run. Therefore, the minimum number of functions required in a C program is 1.

    Rate this question:

  • 7. 

    What is the output of C Program with functions.? static void show(); int main() {     printf("GROW ");     show();     return 0; } static void show() {     printf("MORE"); }

    • A.

      GROW

    • B.

      GROW MORE

    • C.

      MORE GROW

    • D.

      Compiler error

    Correct Answer
    B. GROW MORE
    Explanation
    The program first prints "GROW" in the main function. Then, it calls the show() function, which prints "MORE". Therefore, the output of the program will be "GROW MORE".

    Rate this question:

  • 8. 

    What is the maximum number of statements that can present in a C function.?

    • A.

      16

    • B.

      128

    • C.

      256

    • D.

      None

    Correct Answer
    D. None
  • 9. 

    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. They are also known as parameters. These arguments are defined in the function prototype and are used to pass values to the function when it is called. The function then uses these values to perform its operations.

    Rate this question:

  • 10. 

    What is the default return value of a C function if not specified explicitly.?

    • A.

      -1

    • B.

      0

    • C.

      1

    • D.

      None

    Correct Answer
    C. 1
    Explanation
    The default return value of a C function, if not specified explicitly, is 1.

    Rate this question:

  • 11. 

    What is the output of C Program with pointers.? int main() {     int a = 4;     int *p;     p=&a;     while(*p > 0)     {         printf("%d ", *p);         (*p)--;     }     return 0; }

    • A.

      0, 0, 0, 0

    • B.

      4, 4, 4, 4

    • C.

      4 3 2 1

    • D.

      Compiler error

    Correct Answer
    C. 4 3 2 1
    Explanation
    The given C program initializes an integer variable 'a' with the value 4 and declares a pointer variable 'p'. The pointer 'p' is then assigned the address of 'a'.

    The while loop condition checks if the value pointed to by 'p' is greater than 0. Inside the loop, the value pointed to by 'p' is printed using printf and then decremented by 1. This process continues until the value pointed to by 'p' becomes 0.

    Therefore, the output of the program is "4 3 2 1", as the value of 'a' is decremented by 1 in each iteration of the loop.

    Rate this question:

  • 12. 

    What is the output of C Program with functions.? int main() {     int a=20;     printf("INDIA ");     return 1;     printf("CORONA");     return 1; }

    • A.

      INDIA CORONA

    • B.

      INDIA

    • C.

      CORONA

    • D.

      Compile Error

    Correct Answer
    B. INDIA
    Explanation
    The correct answer is "INDIA" because the program only executes the printf statement before the first return statement. The printf statement "INDIA" is executed and printed to the console, and then the program exits with a return value of 1. The printf statement "CORONA" is never executed.

    Rate this question:

  • 13. 

    What is the C keyword that must be used to achieve expected result using Recursion.?

    • A.

      printf

    • B.

      scanf

    • C.

      void

    • D.

      return

    Correct Answer
    D. return
    Explanation
    The keyword "return" must be used to achieve the expected result using recursion. This is because recursion involves a function calling itself, and the result of each recursive call needs to be returned back to the previous call in order to continue the recursion. The "return" keyword allows the function to return a value back to the caller.

    Rate this question:

  • 14. 

    Choose a correct statement about Recursive Function in C language.

    • A.

      Each recursion creates new variables at different memory locations

    • B.

      There is no limit on the number of Recursive calls

    • C.

      Pointers can also be used with Recursion but with difficulty.

    • D.

      All of these

    Correct Answer
    D. All of these
    Explanation
    The statement "All of these" is the correct answer because it encompasses all the other options. Each recursion creates new variables at different memory locations, there is no limit on the number of recursive calls, and pointers can also be used with recursion but with difficulty. Therefore, all of these statements are correct.

    Rate this question:

  • 15. 

    What are the Types of Arrays.?

    • A.

      int, long, float, double

    • B.

      struct, enum

    • C.

      char

    • D.

      All of these

    Correct Answer
    D. All of these
    Explanation
    The correct answer is "All of these". This is because the types of arrays can include int, long, float, double, struct, enum, and char. Therefore, all of these options are correct.

    Rate this question:

  • 16. 

    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 these

    Correct Answer
    C. 10 12 14
    Explanation
    The output of the program is "10 12 14" because the expression "i[a]" is equivalent to "a[i]". In each iteration of the while loop, the value of "i" is used as an index to access the corresponding element of the array "a". So, in the first iteration, "i" is 0 and "a[0]" is 10, in the second iteration, "i" is 1 and "a[1]" is 12, and in the third iteration, "i" is 2 and "a[2]" is 14. Therefore, the program prints "10 12 14" as the output.

    Rate this question:

  • 17. 

    What is an array Base Address in C language.?

    • A.

      Base address is the address of 0th index element.

    • B.

      An array b[] base address is &b[0]

    • C.

      An array b[] base address can be printed with printf("%d", b);

    • D.

      All of these

    Correct Answer
    D. All of these
    Explanation
    The correct answer is "All of these." The base address of an array in C language refers to the address of the 0th index element. It can be accessed using either the notation &b[0] or simply b. Therefore, all of the given options are correct explanations of the array base address in C language.

    Rate this question:

  • 18. 

    An entire array is always passed by ___ to a called function.

    • A.

      Call by value

    • B.

      Call by reference

    • C.

      Address relocation

    • D.

      Address restructure

    Correct Answer
    B. Call by reference
    Explanation
    In call by reference, the memory address of the entire array is passed to the called function. This means that any changes made to the array within the called function will also affect the original array in the calling function.

    Rate this question:

  • 19. 

    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 of these

    Correct Answer
    A. You need not create so many separate variables and get confused while using.
    Explanation
    C arrays are used to store multiple values of the same data type in a single variable. By using arrays, we can avoid the need to create multiple separate variables, which can lead to confusion while using them. Instead, we can access all elements of the array easily using a single array variable. This improves code maintainability for programmers and maintainers as it reduces the number of variables and simplifies the code structure. Therefore, the need for C arrays is to simplify variable management and improve code maintainability.

    Rate this question:

  • 20. 

    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 multidimensional array, we use the syntax ary[row][column], where the index starts from 0 for both rows and columns. Therefore, to access the 3rd row and 2nd element, we would use ary[2][1]. So, the correct answer is "All of these" because all the statements mentioned are true regarding multidimensional arrays in C language.

    Rate this question:

  • 21. 

    If an integer array pointer is incremented, how many bytes will be skipped to reach next element location.?

    • A.

      1

    • B.

      3

    • C.

      2

    • D.

      None

    Correct Answer
    C. 2
    Explanation
    When an integer array pointer is incremented, it skips the number of bytes equal to the size of an integer data type. In most systems, an integer data type occupies 4 bytes of memory. Therefore, when the pointer is incremented, it will skip 4 bytes to reach the next element location in the array.

    Rate this question:

  • 22. 

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

    • A.

      1

    • B.

      2

    • C.

      4

    • D.

      8

    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, with the first dimension being 10 and the second dimension being 5. The first dimension represents the number of rows in the array, while the second dimension represents the number of columns. In this case, the array has 10 rows and 5 columns, making it a two-dimensional array.

    Rate this question:

  • 23. 

    What is the output of C Program with arrays.? int main() {     static int ary[] = {1, 3, 5};     printf("%d %d", ary[-1], ary[5]);     return 0; }

    • A.

      0, 0

    • B.

      -1, -1

    • C.

      Compiler error

    • D.

      None

    Correct Answer
    A. 0, 0
    Explanation
    The program declares a static integer array "ary" with 3 elements: 1, 3, and 5. In the printf statement, it tries to access the elements at index -1 and index 5 of the array. However, both of these indices are out of bounds of the array. In C, accessing elements outside the bounds of an array results in undefined behavior. In this case, it happens to print the values 0 and 0, but this behavior is not guaranteed and may vary depending on the compiler and system.

    Rate this question:

  • 24. 

    Array of Arrays is also called.?

    • A.

      Multi Data Array

    • B.

      Multi Dimensional Array

    • C.

      Multi Size Array

    • D.

      Multi Byte Array

    Correct Answer
    B. Multi Dimensional Array
    Explanation
    An array of arrays is also known as a multi-dimensional array. This is because it is an array that contains other arrays as its elements, creating a structure with multiple dimensions. Each element in the outer array is itself an array, allowing for the storage and manipulation of data in a multi-dimensional manner.

    Rate this question:

  • 25. 

    What is an Array in C language.?

    • A.

      A group of elements of same data type.

    • B.

      An array contains more than one element

    • C.

      Array elements are stored in memory in continuous or contiguous locations.

    • D.

      All of these

    Correct Answer
    D. All of these
    Explanation
    An array in C language is a data structure that allows storing a group of elements of the same data type. It can contain more than one element, and the elements are stored in memory in continuous or contiguous locations. Therefore, all of the given options are correct explanations of what an array is in C language.

    Rate this question:

  • 26. 

    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 minimum of one function must be present in a C program because every C program must have a main() function. The main() function serves as the entry point of the program and is required for the program to execute. Without a main() function, the program would not have any instructions to execute and would not be able to run.

    Rate this question:

  • 27. 

    Choose a non Library C function below.

    • A.

      printf()

    • B.

      scanf()

    • C.

      fprintf()

    • D.

      printf2()

    Correct Answer
    D. printf2()
    Explanation
    The functions printf(), scanf(), and fprintf() are all standard C library functions. However, printf2() is not a standard C library function.

    Rate this question:

  • 28. 

    How many functions are required to create a recursive functionality.?

    • A.

      One

    • B.

      Two

    • C.

      More than two

    • D.

      None of these

    Correct Answer
    A. One
    Explanation
    To create a recursive functionality, only one function is required. A recursive function is a function that calls itself within its own definition. This allows the function to repeat a specific set of instructions until a certain condition is met. Therefore, only one function is needed to create this recursive behavior.

    Rate this question:

  • 29. 

    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 called a multi-dimensional array because it represents data in multiple dimensions. In a multi-dimensional array, each element can be accessed using multiple indices, allowing for more complex data structures to be represented.

    Rate this question:

  • 30. 

    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:

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 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 29, 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.