Data structure/Data Structure and Algorithms (DSA) set 4 Sample Test,Sample questions

Question:
 . #include <stdio.h>
#include <string.h>
int main(){
int i=0;
for(;i<=2;)
printf(" %d",++i); return 0;
}

1. 0 1 2 3

2. 0 1 2

3.1 2 3

4.compiler error

Posted Date:-2022-07-08 08:37:16


Question:
 A declaration "short int" is used for variables

1.which have a short duration in a program B. C.

2. which have short names

3.which may require less storage than normal integers

4.All of the three

Posted Date:-2022-07-08 09:15:41


Question:
 A node in a linked list must contain at least

1. three fields

2.two fields

3.four fields

4. one field

Posted Date:-2022-07-08 09:04:04


Question:
 A ________ linked list is a linked list structure in which each node has a pointer to both its successor and predecessor.

1.circularly

2.doubly

3.linear

4.sequential

Posted Date:-2022-07-08 11:27:46


Question:
 In a circularly linked list organisation ,insertion of a record involves the modifications of

1.no pointer

2.1 pointer

3.2 pointer

4.3 pointer

Posted Date:-2022-07-08 12:44:17


Question:
 In a linked list, the pointer of the last node contains a special value, called the ______ pointer.

1.null B. C. D.

2.zero

3.link

4.next pointer

Posted Date:-2022-07-08 11:23:46


Question:
 In C, if you pass an array as an argument to a function, what actually gets passed?

1.value of elements in array

2. first element of the array

3. base address of the array

4.address of the last element of array

Posted Date:-2022-07-08 08:55:48


Question:
 In linked list,a node contain

1. node,adrees field and data field

2.node number and data field

3.next adress field and information field

4.None of the above

Posted Date:-2022-07-08 12:17:33


Question:
 In linked list,the logical order of elements

1. is same as their physical arrangement

2.is not necessarily equivalent to their physical arrangement

3.. is determined by their physical arrangement

4.none of the above

Posted Date:-2022-07-08 12:19:05


Question:
 List pointer variable in linked list contains address of the

1. following node in the first

2.current node in the first

3. first node in the first

4.none of the above

Posted Date:-2022-07-08 12:21:49


Question:
 The declaration "unsigned u" indicates u is a/an

1.unsigned character

2.unsigned integer

3.character

4.none of these

Posted Date:-2022-07-08 09:14:32


Question:
 The members of the union are accessed by____

1.dot operator

2.pointer -> operator

3.both a and b

4. none of these

Posted Date:-2022-07-08 08:08:05


Question:
 To insert a node in a circular list at rear end it should be inserted at …...of the queue

1.front position

2.front-1position

3.rear position

4.rear-1 position

Posted Date:-2022-07-08 12:43:28


Question:
 What is the maximun number of dimensions an array in C may have?

1.two

2.eight

3.twenty

4.theoratically no limit. the only practical limits are memory size and compilers

Posted Date:-2022-07-08 09:11:33


Question:
 What is true about linked kist?

1.it is a linked structure,where each data gives the address of the next data

2. it is a dynamic data structure

3. it is a static data structure

4.both (a) and (b)

Posted Date:-2022-07-08 12:45:27


Question:
 What will be output if you will compile and execute the following c code? #include<stdio.h>
int main(){
int i=4,x;
x=++i + ++i + ++i;
printf("%d",x); return 0;
}

1.21

2.18

3.12

4.Compiler Error

Posted Date:-2022-07-08 08:33:24


Question:
 Which of the following data structure is linear type ?

1.strings

2.lists

3.queues

4.All of the above

Posted Date:-2022-07-08 08:51:22


Question:
A circular list can be used to represent

1. a stack

2.a queue

3.a tree

4.both a and b

Posted Date:-2022-07-08 12:41:56


Question:
A node of linked list contains_______

1. data field

2.a self referential pointer

3.both (a)and(b)

4.only b

Posted Date:-2022-07-08 12:46:46


Question:
A polynomial can be represented in a _______ by just storing the coefficient and exponent of each term.

1.array

2.linked list

3.queue

4.stack

Posted Date:-2022-07-08 11:33:41


Question:
A variable which is visible only in the function in which it is defined, is called

1. A. static

2.auto

3.external

4.local

Posted Date:-2022-07-08 08:50:03


