1.
A function which calls itself is called a ___ 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.
2.
What is the output of C Program with functions.?
void show();
int main()
{
show();
printf("ARGENTINA ");
return 0;
}
void show()
{
printf("AFRICA ");
}
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".
3.
How many values can a C Function return at a time.?
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.
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;
}
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".
5.
Every C Program should contain which function.?
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.
6.
What is the minimum number of functions to be present in a C Program.?
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.
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");
}
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".
8.
What is the maximum number of statements that can present in a C function.?
Correct Answer
D. None
9.
Arguments received by a function in C language are called ___ 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.
10.
What is the default return value of a C function if not specified explicitly.?
Correct Answer
C. 1
Explanation
The default return value of a C function, if not specified explicitly, is 1.
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;
}
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.
12.
What is the output of C Program with functions.?
int main()
{
int a=20;
printf("INDIA ");
return 1;
printf("CORONA");
return 1;
}
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.
13.
What is the C keyword that must be used to achieve expected result using Recursion.?
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.
14.
Choose a correct statement about Recursive Function in C language.
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.
15.
What are the Types of Arrays.?
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.
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++;
}
}
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.
17.
What is an array Base Address in C language.?
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.
18.
An entire array is always passed by ___ to a called function.
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.
19.
What is the need for C arrays.?
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.
20.
What is a multidimensional array in C Language.?
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.
21.
If an integer array pointer is incremented, how many bytes will be skipped to reach next element location.?
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.
22.
What is the dimension of the C array int ary[10][5].?
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.
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;
}
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.
24.
Array of Arrays is also called.?
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.
25.
What is an Array in C language.?
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.
26.
What is the minimum number of functions to be present in a C Program.?
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.
27.
Choose a non Library C function below.
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.
28.
How many functions are required to create a recursive functionality.?
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.
29.
Array of Arrays is also called.?
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.
30.
What is the dimension of the C array int ary[10][5].?
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.