Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

Data Structures Multiple choice Questions

1.void main()
{
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{ printf("EXAM"); } }
What is the output?
1) XAM is printed 2) exam is printed 3) Compiler Error 4) Nothing is printed

2. What is the output of the following code?


#include<stdio.h>
void main()
{ char letter =`Z`;
printf("\n%c",letter); }
1) Z 2) 90 3) Error 4) Garbage Value
3. Array passed as an argument to a function is interpreted as
1) Address of the array 2) Values of the first elements of the array
3) Address of the first element of the array 4) Number of element of the array

4. Which of the following is the correct way of declaring a float pointer:


1) float ptr; 2) float *ptr; 3) *float ptr; 4) None of the above
5. The reason for using pointer is ...
Choose the false option from the following sentences
1) Accessing arrays or string elements 2) Dynamic memory allocation
3) Implementing linked list,trees,graphs and many other data structures 4) All
are false
6. The size of a structure can be determined by
a. size of variable name
b. size of (struct tag)
1) Only a 2) Only b 3) Both a and b 4) None of these options
7. Pushdown list means:
1) Stack 2) Queue 3) Linked list 4) All of the above
8.Which of the following is the feature of stack?
1) All operations are at one end 2) It cannot reuse its memory
3) All elements are of different data types 4) Any element can be accessed from
it directly
9. fputs function is used to
i)write characters to a file ii). takes 2 parameters iii) returns a character
iv) requires a file pointer
1) all are true 2) all are false 3) only i and ii are true 4) only i,ii and
iv are true
10. #include <stdio.h>
void main()
{
int a; printf("%d",a^a);
}
1) 1 2) 0 3) Unexpected 4) Runtime Error
11. Time taken for addition of element in queue is
1) O(1) 2) O(n) 3) O(log n) 4) None of these options
12. To delete a dynamically allocated array named `a`, the correct statement is
1) delete a; 2) delete a[0]; 3) delete []a; 4) delete [0]a;
13. What will be the value of `a` after the following code is executed
#define square(x) x*x
a = square(2+3)
1) 25 2) 13 3) 11 4) 10
14. The five items: A, B, C, D and E are pushed in a stack,one after the other s
tarting from A. The stack is popped four times and each element is inserted in a
queue. Then two elements are deleted from the queue and pushed back on the stac
k. Now one item is popped from the stack.
The popped item is.
1) A 2) B 3) C 4) D
15. UML stands for
1) Unique modeling language. 2) Unified modeling language
3) Unified modern language 4) Unified master language
16. With every use of a memory allocation function, what function should be used
to release allocated memory which is no longer needed?
1) unalloc() 2) dropmem() 3) dealloc() 4) free()
17. Which one of the following will declare a pointer to an integer at address 0
x200 in memory?
1) int *x;
*x = 0x200; 2) int *x = &0x200 3) int *x = *0x200; 4) int *x = 0x200;
18.What is required to search element in a linked list of length n
1)O(log2 n) 2)O(n) 3)O(1) 4)O(n2)
19.In what order the elements of push down stack are accessed
1)FIFO 2)LILO 3)LIFO 4)None
20. A list of elements which are access in registration can be added or removed
at one end of the list known as
1)Stack 2)Memory 3)Linked list 4)Heap
21. Two main measures for the efficiency of an algorithm are
1). Processor and memory 2). Complexity and capacity 3). Time and space
4). Data and space
22. The time factor when determining the efficiency of algorithm is measured by
1). Counting microseconds 2). Counting the number of key operations
3). Counting the number of statements 4) Counting the kilobytes of algorithm
23. The space factor when determining the efficiency of algorithm is measured by
1) Counting the maximum memory needed by the algorithm
2) Counting the minimum memory needed by the algorithm
3) Counting the average memory needed by the algorithm
4) Counting the maximum disk space needed by the algorithm
24. Which of the following case does not exist in complexity theory
1) Best case 2) Worst case 3) Average case 4) Null case
25. The Worst case occur in linear search algorithm when
1) Item is somewhere in the middle of the array 2) Item is not in the array
at all
3) Item is the last element in the array 4) Item is the last element in the ar
ray or is not there at all
26. The Average case occur in linear search algorithm
1) When Item is somewhere in the middle of the array 2) When Item is not in the
array at all
3) When Item is the last element in the array
4) When Item is the last element in the array or is not there at all
27. The complexity of the average case of an algorithm is
1) Much more complicated to analyze than that of worst case
2) Much more simpler to analyze than that of worst case
3) Sometimes more complicated and some other times simpler than that of worst ca
se
4) None or above
28. The complexity of linear search algorithm is
1) O(n) 2) O(log n) 3) O(n2) 4) O(n log n)
29. The complexity of Binary search algorithm is
1) O(n) 2) O(log ) 3) O(n2) 4) O(n log n)
30. The complexity of Bubble sort algorithm is
1) O(n) 2) O(log n) 3) O(n2) 4) O(n log n)
31. The complexity of merge sort algorithm is
1) O(n) 2) O(log n) 3) O(n2) 4) O(n log n)
32. The indirect change of the values of a variable in one module by another mod
ule is called
1) internal change 2) inter-module change 3) side effect 4) side-module
update