Question:
A _______ list structure can be traversed in two directions-- in the forward direction from beginning of the list to end, or in the backward direction, from the end of the list to the beginning.

1.one way

2.linear array

3.two way

4.header

Posted Date:-2022-07-08 12:15:29


Question:
A ________ linked list is a linked list which always contains a special node, called the header node.

1.circular

2.grounded

3.header

4.doubly

Posted Date:-2022-07-08 11:32:11


Question:
An external variable

1. is globally accessible by all functions

2.has a declaration

3. will be initialized to 0 if not initialized

4.All of the three

Posted Date:-2022-07-08 09:12:40


Question:
Are *ptr++ and ++*ptr are same?

1. A. no they are not same B. C.

2.yes they are one and the same

3.yes they are one and the same

4. none of these

Posted Date:-2022-07-08 08:02:25


Question:
Because of linear structure of linked list having linear ordering,there is similarity between linked list and array in

1.insertion of a node

2.deletion of a node

3.traversal of elements of list

4.None of the above

Posted Date:-2022-07-08 12:22:51


Question:
C language was invented by

1. abacus

2.charles babage

3.thomson

4.dennis ritchie

Posted Date:-2022-07-08 08:47:47


Question:
Consider that n elements are to be sorted. What is the worst case time complexity of Bubble sort?

1.o(1)

2.o(log2n)

3. o(n)

4. o(n^2)

Posted Date:-2022-07-08 09:07:14


Question:
Deletion of a node from an empty linked list will cause________

1.underflow

2.overflow

3.run time error

4. all of the above

Posted Date:-2022-07-08 12:49:15


Question:
How many bits are absolutely necessary to store an ASCII character ?

1. 7

2.8

3.15

4.16

Posted Date:-2022-07-08 08:09:41


Question:
How many times the program will print "Amrutvahini" ? #include<stdio.h>
int main()
{
printf("Amrutvahini");
main();
return 0;
}

1. infinite times

2.32767 times

3. 65535 times

4.till stack overflows

Posted Date:-2022-07-08 11:20:58


Question:
If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a time, in what order will they be removed?

1.abcd

2.abdc

3.dcab

4.dcba

Posted Date:-2022-07-08 09:26:20


Question:
In a ________ linked list, the last node's link field points to the first node of the list.

1. circularly

2.linearly

3.sequentially

4.indexed

Posted Date:-2022-07-08 11:24:39


Question:
Insertion in a linked list requires modification of____pointers

1.1

2.2

3.3

4.4

Posted Date:-2022-07-08 12:49:58


Question:
Null pointer is used to tell

1.end of linked list

2. empty pointer field of a structure

3.the linked list is empty

4. all of the above

Posted Date:-2022-07-08 12:20:51


Question:
One difference between a queue and a stack is:

1.queues require dynamic memory, but stacks do not.

2.stacks require dynamic memory, but queues do not

3. queues use two ends of the structure; stacks use only one.

4.stacks use two ends of the structure, queues use only one.

Posted Date:-2022-07-08 09:25:36


Question:
Queue is a -------------- List .

1.fifo

2.lifo

3.lilo

4.liso

Posted Date:-2022-07-08 08:59:47


Question:
Searching of linked list requires linked list to be created

1.in stored order only

2.in any order

3.without underflow condition

4.None of the above

Posted Date:-2022-07-08 12:23:33


Question:
The complexity of linear search algorithm is

1. o(n)

2.o(log n)

3.o(n2)

4.o(n log n)

Posted Date:-2022-07-08 09:09:40


Question:
The data type created by the data abstraction process is called

1. class

2.structure

3.abstract data type

4. user defined data type

Posted Date:-2022-07-08 08:48:47


Question:
The keyword used to transfer control from a function back to the calling function is

1. switch

2.goto

3.go back

4.return

Posted Date:-2022-07-08 09:29:17


Question:
The link list also contains a list pointer variable called start or ________.

1.name

2. field

3.node

4.link

Posted Date:-2022-07-08 11:27:01


Question:
The main measures of efficiency of an algorithm are

1.processor and memory

2.complexity and capacity

3. time and space

4.data and space

Posted Date:-2022-07-08 09:19:18


Question:
The most significant bit is lost in following operation

1.<<

2. >>

3.&

4./

Posted Date:-2022-07-08 08:18:05


