1.
A TREE IS A HIERARCHICAL DATA STRUCTURE THAT CONTAINS..................CONNECTED TO EACH OTHER BY.........................
Correct Answer
A. VERTEX ,EDGES
Explanation
A tree is a hierarchical data structure that contains vertices connected to each other by edges. This means that each element in the tree, called a vertex, is connected to other vertices through edges. Therefore, the correct answer is "VERTEX, EDGES".
2.
THE MAXIMUM NUMBER OF CHILDREN A NODE CAN HAVE IS GENERALLY REFERRED AS
Correct Answer
D. ORDER OF THE TREE
Explanation
The maximum number of children a node can have is referred to as the order of the tree. The order of the tree determines the maximum number of branches or children a node can have, which affects the overall structure and organization of the tree.
3.
THE OUTPUT OF THE FOLOWING C PROGRAM IS
#include
void main()
{
int i=0;
while (i<5)
{
int j=0,k;
j++;
k=i*j;
i++;
}
printf("i=%d,j=%d,k=%d",i,j,k);
}
Correct Answer
E. None of the above
Explanation
The output of the program will be "i=5,j=0,k=20".
In the given program, a while loop is used to increment the value of i from 0 to 5. Inside the loop, the value of j is always set to 0 and k is calculated as i multiplied by j. Since j is always 0, k will always be 0. After the loop, the printf statement prints the final values of i, j, and k, which are 5, 0, and 0 respectively.
4.
The average time of a binary search is proportional to :
consider the size of search list equal to N
Correct Answer
A. LogN
Explanation
The average time of a binary search is proportional to logN. This is because in a binary search, the search list is divided in half at each step until the target element is found. This means that the number of steps required to find the target element is equal to the logarithm of the size of the search list. Therefore, the average time complexity of a binary search is logarithmic in the size of the search list.
5.
How would you round off a value from 1.66 to 2.0?
Correct Answer
A. Ceil(1.66)
Explanation
The ceil() function is used to round up a value to the nearest whole number. In this case, the value 1.66 would be rounded up to 2.0.
6.
Which of the following special symbol allowed in a variable name?
Correct Answer
D. -_(underscore)
Explanation
The special symbol allowed in a variable name is the underscore (-_).
7.
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?
Correct Answer
C. Rem = fmod(3.14, 2.1);
Explanation
The function fmod() should be used to obtain the remainder after dividing 3.14 by 2.1.
8.
Is there any difference between following declarations?
i.)extern int fun();
ii.) int fun();
Correct Answer
B. No difference, except extern int fun(); is probably in another file
Explanation
The answer is "No difference, except extern int fun(); is probably in another file." The reason for this is that both declarations have the same return type and function name, indicating that they are referring to the same function. The only difference is the keyword "extern" in the first declaration, which suggests that the function is defined in another file. This keyword is used to declare that the function is defined elsewhere and is being referenced in the current file.
9.
Is the following statement a declaration or definition?
extern int i;
Correct Answer
A. Declaration
Explanation
The given statement "extern int i;" is a declaration because it introduces the existence of a variable named "i" without defining its value or memory allocation. The keyword "extern" indicates that the variable is defined in another file and this statement is used to inform the compiler about its existence.
10.
In the following program where is the variable a getting defined and where it is getting declared?
#include<stdio.h>
int main()
{
extern int a;
printf("%d\n", a);
return 0;
}
int a=20;
Correct Answer
A. Extern int a is declaration, int a = 20 is the definition
Explanation
In the given program, the line "extern int a;" is a declaration of the variable "a". It tells the compiler that the variable "a" is defined somewhere else in the program. The line "int a = 20;" is the definition of the variable "a", where it is assigned a value of 20. So, the correct answer is "extern int a is declaration, int a = 20 is the definition".
11.
In which header file is the NULL macro defined?
Correct Answer
C. Stdio.h and stddef.h
Explanation
The NULL macro is defined in both stdio.h and stddef.h header files. These header files are part of the C standard library and provide various definitions and functions. stdio.h is used for input and output operations, while stddef.h is used for defining various types and macros, including NULL. Therefore, to use the NULL macro in a C program, one needs to include either stdio.h or stddef.h header file.
12.
What would be the equivalent pointer expression for referring the array element
a [i] [j] [k] [l]
Correct Answer
B. *(*(*(*(a+i)+j)+k)+l)
Explanation
The correct answer is `*(*(*(*(a+i)+j)+k)+l)`. This expression is the equivalent pointer expression for referring to the array element `a[i][j][k][l]`. It uses nested pointer dereferences to access the element at the specified indices. The outermost dereference `*(a+i)` accesses the `i`th element of the array `a`, the next dereference `*(*(a+i)+j)` accesses the `j`th element of the sub-array `a[i]`, and so on until the innermost dereference `*(*(*(*(a+i)+j)+k)+l)` accesses the `l`th element of the sub-sub-sub-array `a[i][j][k]`.
13.
How many times the program will print "IndiaBIX" ?
#include<stdio.h>
int main()
{
printf("IndiaBIX");
main();
return 0;
}
Correct Answer
A. Infinite times
Explanation
The program will print "IndiaBIX" infinite times because the main function is recursively calling itself without any condition to stop the recursion. Therefore, the program will keep printing "IndiaBIX" indefinitely until the stack overflows.
14.
What does the following declaration mean?
int (*ptr)[10];
Correct Answer
B. Ptr is a pointer to an array of 10 integers
Explanation
The declaration "int (*ptr)[10];" means that "ptr" is a pointer to an array of 10 integers. This means that "ptr" can store the memory address of an array that contains 10 integers.
15.
In C, if you pass an array as an argument to a function, what actually gets passed?
Correct Answer
C. Base address of the array
Explanation
When you pass an array as an argument to a function in C, only the base address of the array gets passed. This means that the function will have access to the memory location where the array starts, allowing it to manipulate or access the elements of the array. The function does not receive the actual values of the elements in the array or the address of the last element.
16.
If the two strings are identical, then strcmp() function returns
Correct Answer
C. 0
Explanation
The strcmp() function is used to compare two strings. If the two strings are identical, strcmp() returns 0.
17.
Which of the following function is used to find the first occurrence of a given string in another string?
Correct Answer
C. Strstr()
Explanation
The strstr() function is used to find the first occurrence of a given string within another string. It returns a pointer to the first occurrence of the substring or NULL if the substring is not found. This function is commonly used in string manipulation and searching algorithms.
18.
What is x in the following program?
#include<stdio.h>
int main()
{
typedef char (*(*arrfptr[3])())[10];
arrfptr x;
return 0;
}
Correct Answer
C. X is an array of three function pointers
Explanation
In the given program, the declaration "typedef char (*(*arrfptr[3])())[10];" defines an array of three function pointers named "arrfptr". Therefore, the variable "x" is an array of three function pointers.
19.
What will the function randomize() do in Turbo C under DOS?
Correct Answer
C. returns a random number generator with a random value based on time.
Explanation
The function randomize() in Turbo C under DOS will return a random number generator with a random value based on time. This means that each time the function is called, it will generate a different random number. The random value is based on the current time, ensuring that the generated numbers are unpredictable and not repetitive.