33. Which of the following data structure is not linear data structure?
1) Arrays 2) Linked lists 3) Both of above 4) None of above
34. Which of the following data structure is linear data structure?
1) Trees 2) Graphs 3) Arrays 4) None of above
35. The operation of processing each element in the list is known as
1) Sorting 2) Merging 3) Inserting 4) Traversal
36. . Finding the location of the element with a given value is:
1) Traversal 2) Search 3) Sort 4) None of above
37. Arrays are best data structures
1) for relatively permanent collections of data
2) for the size of the structure and the data in the structure are constantly ch
anging
3) for both of above situation
4) for none of above situation
38. Linked lists are best suited
1) for relatively permanent collections of data
2) for the size of the structure and the data in the structure are constantly ch
anging
3) for both of above situation
4) for none of above situation
39. Each array declaration need not give, implicitly or explicitly, the informat
ion about
1) the name of array 2) the data type of array
3) the first data from the set to be stored 4) the index set of the array
40. The elements of an array are stored successively in memory cells because
1) by this way computer can keep track only the address of the first element and
the addresses of other elements can be calculated
2) the architecture of computer memory does not allow arrays to store other than
serially
3) both of above 4) none of above
41. A cyclic graph has:
1). a shape like a unicycle 2) a graph that cycles from vertices to edges
3) a cycle of two or more nodes 4) a cycle of three or more nodes
42. A(n) _______________________ graph is a graph in which each vertex
has a connection to every other vertex.
1) directed 2) cyclic 3) fully connected 4) None of the above

43. A(n) ____________________ is a graph in which each connection has


two directions.
1). undirected graph 2) bigraph 3) bidirectional graph 4) TS graph
44. What is the output of the following code?
#include<stdio.h>
void main()
{
char letter =`Z`;
printf("\n%c",letter);
}
1) Z 2) 90 3) Error 4) Garbage Value
45. What would be the output of the following program?
#include <stdio.h>
main()
{
char str[]="S\065AB";
printf("\n%d", sizeof(str));
}
1) 7 2) 6 3) 5 4) error
46. "My salary was increased by 15%!"
Select the statement which will EXACTLY reproduce the line of text above.
1)printf("\"My salary was increased by 15/%\!\"\n");
2)printf("My salary was increased by 15%!\n");
3)printf("\"My salary was increased by 15%%!\"\n");
4)printf("My salary was increased by 15'%'!\n");
47. C is which kind of language?
1)Machine 2)Procedural 3)Assembly 4)Object oriented
48. int I,j;
int ctr = 0
int myarray[2][3];
for (i=0;i<3;i++)
for (j=0;j<2;j++)
{
myarray[1][i]=ctr;
++ctr ; }
What is the value of myarray[1][2]; in the sample code above?
1)1 2)2 3)3 4)5
49.(A+B)*(C+D) if converted in to post order we get
1)AB+CD+* 2)ABCD*++ 3)ABC+d+* 4)none
50.Hashing means
1)Perfoming insertions and deletions
2)search operations in cost average time 3)1)and2) 4)none

You might also like