Question:
The program fragment
int i = 263 ;
putchar (i) ;
prints

1. 263

2.ascii equivalent of 263

3.rings the bell

4.garbage

Posted Date:-2022-07-08 09:17:29


Question:
The result of 0001 1010 & 0000 1000 is ___

1.0001 1111

2.1111 0001

3.0000 1000

4.None of These

Posted Date:-2022-07-08 08:11:41


Question:
The result of 0001 1010 << 2 is____

1.0101 1100

2. 0110 1000

3.0001 1110

4.None of These

Posted Date:-2022-07-08 08:15:50


Question:
The result of 0001 1010^0001 0000 is____

1.0101 1001

2.1010 0100

3.0000 0010

4.none of these

Posted Date:-2022-07-08 08:14:38


Question:
The second part of the node, is called _______ field, and contains the address of the next node in the list.

1. pointer

2.field

3.node

4.link

Posted Date:-2022-07-08 11:25:59


Question:
the terms push and pop are related to

1. stack

2.queue

3.array

4.None of the above

Posted Date:-2022-07-08 09:22:28


Question:
The variables which can be accessed by all modules in a program, are called

1.local variables

2.internal variables

3.external variable

4.global variables

Posted Date:-2022-07-08 09:18:21


Question:
The worst case occures in linear search algorithms when

1.item is somewhere in the middle of the array

2.item is not there in the array at all

3.item is last element in the array

4.item is last element in the array or is not there at all.

Posted Date:-2022-07-08 09:21:18


Question:
Unsigned integers occupies

1.two bytes

2.four bytes

3.one bytes

4.eight bytes

Posted Date:-2022-07-08 08:52:20


Question:
Unsigned integers occupies

1.two bytes

2.four bytes

3.one bytes

4.eight bytes

Posted Date:-2022-07-08 08:54:00


Question:
What additional requirement is placed on an array, so that binary search may be used to locate an entry?

1.the array elements must form a heap

2. the array must have at least 2 entries.

3. the array must be sorted.

4.the arrays size must be a power of two.

Posted Date:-2022-07-08 09:24:31


Question:
What is the similarity between structure,union and enum?

1. all of them let you define new values

2.all of them let you define new pointers

3. all of them let you define new structure

4.all of them let you define new data types

Posted Date:-2022-07-08 08:06:24


Question:
What term is used to describe an O(n) algorithm

1.constant

2.linear

3.logarithmic

4.quadratic

Posted Date:-2022-07-08 09:27:51


Question:
What will be output if you will compile and execute the following c code? #include<stdio.h>
#define max 5;
int main(){
int i=0;
i=max++;
printf("%d",i++); return 0;
}

1.5

2.6

3.7

4.0

Posted Date:-2022-07-08 08:44:31


Question:
What will be output if you will compile and execute the following c code? #include<stdio.h>
int main(){
char c=125;
c=c+10;
printf("%d",c); return 0;
}

1. 135

2. +inf

3.-121

4. -8

Posted Date:-2022-07-08 08:32:01


Question:
What will be output if you will compile and execute the following c code? #include<stdio.h>
int main(){
double far* p,q;
printf("%d",sizeof(p)+sizeof q); return 0; }

1.12

2.8

3.4

4.1

Posted Date:-2022-07-08 08:46:39


Question:
What will be output if you will compile and execute the following c code? #include<stdio.h>
int main(){
int a=2;
if(a==2){
a=~a+2<<1;
printf("%d",a);
}
else{
break;
} return 0;
}

1. it will print nothing

2.-3

3.-2

4. compiler error

Posted Date:-2022-07-08 08:34:39


Question:
What will be output if you will compile and execute the following c code? #include<stdio.h>
int main(){
int i=10;
static int x=i;
if(x==i)
printf("Equal");
else if(x>i)
printf("Greater than");
else
printf("Less than"); return 0;
}

1.equal

2. less than

3. greater than

4.compiler error

Posted Date:-2022-07-08 08:43:10


Question:
What will be output if you will compile and execute the following c code? #include<stdio.h> int main(){
int array[]={10,20,30,40};
printf("%d",-2[array]); return 0;
}

1.-60

2.-30

3.60

4.garbage value

Posted Date:-2022-07-08 08:42:04


Question:
What will be the output of the following code? Void main(){int a=10;int *b=&a;int **c=&b;printf("%d %d %d",a,*b,**c);}

1.0 10 garbage

2.10 garbage garbage

3.10 10 10

4.syntax error

Posted Date:-2022-07-08 08:04:01


Question:
What will be the output of the program? #include<stdio.h>
int i;
int fun();

int main()
{
while(i)
{
fun();
main();
}
printf("Hello
");
return 0;
}
int fun()
{
printf("Hi");
}

1.hello

2.hi hello

3.no output

4. infinite loop

Posted Date:-2022-07-08 11:22:04


Question:
What will be the output of the program? #include<stdio.h>
int main()
{
int X=40;
{
int X=20;
printf("%d ", X);
}
printf("%d
", X);
return 0;
}

1.40 40

2.20 20

3.20

4.error

Posted Date:-2022-07-08 09:23:31


Question:
Which data structure allows deleting data elements from front and inserting at rear?

1. stack

2.queue

3.dequeue

4.binary search tree

Posted Date:-2022-07-08 08:58:10


Question:
Which nodes contains a null pointer in a linked list?

1.first node

2.middle node

3.last node

4. both (a) and (b)

Posted Date:-2022-07-08 12:48:14


Question:
Which of the following 'C' type is not a primitive data structure?

1.int

2.float

3.char

4.none of these

Posted Date:-2022-07-08 09:16:37


Question:
Which of the following data structure is linear data structure?

1.trees

2.graphs

3.arrays

4.none of above

Posted Date:-2022-07-08 09:10:38


Question:
Which of the following formulas in big-O notation best represent the expression n²+35n+6?

1.o(n³)

2.o(n²)

3.o(n)

4.o(42)

Posted Date:-2022-07-08 09:27:05


Question:
Which of the following is a collection of different data type elements?

1.array

2.structure

3.string

4.all of the above

Posted Date:-2022-07-08 08:05:22


Question:
Which of the following statement is true about char ****a ?

1. a is pointer to a pointer to a pointer to char

2.a is pointer to a pointer to a pointer to char

3.a is a pointer to a char pointer

4.a is a pointer to a pointer to a char

Posted Date:-2022-07-08 08:00:32


Question:
___ attacks the problem of fragmentation by moving all the allocated blocks to one end of memory, thus combining all the holes.

1.underflow

2.overflow

3.compaction

4.free storage

Posted Date:-2022-07-08 11:31:13


Question:
____ header list combines the advantages of a two-way list and a circular header list.

1. one way

2.two way circular

3.two way

4.header

Posted Date:-2022-07-08 12:16:39


Question:
_____ attacks the problem of fragmentation by moving all the allocated blocks to one end of memory, thus combining all the holes.

1.garbage collection

2. garbage compaction

3.buddy system

4.queue

Posted Date:-2022-07-08 12:14:01


Question:
_____ list is a special list that is maintained, which consists of unused memory cells.

1.linear

2.doubly linked

3.circularly linked

4.free storage

Posted Date:-2022-07-08 11:28:48


Question:
______ is a technique using which a computer periodically collects all the deleted space onto the free storage list.

1.garbage collection

2.garbage compaction

3.linked list

4.free storage

Posted Date:-2022-07-08 11:29:48


Question:
______ refers to situation where one wants to delete data form a data structure that is empty

1. free storage

2.underflow

3.overflow

4.compaction

Posted Date:-2022-07-08 11:36:32


Question:
________ is an organization that provides faster request and return time response.

1.stack

2.queue

3.buddy system

4.recursion

Posted Date:-2022-07-08 12:12:42


More MCQS

  1. Data Structures and algorithms MCQ Questions
  2. Data Structure -Abstract Data Types
  3. Data Structure Questions and Answers Singly Linked
  4. Data Structures &algorithms MCQ Questions
  5. Data Structure Multiple Choice Questions and Answers
  6. Data Structure (DS) MCQ Set 1
  7. Data Structure (DS) MCQ Set 2
  8. Data Structure and Algorithms (DSA) set 1
  9. Data Structure and Algorithms (DSA) set 2
  10. Data Structure and Algorithms (DSA) set 3
  11. Data Structure and Algorithms (DSA) set 4
  12. Data Structure and Algorithms (DSA) set 5
  13. Linear Data Structures - List
  14. Data Structure MCQ questions and answer
  15. Data Structure MCQ questions and answer
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!