You are on page 1of 92

1. Which of the following symbols is used to denote a pre-processor statement?

A) !
B) #
C) ~
2.

D) ;

The preprocessor in C language is used for


A) processing the function calls
B) processing input and output statements
C) processing the preprocessor directives
D) processing all the statements in program

3.

The declaration int a[10]; In c Language means


A)

the value 10 is assigned to variable a

B)

it is character array which can store 10 characters

C)

it is integer array which can store 10 integer values in an array

D)

both b and c

4. struct data type in C language is used for


A)

storing group of different data types

B)

storing group of same data type

C)

storing only one data type

D)

all of the above

5. Symbolic constants can be defined using a_________


A)

# define directive B)

const keyword

C)

symbolic notation D)

None of these

6. A string is terminated by a _____________ character, which is written as ____________


A)

blank,

B) new line, \n

C)

null, \0

D) string, %s

7. Which expression reference to the 4th element of an array


A)

num[4];

B) int a(4);

C)

num(0-4);

D)

num[3];

8. Which of the following statements is true?


A)

The array int num[27] has twenty six element

B)

The expression num [0] designates the first element in the array.

C)

It is necessary to initialize the array at the time of declaration.

D)

The expression num[27] designates the twenty sixth element in the array

9. The expressions written in the ` for ` loop, are separated using a _____________.
A)

colon

B) comma

C) semicolon

D) hyphen

10. malloc() function used in dynamic memory allocation is available in which header file?
A)

stdio.h

B)

stdlib.h

C) conio.h

D)

mem.h

D)

11. Indexing of array starts with___________


A)

B) 2

C) 0

D)

any

12. Which symbol is used as a ` statement terminator ` in ` C ` ?


A)

B) #

C) ~

13. Which among the following is a unconditional control structure ?


A)

do-while

B) if-else

C) goto

D) for

14. A "do... while " loop terminates, when the expression written in ` while ` returns _______
A)

B) 0

C) 1

D) NULL

15. Which of the following is a keyword used for denoting a storage class?
A)

printf

B) external

C) auto

D) scanf

16. Which amongst the following is not a structured data type?


A)

Array

B) void

C) structure

D) union

17. Minimum number of temperory variables needed to exchange the contents of two variables is
A)

B) 2

C) 3

D) 0

18. The body of a ` WHILE ` Loop has

19.

A)

one statement only

B) atleast two statements

C)

one or more statements

D) None of above.

Determine which of the following is invalid numeric constant.


A)

0.5

B) 27,822

C) 12345678

D) 0XBCFDAL

20. Which is not conditional and unconditional branching ?


A)

if

B) switch

C) break

21. Which of the following statement is correct ?


A)

C provides no input-output feature

B)

C provides no file access feature

C)

C provides no feature to manipulate composite objects

D)

All of above

22. The following statement prints("%f",9/5); prints

D) include

A)

1.8

B) 1

C) 2

D) none of these

23. which of the following is not a logical operator?


A)

&

B) &&

C) ||

D. !

24. How do printf() ` s format specifiers %e and %f differ in their treatment of floating-point
numbers?
A)

%e always displays an argument of type double in engineering notation; %f always displays

an argument of type double in decimal notation


B)

%e expects a corresponding argument of type double; %f expects a corresponding

argument of type float.


C)

%e displays a double in engineering notation if the number is very small or very large.

Otherwise, it behaves like %f and displays the number in decimal notation.


D)

%e displays an argument of type double with trailing zeros; %f never displays trailing zeros.

25. Which of the following is not a character classification in the C language?


A)

alphabets

B) characters

C)

digits

D) graphical

26. Consider following statments I] An array is variable which can store multiple elements of similar
type.II] Structure contains similar data types together.
A)

I is correct

B) II is correct

C)

I & II are correctD) None of above.

27. In "C" program, constant is defined


A)

before main

B) after main

C)

anywhwre

D) none of above

28. A character variable can at a time store maximum _____________.


A)

1 Byte

B) 4 Bytes

C) 8 Bytes

D) 16 Bytes

29. What is the meaning of while (1)?


A)

Execution of loop only once

B) Execution of loop at least once

C)

Infinite Loop

D) No execution of the loop

30. Which of the following is not an integer constant in ` C ` language?


A)

320

B) 14.05

C) 45

D) 1456

31. One of the following is not a character constant in ` C ` language. Identify it.
A)

''

B) 'bb'

C) d

D) '?'

C) switch(choice)

D) for

32. Which one is not keyword?


A)

else

B) while

33. Find the correct form of ` nested if `


A)

if(if(condition)) do this;

B)

else(if(condition) do this;

C)

if(condition) { if(condition) do this; }

D)

if&&if(condition)

34. Which symbol is used to separate multiple initialization in the for loop?
A)

&&

B) ,

C)

D) None of the above

35. The keyword .. allows to take the control to the beginning of the loop, by passing the
statements inside the loop, which have not yet been executed.
A)

goto

B)

for

C) continue

D) case

36. Which of the following loop is not used in ` C ` language?


A)

'for' loop

B) 'if...else'

C)

'Repeat...until' loop

D) 'do..while' loop

37. When the keyword ________ is encountered inside any C loop, control automatically passes to
the first statement after the loop.
A)
38.

goto

B) break

C) default

D) continue

Which of the following for statements is wrong?


A)

for(i=0, j=1;i<5;i++) B)

for(i=0;i<5;i++);

C)

for(i=0;i<5;i++);D) for(;i>7;)

39. How many ` ; ` (semicolon) are included in ` for ` statement (or loop)?
A)

B) 1

C) 2

D) 3

40. The _____statement allows the programmer to take the control to the beginning of the loop,
bypassing the statement inside the loop which has not yet been executed.
A)

while

B) continue

C) go to

D) if

41. Which of the following is a Scalar Data type?


A)

Float

B) Union

C) Array

D) Pointer

42. The _______loop allows programmer to specify three things about a loop in single line.
A)

for

B) while

C) goto

D) switch

43. For using character function, we must include the header file _____in the program.
A)

string.h

B) stdio.h

C) ctype.h

D) math.h

44. Which one of the following is a true statement about pointers?


A)

They are always 32-bit values.

B)

For efficiency, pointer values are always stored in machine registers.

C) With the exception of generic pointers, similarly typed pointers may be subtracted from
each other.
D)

A pointer to one type may not be cast to a pointer to any other type.

45. Which one of the following variable names is not valid?

A)

go_cart

B) go4it

C) 4season

D) run4

46. Which of the following is not a floating point constant in ` C ` language?


A)

45.6

B) -31.8

C)

pi

D) 40

47. The expression ` x != y ` is true if


A)

x is equal to y.

B) x is not equal to y.

C)

x is less than or equal to y

D) x is greater than or equal to y.

48. Which of the following is not a valid indentifier in ` C ` language?


A)

A3

B) B.A_4

C) if

D) IF

49. Which of the following statements about the ` switch ` statement is false?
A)

No two case labels can have the same value

B)

The switch control expression must be of 'character' type

C)

The case-labled constant can be a constant or a variable

D)

Two case labels can be associated with the same statement series

50. A two way selection is implemented in the program, by using __________ statement.
A)

case

B) else..if

C) switch

D) if..else

51. Header files in C contains


A)

Compiler commands

B)

Library functions

C)

Header information of C programs

D)

Operators for files

52. Which header file contains strlen() function?


A)

stdio.h

B) conio.h

C) string.h

D) math.h

53. Which statements is used to take the control to the beginning of the loop?
A)

exit

B) break

C) continue

D) no of these

54. Which of the following gives the memory address of a variable pointed to by pointer named as `
p`?
A)

p;

B) *p;

C) &p;

D) addressA);

55. An integer constant in C must have______


A)

at least one digit

B)

at least one decimal point

C)

A comma along with digits

D)

Digits separated by commas

56. A do...while loop is useful when we want that statement within the loop must be
executed_________.
A)

only once

C)

more than once

B) at least once
D)

none of above.

57. Which of the following gives the value stored in a pointer named as ` a ` ?
A)

a;

B) valA);

C) *a;

D) &a;

58. The real constant in C can be expressed in which of the following forms?
A)

Fractional form only

B)

exponential form only

C)

ASCII form only

D)

both fractional and exponential forms

59. The statement char ch= Z would store what in variable named ` ch ` ___________
A)

the character Z

B)

ASCII value of Z

C)

Z along with single inverted commas

D)

both (1) & (2).

60. The maximum value that an integer constant can have is_________
A)

-32767

B) 32767

C)

1.70E+38

D) -1.70E+38

61. Which of the following is not a valid character constant?


A)

thank you

B) enter values of P,N,R

C)

23.56E-03

D)

all the above

62. If ` a ` is an integer variable, a=5/2; will initialize the variable ` a ` with the value____
A)

2.5

B) 3

C) 2

D) 0

63. Which of the following is the correct output for the program given below?
#include<stdio.h>
void main()
{
int i=1;
if(!i)
printf("Recursive calls are painful\n");
else
{ i=0;
printf("Recursive calls are challenging
A)

Recursive calls are challenging. Recursive calls are painful.

B)

Recursive calls are painful. Recursive calls are challenging.

C)

Recursive calls are the challenging.

D)

The code prints Recursive calls are challenging. Recursive calls are challenging (infinitely?.)

64. In ` C ` a variable name can not contain______


A)

blank spaces

B) hyphen

C)

decimal point

D) all the above

65. Which of the following symbol is used to denote a pre-processor statement?


A)

B) #

C) ~

D) ;

66. Which of the following gives the memory address of an integer variable a ?
A)

*a;

B) a;

C) &a;

D) addressA);

67. Which of the following is the proper declaration of an integer pointer?


A)

int x;

B) int &x;

C) int x*;

D) int *x;

68. The _______symbol is used to denote any function of an input/output device in the program
flowchart.
A)

Flowlines

B) Processing

C) parallelogram

D) Terminal.

69. A ______Symbol is used in a flowchart to represent arithmetic and data movement instructions.
A)

Flowlines

B) Processing

C)

Input/Output

D) Terminal.

70. The ________with arrowheads are used to indicate the flow of an operation, that is, the exact
Sequence in which the instructions are to be executed.
A)

Flowlines

B) Processing

C) Decision

D) Terminal.

71. Which of the following shows the correct hierarchy of arithmetic operators in C ?

72.

A)

**,* or / ,- or +B) **, * or /, + or -

C)

**, /, *, +, -

D) . / or *, - or +

The keyword _________is followed by an integer or character constant.


A)

switch

B) case

C) for

D) void

73. What is the maximum size of a double variable?


A)

1Byte

B) 4 Bytes

C) 8 Bytes

D) 16 Bytes

74. The size of a string variable is______________.


A)

1 Byte

B) 4 Bytes

C)

Size of String array D)

None of these

75. The ______ logic is used to produce loops in program , depending on some condition.
A)

Iteration logic

C)

Sequence logic

B) Selection logic
D)

Decision logic

76. What is meaning of a * ` symbol when used before a variable ?

77.

A)

address of a variable

B) location of a variable

C)

space of a variable D) value at an address

Which escape character can be used to begin a new line in ` C ` ?


A)

\a

B) \b

C) \m

D) \n

78. Which of the following operators has the 2nd highest priority?
A)

B) * / %

C) + -

D) ||

79. A character constant should be enclosed within a pair of ___


A)

Single quotes

B) Double quotes

C)

Both a and b

D) None of these

80. A string constant should be enclosed within a pair of _____


A)

Single quotes

B) Double quotes

C)

Both a and b

D)

None of these

81. Which of the following is an invalid character constant?


A)

')'

B) '$'

C) 'a'

D) 'abc'

82. The maximum length of a variable in ` C ` programming language is __________


A)

B) 16

C) 32

D) 64

83. What is meaning of a & symbol when used before a variable?


A)

address of a variable

B) value of a variable

C)

space of a variable D) name of a variable

84. To return control back to the calling program which keyword is used.?
A)

void

B)

return

C)

back

D)

None

85. Which operators are useful in pointer operators?


A)

#<include>

B) #

C)

*and &

D) None

86. If int s[5] is one dimentional array of integers which of the following refers to third element in an
array?
A)

s[2]

B) s[3]

C) s+3

D) s+2

87. Following are the not looping statements.


A)

if-then-else

B) do-while

C)

repeat-until

D) for loop

88. Structure is a collection of _______.


A)

Different data types

B) Different constants.

C)

Different records. D) Same data types

89. Which of the following is not preprocessor directory?


A)

#if

B) #elseif

C) #undef

D) #pragma

90. To receive the string "To my queen ", in an array char str[100],which of the following functions
would you use?
A)

scanf("%s",str);

B) gets(str)

C)

getche(str)

D) getchar(str)

91. Which operator is used to access the structure element?


A)

B) .

C) ->

D) &

92. When we pass an array of a structure to a function it is passed by the____________ mechanism.

A)

Call by value

B) Call by reference

C)

Call by name

D) None

93. Unions are the _____________


A)

Inbuilt data types

B) Derived Data types

C)

Data types

D) None

94. An integer constant in C must have _________ .


A)

Atleast one digit

B)

Atleast one decimal point

C)

A comma along with digits

D)

Digits seperated by commas

95. c = getchar(); What is the proper declaration for the variable c in the code ?
A)

char *c;

B) unsigned int c;

C)

int c;

D) char c;

96. Scope of global variable is limited to


A)

Entire program

B) with in function

C)

in a class

D) None

97. I/P devices are _________ .


A)

monitor, keyboard, mouse

B) keyboard, mouse, scanner,

C)

Joystick, trackball, digitizer

D) Both B and C

98. Constant is ________.


A)

Constant program code

B)

Constant variable declaration

C)

Both A and B

D)

Way to define variable that can not modified

99. Variable is _______ .


A)

Identifier used to represent specific type of information

B)

Name associated with memory location

C)

Varying program statements

D)

Both A and B

100. Which of following operators in C does not associate from the left to right?
A)

B) ,

C) =

D) %

101. In an array declaration int arr[12] the word arr represents the _________.
A)

Variable

B) string

C)

array variable

D) none of these.

102. What will happen if you put too many elements in an array when you initialize it?
A)

nothing

B)

possible system malfunction

C)

error message from the compiler

D)

unused elements will be filled with 0s or garbage

103. Which header file is essential for using strcmp() function?


A)

string .h

B) strings.h

C) text.h

D) strcmp.h

104. What will happen if you assign a value to an element of an array whose subscript exceeds the
size of array?
A)

element will be set to zero.

B)

Nothing

C)

Other data may be overwritten

D)

Error message from compiler will occur

105. An Ampersand before the name of a variable denotes


A)

Actual Value

B) variable name

C)

Address

D) Data Type

106. When you pass an array as an argument to a function what actually gets passed?
A)

address of array

B)

value of the elements of array

C)

address of first element of array

D)

number of elements of array

107. Can we use logical operators in ` if-else ` statement?


A)

yes

B) no

C)

error

D) Both B and C

108. Which of following statements about ` for ` loop are correct?


A)

Index value is retained outside the loop

B)

Index value can be changed from within the loop

C)

Goto can be jump, out of the loop

D)

All of above

109. Which of the following operator has the highest precedence?


A)

B) ==

C) >=

D) +

110. Which of the following operator has the highest priority?


A)

++

B) %

C) +

D) ||

111. The continue keyword cannot be used with


A)

for

B) while

C) do

112. An union in C language denotes


A)

memory location B)

C)

memory screen

memory store

113. Keywords are also called ___________ .

D) None of these

D) switch

A)

reserved words

B)

compiler words

C)

dictionary wordsD) programming words

114. Which of the following operator has the lowest priority?


A)

++

B) %

C) +

D) ||

115. A ` C ` variable can not start with


A)

an alphabet

B)

a number

C)

a special symbol other than underscore

D)

Both B) and C)

116. Which of the following is the correct syntax of for loop?


A)

for (initialization, condition, inc/ dec )

B)

for (initialization, condition, inc/dec) { { ------; ------; ------; ------; } }

C)

for (initialization; condition; inc/dec)

D)

None of these { ------; ------; }

117. String constants should be enclosed between ______ .


A)

Single quotes

B) Double quotes

C)

A or B

D) None of these

118. Which of the following is a correct way of representing a variable in


A)

int 0ram;

B) float _calculate;

C)

int if;

D) int run#fast;

119. The _______ function is used to display the output on the screen.
A)

scanf

B) printf

C)

getchar

D) clrscr

120. There are how many loop constructs in ` C ` language ?


A)

B) 4

C) 1

121. An array name is ___________.


A)

an array variable

B)

a keyword

C)

a common name shared by all of its elements

D)

not use in program

122. An array is used to represent ___________.


A)

list of integer data item

B)

list of real data type

C)

list of different data type

D)

list of data item of same data type

D) 2

`C` ?

123. The ____________ format string is used for displaying floating point number with an exponent.
A)

%d

B) %f

C) %e

D) %g

C) Three

D) None of these

124. How many loops are present in C?


A)

One

B) Two

125. If a static array of integers is not initialized ,the elements will hold default value..
A)

B) 1

C)

a integer number D) the charcter constant '\0'

126. What is a preprocessor directive?


A)

It is a message from a compiler to the programmer

B)

It is a message from a compiler to the linker

C)

It is a message from a programmer to the preprocessor

D)

t is a message from a programmer to the microprocessor

127. The _________.enhances the versatility of the computer allowing it to perform a set of
instructions repetedly.
A)

compiler

B) loop l

C)

header files

D) statement

128. Which of the following is iterative control structures?


A)

if statement

B) if-else statement

C)

do-while loop

D) goto statement

129. Which of the following control structures are used in an iteration logic _____________.
A)

IF....THEN & IF...THEN...ELSE

B)

DO ..& WHILE

C)

DO..WHILE & REPEAT...UNTILL

D)

DO..WHILE & IF...ELSE

130. Explicit type conversion is known as ___________.


A)

casting

B) conversion

C)

disjunction

D) separation

131. ` C ` variable can not start with___________


A) an alphabet
B) a number
C) a special symbol other than underscore
D) both B) & C) above
132. In a while loop the parantheses after the while contains a _________
A)

condition

B) statement

133. Keyword is ________ .

C) count

D) value

A)

Variable name

B) Constant word used in 'C'

C)

Reserve character of 'C'

D) All of above

134. ` If-else ` statement is used as ________ .


A)

Decision control structure

C)

Repetition of code D)

B) Conditional statements
Both B and C

135. I/P functions are _______ .


A)

getchar(), puts(), gets()

B) getchar(), scanf(), gets()

C)

Both A and B

D) None of above

136. Which of the following statement is correct related to an if-else statement ?


A)

If we use an if it is compulsory to use an else

B)

Every if-else can be replaced by ? : operator.

C)

Nested if-else is allowed.

D)

Only one if-else can be written.

137. C=getchar () is used for a _______________ operation.


A)

Character input

C)

String input

B) character output
D) string output

138. putcharD) function is used for a _____________ opearations.


A)

Character input

C)

String input

B) character output
D) string output

139. Which is the correct syntax of do while loop?


A)

do { ------; ------;.)

B)

do{ ------; ------;)

C)

do { while (condition) ------; ------;}

D)

None of these

140. Syntax of while loop is _____.


A)

while { (condition); ------; ------;

B)

while(condition) { ------; ------; }

C)

while {-----; ------; }(condition);

D)

none of these

141. Struct keyword is used to define


A)

array

B) string

C) union

D) structure

C) getch

D)

C) data type

D) None of these

142. . ... ... is standard output function


A)

printf

B) scanf

clrscr

143. Which of the following is keyword


A)

if

B) string

144. For string data type ... format specifier is used


A)

%d

B) %c

C) %f

D) %s

145. When an ` if..else ` statement is included within an ` if ..else ` statement , it is known as a


_________.
A)

Next if statement B)another if statement

C)

combined if statement

D) Nested if statement

146. The ` *(&i) ` is stands for ,


A)

' value at address ' operator

B) ' address of ' operator

C)

both A&B

D) none of above

147. Which of the following is an iterative control structure?


A)

If

B) if else

C) do while

D) go to

148. The size of the data type ` double ` in C programming language is _____
A)

16 bits

B) 32 bits

C) 54 bits

D) 64 bits

149. Which of the following is a correct way of representing a variable in C?


A)

int 1ram;

B) float _calculate;

C)

int if;

D) int run#fast;

150. An integer constant in ` C ` must have


A)

At least one digit

B)

At least one decimal point

C)

A comma along with digits

D)

Digits separated by commas

151. The ` * ` operator stands for ____ .


A)

' Address of ' operator

B) ' value at address ' operator

C)

format specifier

D) both A&B

Which of the following is invalid variable name?


A)

BASICSALARY

B) _basic

C)

basic-hra

D) hELLO

153. Which of the following is NOT a character constant?


A)

Thank You

B)Enter values of P, N, R

C)

23.56E-03

D)

All the above

154. A ` C ` variable cannot start with


A)

An alphabet

B)

A number

C)

A special symbol other than underscore

D)

Both B & C above

155. Which of the following statement is wrong?

A)

mes = 123.56 ;

B)

con = 'T' * 'A' ;

C)

this = 'T' * 20 ;

D)

3+a=b;

156. A structure is a collection of______ .


A)

different data types scattered throughout memory

B)

the same data type scattered throughout memory

C)

the same data type placed next to each other in memory

D)

different data types placed next to each other in memory

157. The variables which hold addresses of other variables are,


A)

array

B) structure

C) pointer

D) both A&C

158. What will be the output of the following code ?


main()
{
int x=10,y=20;
if(x==y)
printf("\n%d%d",x,y);
}
A)

10,20

B) No Output

C)

syntax error

D) none of the above

159. A ` while ` loop is knowm as a


A)

exit controlled loop

B) entry controlled loop

C)

exit controlled loop

D) none of the above

160. Maximum no of elements in the array declaration int sss[5][8] is________


A)

28

B) 32

C) 35

D) 40

161. Pointer to pointers is a term used to describe


A)

pointers whose contents are the address of another pointer

B)

Any two pointers that point to the same variable

C)

Any two pointers that point to variables of the same type

D)

pointers used as formal parameters in a function header

162. An _______ is an integral value used to access an element in an array.


A)

constant

B) element

C) index

D) number

163. Which of the following file modes opens a file in the write state for updating?
A)

ab

B) a+b

C) rb

D) r+b

164. Which of these results when failure occurs during an open or during either a read or write
operation related to file I/O ?
A)

error state

B) fail state

C) read state

D) update state

165. Which of the following C functions is used to set file pointer?


A)

fwrite

B) fseek

166. * is used to denote_________

C) fread

D) putc

A)

Pointer

B) Addition

C) Division

D) Assignment

167. Structure is a collection of ________elements


A)

Same

B) Different

C)

Same or Different D) Same & Different

168. Pointer is nothing but_________


A)

address of variable B)

int

C)

char

D) value of variable

169. Character array is nothing but___________


A)

string

B) int

C) char

D) float

170. Which of the following statement transfers the control to the beginning of the loop?
A)

exit

B) break

C)

continue

D) None of the above

171. A ` do-while ` loop is useful when the statements within the loop must be executed:
A)

Only once

B) At least once

C)

More than once

D)None of the above

172. A case in ` switch ` statement is terminated by ________ if control should not fall through the
successive cases.
A)

break

B) break;

C) ;

D) break,

173. The getch() function in ` C ` is ___________


A)

user defined function

B) library function

C)

both of above

D) none of above

174. Scope of local variable is limited to___________


A)

entire program

B) with in function

C)

with in class

D) None of the above

175. Array can be initialized automatically, provided they are declared with following specifiers
A)

automatic

B) external

C) static

D) both B & C

176. Which of the following ` C ` statement is syntactically correct?


A)

for( );

B) for(;);

C) for(;;)

D) for( , );

177. Which one of the following is not a valid character specification for C
A)

special character B)

C)

digit

language ?

control
D) space

178. In what sequence the initialization, testing and execution of the body is done in a ` do-while `
loop
A)

initialization, execution of the body, testing

B)

Execution of the body, initialization, testing

C)

nitialization, testing, execution of the body

D)

None of the above

179. int *my_pointer; <BR> int barny; <BR> my_pointer=&barny; <BR> *my_pointer=3; <BR> Study
the above code and mark which is correct?
A)

value of barny becomes 3

B)

value of my_pointer remains unchanged;

C)

both A and B

D)

None of the above

180. enum is a ____________


A)

keyword

B)system defined data type

C)

abstract data type D) all of the above

181. Difference between ` while ` and ` do-while `


A)

'while' loop executes one or more times and 'do-while' executes zero or more times

B)

Both 'while' loop and 'do-while' executes one or more times

C)

Both 'while' loop and 'do-while' executes zero or more times

D)

'while' loop executes zero or more times and 'do-while' executes one or more times

182. An array is a collection of __________


A)

a set of values with different data types scattered throughout the memory

B)

a set of values with the same data types scattered throughout the memory

C)

a set of values with the same data types placed next to each other in the memory

D)

a set of values with different data types placed next to each other in the memory

183. Which element of the array does the expression num[4] references, where ` num ` is a name of
array?
A)

Forth

B) Third

C) Fifth

D) First

184. If you dont initialize a static array, with what value the elements will be initialised?
A)

B) an undetermined value

C)

-1

D) the character constant ' \0'

185. The strncat() funtion is used ______ .


A)

to copy n characters of a string

B)

to compare n characters of a string

C)

to reverse the string

D)

none of these.

186. Which of the following is not a integer constant in ` C ` ?


A)

'C'

B) 123

C) 45

D) 1.2

187. Which of the following data types is not valid in a switch --- case statement?
A)

character

B) integer

C) enum

188. Any variable in C starts with a _______ .


A)

Number

B) Keyword

D) float

C)

Alphabet

D) None of the above

189. In C, the address of ms memory location can be determined by the expression


A)

*M

B) M&

C) &M

D) M*

190. Which among the following is a unconditional control structure?


A)

do-while

B) if-else

C) goto

D) for

191. A ` continue ` statement terminates a_______.


A)

function

B) iteration

C)

body of a loop

D) None of the above

192. Constants in ` C ` refer to ___________


A)

A Fixed value that do not change during the execution of the program.

B)

A Fixed value that can change during the execution of the program.

C)

A Fixed value that can change after the compilation of the program.

D)

A Fixed value that can change after linking the program.

193. An array is the _________ data type.


A)

Primary

B) User defined

C)

Derived

D) Set

194. The syntax of the array declaration is:


A)

datatype nameofarray [size];

B) nameofarray [size];

C)

datatype nameofarray ;

D) all of above

195. If ` a ` is a variable defined in a ` C ` program then &a denotes the ______ .


A)

content of a

B) address of a

C)

Both A and B

D) none of these

196. Which of the following statements determines whether the contents of string1 are same as
contents of string2 or not?
A)

if (string1 == string2)

B)

if (string1, string2)

C)

if (strcmp(string1,string2) ==0 )

D)

if (strcmp(string1, string2) < 0)

197. The _______ format specification is used to write a long integer variable.
A)

%d

B) %dd

C) %lf

D) %ld

198. A ` break ` statement is used _______ .


A)

to terminate a loop and execute the next statement

B)

to skip a loop and terminate the program

C)

to continue a loop and execute the next statement

D)

execute the next statement

199. Which of the following function is used to read the input from a string?

A)

scanf

B) fscanf

C) fprintf

D) sscanf

200. In ` C ` , a semicolon is used ____________.


A)

to terminate a statement

B) to break a loop

C)

to give a comment

D) none of these

201. A ` switch ` statement is used to make a decision _________________.


A)

to switch the processor to execute some other program

B)

between two alternatives

C)

amongst many alternatives

D)

none of these

202. When applied to a variable, what does the unary "&" operator yield?
A)

The variable's address

B)

The variable's right value

C)

The variable's binary form

D)

The variable's value

203. To delete a dynamically allocated array named `a`, the correct statement is
A)

delete a;

B) delete a[0];

C)

delete []a;

D) delete [0]a;

204. Identify the invalid keyword in the following list.


A)
205.

integer

B) char

C) float

D) long int

Which of the following is not a valid data type In ` C ` ?


A)

char

B) float

C) int

D) logical

206. && is used as a __________


A)

operand

B) Mathematical operator

C)

logical operator

D)None of the above

207. What is the difference between declaration and a definition of a variable?


A)

Both can occur multiple times, but a declaration must occur first.

B)

There is no difference between them.

C)

A declaration occurs once, but a definition may occur many times.

D)

A definition occurs once, but a declaration may occur many times.

208. Array is the collection of ----------- data type.


A)

Disimilar

B) Similar

C) None of these

D) two

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

13.

14.

15.

16.

17.

18.

19.

20.

21.

22.

23.

24.

25.

26.

27.

28.

29.

30.

31.

32.

33.

34.

35.

36.

37.

38.

39.

40.

41.

42.

43.

44.

45.

46.

47.

48.

49.

50.

51.

52.

53.

54.

55.

56.

57.

58.

59.

60.

61.

62.

63.

64.

65.

66.

67.

68.

69.

70.

71.

72.

73.

74.

75.

76.

77.

78.

79.

80.

81.

82.

83.

84.

85.

86.

87.

88.

89.

90.

91.

92.

93.

94.

95.

96.

97.

98.

99.

100.

101.

102.

103.

104.

105.

106.

107.

108.

109.

110.

111.

112.

113.

114.

115.

116.

117.

118.

119.

120.

121.

122.

123.

124.

125.

126.

127.

128.

129.

130.

131.

132.

133.

134.

135.

136.

137.

138.

139.

140.

141.

142.

143.

144.

145.

146.

147.

148.

149.

150.

151.

152.

153.

154.

155.

156.

157.

158.

159.

160.

161.

162.

163.

164.

165.

166.

167.

168.

169.

170.

171.

172.

173.

174.

175.

176.

177.

178.

179.

180.

181.

182.

183.

184.

185.

186.

187.

188.

189.

190

191.

192.

193.

194.

195.

196.

197.

198.

199.

200.

201.

202.

203.

204.

205.

206.

207.

208.

1. Pointers can be used to achive ..


a] Call by function
c] call by name

b] call by reference
d] call by procedure

2. Correct declaration of pointer variable p1,p2

3:

a] int p1,p2;

b] int *p1,p2;

c] int p1,*p2

d] int *p1,*p2

What is the output of this C code?


#include <stdio.h>
void foo(int*);
int main()
{
int i = 10;
foo((&i)++);
}
void foo(int *p)
{
printf("%d\n", *p);
}.
a) 10
c)

Compile time error

b) garbage value
d) code crash

4:--- #include <stdio.h>


void foo(int*);
int main()
{
int i = 10, *p = &i;
foo(p++);
}
void foo(int *p)
{
printf("%d\n", *p);
a) 10

b) garbage value

c)

Compile time error

d) code crash

5:-#include <stdio.h>
void foo(float *);
int main()
{
int i = 10, *p = &i;
foo(&i);
}
void foo(float *p)
{
printf("%f\n", *p);
}

a)

10.000000

c)

b) 0.000000

Compile time error

d) syntax error

..
6:-- #include <stdio.h>
int main()
{
int i = 97, *p = &i;
foo(&i);
printf("%d ", *p);
}
void foo(int *p)
{
int j = 2;
p = &j;
printf("%d ", *p);
}

a)

2 97

c)

b) 2 2
Compile time error

..
7:--#include <stdio.h>
int main()
{
int i = 97, *p = &i;
foo(&p);
printf("%d ", *p);

d) syntax error

return 0;
}
void foo(int **p)
{
int j = 2;
*p = &j;
printf("%d ", **p);
}

a)

2 97

c)

b) 2 2
Compile time error

d) syntax error

..
8:-----When the ___________ is present in front of a variable name, it represents the address of that
variable.
1.
2.
3.
4.

asterisk ( * )
conditional operator
ampersand ( & )
semicolon ( ; )

..
9:--- A pointer variable may be initialized with
1.
2.
3.
4.

any non-zero integer value


any address in the computer's memory
the address of an existing variable
a and c only

..
10:-- A pointer variable is designed to store ________.
1.
2.
3.
4.

any legal C++ value


only floating-point values
a memory address
a float value

11-- We should use the delete operator for objects that were _______

a)

never used

c)

created with the new operator

b) not correctly initialized

d) dereferenced inappropriately

.
12--- #include< stdio.h>
int main()
{
char arr[20];
int i;
for(i=0;i<10;i++)
*(arr+i) = 65+i;
*(arr + i) = '\0';
printf("%s",arr);
return(0);
}
a)
ABCDEFGHIJ
c)

JJJJJJJJJJ

.
13:-- The size of a pointer data type is
a. 2 bytes
b. 4 bytes
c. the same size as an int
d. dependent on the machine
..
14
Given the C declaration
float t1, *t2=&t1;
which variable contains "garbage"?
a. t1
b. t2
c. t2
d. all of the above.

15
.What would be the output of the following program?
#include "stdio.h"
main( )
{
printf( "%d %d", sizeof(NULL),sizeof(" " ) );
}

b) AAAAAAAAAA
d) None Of These

(a) 1 1
(b) 1 2
(c) 2 1
(d) 2 2
.
16
Are the three declarations char **apple, char
*orange[ ], and char cherry [ ] [ ] same?
(a) Yes
(b) No
(c) Can't say
(d) None
..
17
Can two different near pointers contain two different
addresses but refer to the same location in memory?
(a) Yes
(b) No
(c) Can't say
(d) None
..
18
Would the following program give any warning on compilation?
#include "stdio.h"
main( )
{
int *p1,i=25;
void *p2;
p1=&i;
p2=&i;
p1=p2;
p2=p1;
}
(a) Yes
(b) No
(c) Can't say
(d) None
.
19
Would the following program give any warning on compilation?
#include "stdioh"
main( )
{
float *p1,i=25.50;

char *p2;
p1=&i;
p2=&i;
}
(a) Yes. Suspicious pointer conversion in function main
(b) No
(c) Can't say
(d) None
..
20
What warning would be generated on compiling the following
program?
main( )
{
char far *scr;
scr=0*B8000000;
*scr = 'A';
}
(a) Suspicious pointer conversion in function main
(b) Non-portable pointer assignment in function main
(c) Can't say
(d) None

21 .How would you eliminate the warning generated on compiling


the following program?
main( )
{
char far *scr;
scr=0*B8000000;
*scr = 'A';
}
(a) Use the typecast scr= (char *far ) 0*B8000000;
(b) Use the typecast scr= (char far * ) 0*B8000000;
(c) Use the typecast scr= (char **far ) 0*B8000000;
(d) Use the typecast scr= (char far ** ) 0*B8000000;

22
In a large data model (compact, large, huge) all pointers
to data are 32 bits long,whereas in a small data model (tiny,
small,medium) all pointers are 16 bits long
(a) True

(b) False
(c) Can't say
(d) None

23
. A near pointer uses the contents of CS register
(if the pointer is pointing to code) or contents of DS
register (if the pointer is pointing to data) for the
segment part,whereas the offset part is stored in the
16-bit near pointer
(a) True
(b) False
(c) Can't say
(d) None
24. What would be the output of the following program?
main( )
{
char far *a=0*00000120;
char far *b=0*00100020;
char far *c=0*00120000;
if(a==b)
printf("\nHello");
if(a==c)
printf("\nHi");
if(b==c)
printf("\nHello Hi");
if(a>b && a>c &&b>c)
printf("\nBye");
}
(a) Hello
(b) Hi
(c) Hello Hi
(d) Bye

25. What would be the output of the following program?


main( )
{
char huge *a=0*00000120;
char huge *b=0*00100020;

char huge *c=0*00120000;


if(a==b)
printf("\nHello");
if(a==c)
printf("\nHi");
if(b==c)
printf("\nHello Hi");
if(a>b && a>c &&b>c)
printf("\nBye");
}
(a) Hello
(b) Hi
(c) Hello Hi
(d) all
26. Are the expressions *ptr++ and ++*ptr same?
(a) Yes
(b) No
(c) Can't Say
(d) None
27.Can you write another expression which does the same
job as ++*ptr?
(a) (ptr*)++
(b) *ptr++
(c) ptr*++
(d) (*ptr)++

28. What would be the equivalent pointer expression for


referring the same element as a[i][j][k][l]?
(a) *(*(*(*(a+i)+j)+k)+l)
(b) *(*(*(*a[i])[j])[k])[l])
(c) both
(d) None

29. What would be the output of the following program ?


main( )
{
int arr[ ]={12,13,14,15,16};
printf("\n%d %d %d",sizeof(arr),sizeof(*arr),

sizeof(arr[0]));
}
(a) 10 4 4
(b) 10 4 2
(c) 10 2 2
(d) 10 2 4

30.What would be the output of the following program


assuming that the array begins at location 1002?
main( )
{
int a[3][4]={1,2,3,4,
5,6,7,8,
9,10,11,12
};
printf( "\n%u %u %u",a[0]+1,*(a[0]+1),*(*(a+0)+1));
}
(a) 1004 2 2
(b) 1004 4 4
(c) 1002 2 2
(d) 1002 4 4

31. What would be the output of the following program


assuming that the array begins at location 1002?
main( )
{
int a[2][3][4]={ {
1,2,3,4,
5,6,7,8,
9,1,1,2
},
{
2,1,4,7,
6,7,8,9,
0,0,0,0
}
};
printf("\n%u %u %u %d",a,*a,**a,***a);
}
(a) 1002 1002 1002 2

(b) 1002 1002 1002 1


(c) 1004 1004 1004 1
(d) 1004 1004 1004 2

32. In the following program how would you print 50


using p?
main( )
{
int a[ ]={10,20,30,40,50};
char *p;
p = (char *) a;
}
(a) printf("\n%d",*( (int *)p+4) );
(b) printf("\n%d",( (int *)p+4) );
(c) printf("\n%d",*( (int )p+4) );
(d) printf("\n%d",*( (int **)p+4) );

33. In the following program add a statement in the


function fun( ) such that address
of a gets stored
in j
main( )
{
int *j;
void fun(int **);
fun(&j);
}
void fun(int **k)
{
int a=10;
}
(a) *k=&a;
(b) &a=*k;
(c) &k=*a;
(d) *a=&k;

34.How would you declare an array of three function


pointers where each function receives two ints and

returns a float?
(a) float (arr[3])(int,int);
(b) int (arr[3])(float,float);
(c) int (*arr[3])(float,float);
(d) float(*arr[3])(int,int);
35. What does the following statement mean?
int (*fp)(char*)
a) pointer to a pointer
b) pointer to an array of chars
c) pointer to function taking a char* argument and returns an int
d) function taking a char* argument and returning a pointer to int

36. The operator used for dereferencing or indirection is ____


a) *
b) &
c) ->
d) >>

37. Choose the right option


string* x, y;
a) x is a pointer to a string, y is a string
b) y is a pointer to a string, x is a string
c) both x and y are pointer to string types
d) none of the mentioned

Explanantion:* is to be grouped with the variables not the data types.


38. Which one of the following is not a possible state for a pointer.
a) hold the address of the specific object
b) point one past the end of an object
c) zero
d) point to a tye

Explanation:A pointer can be in only 3 states a,b and c.


39 Which of the following is illegal?
a) int *ip;
b) string s, *sp = 0;
c) int i; double* dp = &i;
d) int *pi = 0;

Explanation:dp is initialized int value of i.


40. What will happen in this code?
int a = 100, b = 200;
int *p = &a, *q = &b;
p = q;
a) b is assigned to a
b) p now points to b
c) a is assigned to b
d) q now points to a
Explanation:Assigning to refrence changes the object to which the refrence is bound.
41
The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char and
returns a pointer to a pointer to a integer is
a) int **fun(float**, char**)
b) int *fun(float*, char*)
c) int ***fun(float*, char**)
d) int ***fun(*float, **char)

42
Prior to using a pointer variable it should be
A.

Declared

B.

Initialized

C.

Both declared and initalized

D.

None of these

Explanation :
Using a pointer variable, without initializing it, will be disastrous, as it will have a garbage value

43
The indirection operator in C is the
a.&

b.@
c.*
d.!

44. The indirection operator in C goes ______the variable that it operates on.
a. in front of
b. in back of
c.both
d noe
.
45. When the * is used in a declaration it is accomplishing indirection.
a. true
b. false
(c) Can't say
(d) None
..
46. When a pointer variable is declared, its value is garbage, i.e. it points to garbage.
a. true
b. false
(c) Can't say
(d) None

47. Which function does the asterisk in C not have?


a. indirection
b. declares a pointer

c. provides the address of its operand


d. multiplication
..

48. Given the C code segment below.


int *p, s, *t=&s, u=s;
s=100;
++(*t);
p=t;
++(*p);
-u;
After the above code segment, *p would contain
a. 99
b. 100
c. 101
d. 102
49
. Given the C code segment below.
int *p, s, *t=&s, u=s;
s=100;
++(*t);
p=t;
++(*p);
-u;

After the above code segment, u would contain


a.99
b.1L00
c. 101
d. 102

50
Given the C code segment below.
int *p, s, *t=&s, u=s;
s=100;
++(*t);
p=t;
++(*p);
-u;
After the above code segment, *t would contain
a. 99
b. 100
c. 101
d. 102
51. Given the C code segment below.
int *p, s, *t=&s, u=s;
s=100;
++(*t);
p=t;

++(*p);
-u;
After the above code segment, s would contain
a. 99
b. 100
c. 101
d. 102
52. A memory address has its own unique data type.
a. true
b. false
(c) Can't say
(d) None
53. The size of a pointer varies, depending on what it points to.
a. true
b. false
(c) Can't say
(d) None
54. The scanf function requires addresses rather than variables for its arguments.
a. true
b. false
(c) Can't say
(d) None
55. The ____ conversion code prints out addresses in pointer types.
a. %x
b. %t

c. %p
d. %r
56. Addresses represented by pointer types are chosen by C, and the programmer has no control over
them.
a. true
b. false
(c) Can't say
(d) None
57. A float declaration can define both pointers to floats and regular float variables in the same
declaration.
a. true
b. false
(c) Can't say
(d) None
58.
int *x;
int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code. x is not initialized in its declaration.
a. true
b. false
(c) Can't say
(d) None
59.
int *x;

int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code y is initialized to -1.
a. true
b. false
(c) Can't say
(d) None
60.
int *x;
int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code The value of *x is
a. the address of y
b. -1
c.0
d. garbage
61.
int *x;
int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code z and x point to the same memory location.

a. true
b. false
(c) Can't say
(d) None
62.
int *x;
int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code The value of *y is _.
a. garbage
b. undetermined
c. an error, since y cannot be dereferenced
d. -1
63.
int *x;
int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code No pointer defined above points to t's memory location.
a. true
b. false
(c) Can't say
(d) None
64.

int *x;
int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code Although *w is garbage, w is not.
a. true
b. false
(c) Can't say
(d) None
65. int *x;
int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code w and z both point to y.
a. true
b. false
(c) Can't say
(d) None
66. Which of the following would represent the value of -1?
a. *t
b. &t
c. *x
d. *&t
67. int *x;
int y,t=-1;

int *w,*z=&y;
x=&y;
in the above code The type of *x is
a. a type that cannot be determined
b. int
c. long int
d. pointer to an int
68. . int *x;
int y,t=-1;
int *w,*z=&y;
x=&y;
in the above code The type of &y is
a. a type that cannot be determined
b. int
c. long int
d. pointer to an int
69. Both the indirection operator and the address-of operator
a. must be used in declarations
b. are binary operators
c. are unary operators
d. are not overloaded
70. Pointers cannot be passed to functions.
a. true
b. false

(c) Can't say


(d) None
71. Given the declaration
float x, *z=&x;
which scanf would successfully read in a float value into x?
a. scanf("%f", x);
b. scanf ("%f",z);
c. scanf("%f " ,*z) ;
d. all of the above
72 Consider the declaration:
char x[]="WHATIZIT";
char *y="WHATIZIT";
The output of puts(x) an puts(y) will be
A

Will be the same

B.

Different

C.

Not related

D.

Error

73 Consider the declarations:


char first (int(*)(char,float));
int second(char,float);
Which of the following function invocation is valid?
A.

First(*second); B.

First(&second);

C.

First(second);

D.

None fo these

74 In C a pointer variable to an integer can be created by the decalaration


A.

int p*;

B.

int *p;

C.

int +p;

D.

int $p;

75 Which of the following is most appropriate?


A.

int*matrix; .....; free(void) matrix;

B.

int*matrix; .....; free (matrix);

C.

int*matrix; .....; if(matrix!=null) free(void*)matrix;

D.

None fo these

76

77

* is a ________________
a] Indirect operator

b]Structure member reference operator

c] Assignment operator

d] Address of operator

Are the expression *ptr++ and ++*ptr are same?

(a) Yes
(b) No
(c) Can't say
(d) None
Explanation:
*ptr++ increments the pointer and not the value, whereas the ++*ptr increments the value being
pointed by ptr
78

Will the program compile?

#include<stdio.h>
int main()
{
char str[5] = "IndiaBIX";
return 0;
}
(a) Yes

(b) No
(c) Can't say
(d) None
Explanation:
C doesn't do array bounds checking at compile time, hence this compiles. But, the modern compilers like
Turbo C++ detects this as 'Error: Too many initializers'. GCC would give you a warning.
79

What is (void*)0?

A.Representation of NULL pointer


B.Representation of void pointer
C.Error
D.None of above

80

Can you combine the following two statements into one?

char *p;
p = (char*) malloc(100);
A.char p = *malloc(100);
B.char *p = (char) malloc(100);
C.char *p = (char*)malloc(100);
D.char *p = (char *)(malloc*)(100);

81

In which header file is the NULL macro defined?

A.stdio.h

stddef.h

C.stdio.h and stddef.h

D.

math.h

Explanation:

The macro "NULL" is defined in locale.h, stddef.h, stdio.h, stdlib.h, string.h, time.h, and wchar.h.
82
If a variable is a pointer to a structure, then which of the following operator is used to access
data members of the structure through the pointer variable?
A.

C.*

B.

&

D.

->
Answers

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

12.

13.

14.

15.

16.

17.

18.

19.

20.

21.

22.

23.

24.

25.

26.

27.

28.

29.

30.

31.

32.

33.

34.

35.

36.

37.

38.

39.

40.

41.

42.

43.

44.

45.

46.

47.

48.

49.

50.

51.

52.

53.

54.

55.

56.

57.

58.

59.

60.

62.

63.

64.

65.

61.

66.

67.

71.

72.

76.

81.

68.

69.

70.

73.

74.

75.

77.

78.

79.

80.

82.

1
An algorithm is made up of 2 modules Ml and M2. If order of M1 is f(n) and M2 is g(n) then the
order of the algorithm is
A. max (f (n) ,g (n))
B. min (f (n) ,g (n) )
C. f (n) + g (n)
D.f (n) x g (n )
Answer: Option A
2.There are 4 different algorithms AI, A2, A3, A4 to solve a given problem with the order Iog(n),
log(log(n)), nIog(n) ,n / log(n) respectively. Which is the best algorithm?
A. A1
B. A2
C. A4
D. A3
Answer: Option B
3.

The concept of order (Big O) is important because

A. it can be used to decide the best algorithm that solves a given problem
B. it determines the maximum size of a problem that can be solved in a given system, in a given amount
of time
C. Both(a) and (b)
D. none of the above
Answer: Option C
4

The time complexity of an algorithm T(n), where n is the input size, is given by

T( n) = T( n - 1) + 1/n if n > 1

The order of this algorithm is


A. log n
B. n
C. n2
D. nn
Answer: Option A
5
a 1 is

The order of an algorithm that finds whether a given Boolean function of 'n' variables, produces

A. constant
B. linear
C. logarithmic
D. exponential
Answer: Option A
6
In the worst case, the number of comparisons needed to search a single linked list of length n
for a given element is
A. logn
B. n/2
C. log(n/2)-1
D. n
Ans. Option D
7.

1: A mathematical-model with a collection of operations defined on that model is called

A. Data Structure
B. Abstract Data Type
C. Primitive Data Type
D. Algorithm
Answer: Option B

8.

Representation of data structure in memory is known as:

A. Recursive

B. Abstract data type


C. Storage structure
D. File structure
Answer: Option B.
10.

The term data structure refers to -----------and interelationship beween them.

A.Programming language Statements .


B.Coding Standards.
C.Organization of data elements.
D.None of this
Answer: Option C
11

Array is an example of.

A.Static data structure.


B.Dynamic Data Structure.
C.Linear data structure.
D.Both A and C

Ans: Option D
12

Data structure in which one predecessor may have one or more successor.

A.Linear
B.Primitive
C.Non-Linear
D.None of the above

Ans:Option C
13.

What is Data Structure ?

a.

Way to organize data

b.

Accessing of data elements in specified manner

c.

Organization of mathematical and logical concepts

d.

All of Above

Ans:Option A
14.

Two main measures for the efficiency of algorithm are

A.Time and space.


B.Processor and memory
C.Data and Space.
D.Complexity and capacity
Ans:Option A
15.

Time factor while determining the efficiency of algorithm is measured by.

A.Counting Microseconds.
B.Counting no of statements.
C.Counting no of key opeartions.
D.Counting key algorithm
Ans:Option C
16

The complexity of the average case of an algorithm is

a. Much more complicated to analyze than that of worst case


b. Much more simpler to analyze than that of worst case
c. Sometimes more complicated and some other times simpler than that of worst case
d. None or above
Ans:Option A

17
18

Linked lists are best suited

a. for relatively permanent collections of data


b. for the size of the structure and the data in the structure are constantly changing
c. for both of above situation
d. for none of above situation
Ans:B
19.

Which of the following data structures are indexed structures?

a. linear arrays
b. linked lists
c. both of above
d. none of above
Ans:A
20

Which of the following data structure store the homogeneous data elements?

a. Arrays
b. Records
c. Pointers
d. None
Ans:A
21

Which of the following data structure can store the nonhomogeneous data elements?

a. Arrays
b. Records
c. Pointers
d. None
Ans:B

22

Which of the following data structure is linear type?

a.Strings
b.Lists
c:Queues
d:All of above
Ans:D
23

3.Which of the following data structure is non-linear type?

a.Strings
bLists
c. Stacks
d.None of above
Ans:D
24

Which of the following case does not exist in complexity theory

A. Best case
B. Worst case
C. Average case
D. NULL case
Answer :D
25

The time required to search an element in a linked list of length n is

A. O(log2 n)
B. O(n)
C. O(1)
D. 0 (n2)
Answer :D
26

27

Consider the following two functions.

f(n) = n3, if 0n < 10,000


n2, otherwise
g (n) = n, if 0n < 100
n25n,otherwise
Which of the following is/are true?
A. f(n) is O(n3)
B. g(n) is O(n2)
C. O(f(n)) is same as O(g(n))
D. Both(b) and (c
Answer: Option D
28

The complexity of the average case of an algorithm is

A) Much more complicated to analyze than that of worst case


B) Much more simpler to analyze than that of worst case
C) Sometimes more complicated and some other times simpler than that of worst case
D) None or above
Answer : A.
29.

Data which can't be divided further into meaningful pieces is

A:Atomic data
B:primitive data
C:Composite data
D:None of the above
Answer:A
30

abstract data type is where :

A:memory required is less as compare to builtin data type

B:Implementation details are kept hidden.


C:Memory required is greater than built in data type.
D:None of the above.
Answer: B
31
Which of the following is not the part of ADT description?
A) Data
B) Operations
C) Both of the above
D) None of the above
Ans: D
32

. is not the component of data structure.

A) Operations
B) Storage Structures
C)

Algorithms

CI)

None of above

Ans: D
33

Which data structure is best suited to print the documents in the printer

A. Stacks
B. Queues
C. Both Stacks and Queues
D. Arrays
Answer: B
34.
When new data are to be inserted into a data structure, but there is no available space; this
situation is usually called
a. underflow

b. overflow
c. housefull
d. saturated
Answer: B
35.
There are 4 different algorithms A1, A2, A3, A4 to solve a given problem with the order log (n),
loglog (n), nlog (n), n/log (n) respectively. Which is the best algorithm?
(a) A1
(b) A2
(c) A4
(d) A3
Ans: (b)
36.

What is the worst-case time for serial search finding a single item in an array?

A. Constant time
B. Logarithmic time
C. Linear time
D. Quadratic time
Ans: (d)

37

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

A. Constant
B. Linear
C. Logarithmic
D. Quadratic
Ans: (b)
38

Which of the following is primitive type?

A. Byte
B. Integer
C. Float

D: Choice (C) & (D)

Ans:D

1.The time complexity of linear search algorithm over an array of n elements is


A.O (log2 n)
B.O(n)
C.O(n log2 n)
D.0 (n2)
ANSWER: B
2.The time required to search an element in a linked list of length n is
A.O(log2 n)
B.O(n)
C.O(1)
D.0 (n2)
ANSWER: B
3.The worst case time required to search a given element in a sorted linked list of length n is
A.O(1)
B.O(log2 n)
C.O(n)
D.O(n log2 n)
ANSWER: C
4.For a linear search in an array of n elements the time complexity for best, worst and average
case are ......., ....... and ........ respectively
A.O(n), O(1), and O(n/2)
B.O(1), O(n) and O(n/2)
C.O(1),O(n) and O(n)
D.O(1), O(n) and (n-1/2)
ANSWER: C
5.Using the standard algorithm, what is the time required to determine that a number n is prime ?
A.Linear time
B.Logarithmic time
C.Constant time
D.Quadratic time
ANSWER: A
6.Which of the following is false ?
A.A serial search begins with the first array element

B.A serial search continues searching, element by element, either until a match is found or until
the end of the array is encountered
C.A serial search is useful when the amount of data that must be search is small
D.For a serial search to work, the data in the array must be arranged in either alphabetical or
numerical order
ANSWER: D
7.The average successful search time for sequential search on 'n' items is
A.n/2
B.(n-1)/2
C.(n+1)/2
D.log (n)+1
ANSWER: C
2.BINARY SEARCH
8.A search begins the search with the element that is located in the middle of the array
A.serial
B.random
C.parallel
D.binary
ANSWER: D
9.Suppose DATA array contains 1000000 elements. Using the binary search algorithm, one
requires only about n comparisons to find the location of an item in the DATA array, then n is
A.60
B.45
C.20
D.None of these
ANSWER: C
10.The data for which you are searching is called
A.search argument
B.sorting argument
C.detection argument
D.binary argument
ANSWER: A
11.Which of the following is false ?
A.A binary search begins with the middle element in the array
B.A binary search continues having the array either until a match is found or until there are no
more elements to search
C.If the search argument is greater than the value located in the middle of the binary, the binary
search continues in the upper half of the array
D.For a binary search to work, the data in the array must be arranged in either alphabetical or
numerical order
ANSWER: C

12.The order of the binary search algorithm is


A.n
B.n2
C.nlog(n)
D.log(n)
ANSWER: Option D
Let there be n items to be searched, After the first search the list is divided into two, each of
length n/2. After the next search, 2 lists, each of length n/4 and so on. This successive division
has to stop when the length of lists becomes 1. Let it happen after k steps. After the k steps,
n/2k=1. Solving, k = log2n.
Hence the order is log(n).
13.A characteristic of the data that binary search uses but the linear search ignores is
the___________
A.Order of the elements of the list
B.Length of the list
C.Maximum value in list
D.Type of elements of the list
ANSWER: A
2.SORTING
1.BUBBLE
14.Which of the following sorting methods would be most suitable for sorting a list which is
almost sorted
A.Bubble Sort
B.Insertion Sort
C.Selection Sort
C.Quick Sort
ANSWER: A
15.A sort which compares adjacent elements in a list and switches where necessary is
A.insertion sort
B.heap sort
C.quick sort
D.bubble sort
ANSWER: D
16.Which of the following sorting procedure is the slowest ?
A.Quick sort
B.Heap sort
C.Shell sort
D.Bubble sort
ANSWER: D

17.The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending
order, using bubble sort is
A.11
B.12
C.13
D.14
ANSWER: D
18.A machine took 200 sec to sort 200 names, using bubble sort. In 800 sec, it can approximately
sort
A.400 names
B.800 names
C.750 names
D.800 names
ANSWER: A
Explanation .
For sorting 200 names bubble sort makes 200x(199/2)= 19900 comaprisons. The time needed for
1 comparison is 200 sec (approximately). In 800 sec it can make 80,000 comparisons. We have
to find n, such that n(n-1)/2= 80,000. Solving, n is approximately 400.
19.Given a file of size n the number of times a given file is passed through in bubble sort is
A.n2
B.n - 1
C.n log n
ANSWER: B
20.In bubble sort, for a file of size n, after p iterations number of records in proper positions is
A.n - p
B.n - p + 1
C.p
ANSWER: A
21.For a file of size n, during each pth pass the number of last records left out are
A.n - p
B.p
C.p - 1
ANSWER: C
22.Total number of comparisons in bubble sort is
A.O(n log n)
B.O(n^2)
C.O(n)
ANSWER: B
2.SELECTION

21.A sort which iteratively passes through a list to exchange the first element with any element
less than it and then repeats with a new first element is called
A.insertion sort
B.selection sort
C.heap sort
D.quick sort
ANSWER: B
22.Which of the following sorting methods will be the best if number of swappings done, is the
only measure of efficienty?
A.Bubble sort
B.Selection sort
C.Insertion sort
D.Quick sort
ANSWER: B
23.What is the number of swaps required to sort n elements using selection sort, in the worst
case?
A.T(n)
B.T(n log n)
C.T(n2)
D.T(n2 log n)
ANSWER: A
Explanation .
Note that we are concerned about the swaps, not the comparisons. In the best case, there is no
need for any swap. The best case scenario is when the given list of elements is already in sorted
order. In the worst case, we need (n-1) swaps. For example, consider the list 10, 5, 6, 7, 8, 9. We
need 5 swaps. To conclude, 0 = (the number of required swaps) < n
24.Staright selection sort is basically a method of repeated
A.interchange
B.searching
C.position adjustment
ANSWER: C
25.Number of selections required to sort a file of size N by straight selection requires
a.N - 1
b.log N
c.O(N2)
ANSWER: A
26.For sorting a file of size n by straight selection sort, the number of comparisons made in the
first pass is
a.n
b.n - 1

c.n(n - 1)/2
ANSWER: B

3.INSERTION
27.Which of the following sorting method is stable ?
A.insertion sort
B.Quick sort
C.Shell sort
D.Heap sort
ANSWER: A
28.The way a card game player arranges his cards as he picks them up one by one, is an example
of
A.bubble sort
B.Selection sort
C.insertion sort
D.merge sort
ANSWER: C
29.You want to check whether a given set of items is sorted. Which of the following sorting
methods will be most efficient if it is already in sorted order?
A.Bubble sort
B.Selection sort
C.Insertion sort
D.Merge Sort
ANSWER: C
4.MERGE
30.Which of the following sorting algorithms does not have a worst case running time of O(n2)?
A.Insertion sort
B.Merge sort
C.Quick sort
D.Bubble sort
ANSWER: B
31.Merge sort uses
A.divide and conquer strategy
B.backtracking approach
C.heuristic search
D.greedy approach
ANSWER: A

32.Assume 5 buffer pages are available to sort a file of 105 pages. The cost of sorting using mway merge sort is
A.206
B.618
C.840
D.926
ANSWER: C
Explanation .
In the first pass we can create [105/5] = 21 sorted sub-files, each 5 pages long. In the second pass
by 4-way merging (4 because one of the 5 available buffers has to be reserved for holding the
output), one can create [21/4] = 6 sorted sub-files, each 20 pages long (except the last). Again
applying 4-way merge sort, we get create [6/4] = 2 sorted sub-files. These two can be merged to
get the final sorted file. We need a total of 4 passes. Total cost will be 2 x 105 x 4 = 840 units.
5.QUICK

33.A desirable choice for the partitioning element in quick sort is


A.First element of the list
B.Last element of the list
C.Randomly chosen element of the list
D.Median of the list
Answer: A
34.Quick sort is also known as
A.Merge sort
B.Heap sort
C.Bubble sort
C.None of these
ANSWER: D
35.A sort which relatively passes through a list to exchange the first element with any element
less than it and then repeats with a new first element is called
A.Insertion sort
B.Selection sort
C.Heap sort
D.Quick sort
ANSWER: D
36.The best average behaviour is shown by
A.Quick Sort
B.Merge Sort
C.Insertion Sort
C.Heap Sort
ANSWER: A

37.Which of the following sorting methods sorts a given set of items that is already in sorted
order or in reverse sorted order with equal speed?
A.Heap sort
B.Quick sort
C.Insertion sort
D.Selection sort
ANSWER: B
38.A machine needs a minimum of 100 sec to sort 1000 names by quick sort. The minimum time
needed to sort 100 names will be approximately
A.50.2 sec
B.6.7 sec
C.72.7 sec
D.11.2 sec
ANSWER: B
Explanation:
In the best case, quick sort algorithm makes nlog(n) comparisons. So 1000log (1000) = 9000
comparisons, which takes 100s. To sort 100 names a minimum of 100 (log 100) = 600
comparisons are needeD. The takes 100600/9000= 6.7s.
39.Which of the following is useful in implementing quick sort?
A.Stack
B.Set
C.List
D.Queue
ANSWER: A
40.In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an
T(n) time algorithm. What is the worst case time complexity of the quick sort?
A.T(n)
B.T(n log n)
C.T(n2)
D.T(n2 log n)
ANSWER: B
Explanation .
If the list is evenly split at each and every step, the recursion depth will be log n, and the (worst)
time complexity will be n log n. In the given scenario, the recursion depth cannot be greater than
2 log n. So the (worst) time complexity will still be bound by n log n.
41.The running time of the following sorting algorithm depends on whether the partitioning is
balanced or unbalanced
A.Insertion sort
B.Selection sort
C.Quick sort
D.Merge sort
ANSWER: C

42.In worst case Quick Sort has order


A.O (n log n)
B.O (n^2/2)
C.O (log n)
D.O (n2/4)
ANSWER: B
43.In quick sort, the number of partitions into which the file of size n is divided by a selected
record is
A.n
B.n - 1
C.2
ANSWER: C
44.The total number of comparisons made in quick sort for sorting a file of size n, is
a.O(n log n)
b.O(n2)
c.n(log n)
ANSWER: A
45.Quick sort efficiency can be improved by adopting
a.non-recursive method
b.insertion method
c.tree search method
ANSWER: A
46.For the improvement of efficiency of quick sort the pivot can be
a.the first element
b.the mean element
c.the last element
ANSWER: B
47.Quick sort is the fastest available method of sorting because of
a.low over head
b.O(n log n) comparisons
c.low over head and also O(n log n) comparisons
ANSWER: C
6.BUCKET/RADIX SORT
48.The maximum number of comparisons needed to sort 7 items using radix sort is (assume each
item is 4 digit decimal number)
A.280
B.40
C.47

D.38
ANSWER: A
49.Number of passes required to sort the given file by radix sort is dependent on
A.size of the file
B.number of characters in the keys
C.position of characters in the keys
ANSWER: B
50.Sort time in radix sort is dependent on
A.number of records
B.number of characters in the key
C.both the number of records and the number of characters in the keys
ANSWER: B
51.Combination of radix sort and insertion sort is sometimes suitable when the number of
characters in the key is
A.small
B.large
C.medium
ANSWER: B
7.MIXED
52.Which of the following best describes sorting ?
A.Accessing and processing each record exactly once
B.Finding the location of the record with a given key
C.Arranging the data (record) in some given order
D.Adding a new record to the data structure
ANSWER: C
53.The running time of an algorithm T(n), where 'n' is the input size, is given by T(n) = 8T(n/2)
+ qn, if n>1 Where p,q are constants. The order of this algorithm is
A.n2
B.nn
C.n3
D.n
ANSWER: C
54.Sorting is useful for
A.report generation
B.responding toe queries easily
C.making searching easier and efficient
D.All of these
ANSWER: D

55.Choose the correct statements


A.Internal sorting is used if the number of items to be sorted is very large.
B.External sorting is used if the number of items to be sorted is very large
C.External sorting needs auxilary storage
D.Both (b) & (c)
ANSWER: D
56.A sorting technique that guarantees that records with the same primary key occurs in the same
order in the sorted list as in the original unsorted list is said to be
A.stable
B.consistent
C.External
D.linear
ANSWER: A
57.You have to sort a list L consisting of a sorted list followed by a few random
elements.Which of the following sorting methods would be especially suitable for such a task?
A.Bubble sort
B.Selection sort
C.Quick sort
D.Insertion sort
Ans:D
58.Which of the following sorting methods would be most suitable for sorting a list which is
already sorted
A.Bubble Sort
B.Insertion Sort
C.Selection Sort
C.Quick Sort
ANSWER: B

1. If the sequence of operations - push(1), push(2), pop, push(1), push(2), pop, pop,
pop, push(2), pop are performed on a stack, the sequence of popped out values are ?
A. 2, 2, 1, 1, 2
B. 2, 2, 1, 2, 2
C. 2, 1, 2, 2, 1
D. 2, 1, 2, 2, 2
Answer = A

2. Sparse matrices have ?


A. many zero entries
B. many non- zero entries
C. higher dimension
D. none of above
Answer = A
3. How do you find the degree of a polynomial?
A. By adding up all of the exponents
B. By finding the largest exponent
C. By subtracting all of the exponents
D. By finding the largest coefficient
Answer = B
4. What is the degree of the polynomial x4-x3+5x
A. 7
B. 5
C. 4
D. 3
Answer = C
5. Stack is a an ordered collection of items forming a list that is
A. Top-in-first-out
B. One-end-first-out
C. Last-in-first-out
Answer = C

6. The nature of collection of data items in a stack is


A. Stable
B. Unstable
C. Dynamic
Answer = C
7. When a data item is pushed onto the stack the non-top end of the stock
A. Moves upward
B. Moves downward
C. Remains same as before
Answer = C

8. #include<stdio.h>
int main()
{
int i=0;
printf("\nI am in Main");
for(i=0;i<10;i++)
main();
return(0);
}
1.I am in MainI am in Main- Infinite Times
2.I am in MainI am in Main- 10 Times
3.I am in MainI am in Main- Until Internal Stack Overflows
4.None Of These
Answer = C
9. In which of the following cases, linked list implementation of sparse matrices consumes the same
memory space as the conventional way of storing the entire array?
A. 5x6 matrix with 9 non-zero entries
B. 5x6 matrix with 10 non-zero entries
C. Efficient in accesing an entry
D. Efficient if the sparse matrix is a band matrix
Answer = C
10. The minimum number of multiplications and additions required to evaluate the polynomial
P = 4x3+3x2-15x+45 is
(A) 6 & 3

(B) 4 & 2
(C) 3 & 3
(D) 8 & 3
Answer= C

11. What data structure would you mostly likely see in a nonrecursive implementation of a recursive
algorithm?
(A) Stack
(B) Linked list
(C) Queue
(D) Trees
Answer=A

12. A linear collection of data elements where the linear node is given by means of pointer is called
(A) linked list
(B) node list
(C) primitive list
(D) None of these
Answer=A
13. Representation of data structure in memory is known as:
(A) Recursive
(B) abstract data type
(C) storage structure
(D) file structure
Answer=B
14. If the address of A[1][1] and A[2][1] are 1000 and 1010 respectively and each element
occupies 2 bytes then the array has been stored in _________ order.
(A) row major
(B) column major
(C) matix major
(D) none of these
Answer=A

15. A two dimensional array TABLE [6] [8] is stored in row major order with base address
351. What is the address of TABLE [3] [4]?
A. 407
B. 358
C. 351
D. 405
Answer=A
16. The largest element of an array index is called its
A.lower bound.
B. range.
C.upper bound.
D. All of these.
Answer=C
17. Two dimensional arrays are also called
A.tables arrays
B. matrix arrays
C. both of above
D. none of above

Answer= C
18. Which of the following data structure cant store the non-homogeneous data elements?
A. Arrays
B. Records
C. Pointers
D. None
Answer=A
19. Which of the following data structure store the homogeneous data elements?

A.Arrays
B. Records
C. Pointers
D. None
Answer= b
20. When new data are to be inserted into a data structure, but there is no available space; this
situation is usually called
A.underflow
B. overflow
C. housefull
D. saturated

Answer= B
21. 19. A data structure where elements can be added or removed at either end but not in the
middle
A.Linked lists
B. Stacks
C. Queues
D. Deque

Answer=D
22. Which of the following is not a linear data structure
A. Arrays
B. Linked list
C. Both of these
D. None of these

Answer= D
23. A tree is an example of linear data structure.
A
True
B
False

Answer= B
24. Stacks cant be used to

A. Evaluate an arithmetic expression in postfix form

B. Implement recursion
C. Convert a given arithmetic expression in infix form to its equivalent postfix form
D. Allocate resources (like CPU) by the operating system
Answer= D

25. Arrays are dynamic data structures.


A
B

True
False

Answer= B
26. Linked list is a sequential collection of data items.
A
B

True
False

Answer= A

27. Iteration and recursion are the same thing.


A
B

True
False

Answer= B
28. Arrays are always consecutive in memory locations.
A
B

True
False

Answer= A

29. Which of the following correctly initializes an array arr to contain four elements each
with value 0?
I int [] arr = {0, 0, 0, 0};
II int [] arr = new int [4];
III int [] arr = new int [4];
for (int i = 0; i < arr. length; i ++)
arr [i] = 0;
(A)
(B)
(C)
(D)
(E)

I only
III only
I and III only
II and III only
I, II, and III

Answer= E

30. If an array is declared as


int a[4] = {3, 0, 1, 2};
Then values assigned to a[0] & a[4] will be ________
A. 3, 2
B. 0, 2
C. 3, 0
D. 0, 4
Answer= C

1. Suppose cursor points to a node in a linked list. What statement changes cursor so that it
points to the next node?
a. cursor++;
b. cursor = link;
c. cursor += link;
d. cursor = cursor->link;
Ans. : d, this statement will change the current position of the cursor.

2. Suppose cursor points to a node in a linked list. What Boolean expression will be true
when cursor points to the tail node of the list?
a. (cursor == NULL)
b. (cursor->link == NULL)
c. (cursor->data == NULL)
d. (cursor->data == 0.0)
e. None of the above.
Ans. : b, On the last node, the last nodes link will be pointing toward NULL, so cursor->link = >
Last_node->link
3. Suppose that p is a pointer variable that contains the NULL pointer. What happens if your
program tries to read or write *p?
a. A syntax error always occurs at compilation time.
b. A run-time error always occurs when *p is evaluated.
c. A run-time error always occurs when the program finishes.
d. The results are unpredictable.
Ans. : b, when p is evaluated, a runtime error occurs.
4. Suppose that f is a function with a prototype like this:
void
//
//
//

f(________ head_ptr);
Precondition: head_ptr is a head pointer for a linked list.
Postcondition: The function f has done some computation with
the linked list, but the list itself is unchanged.

What is the best data type for head_ptr in this function?


a. node
b. const node

c. node*
d. const node*
Ans. : c, since the linked list is not changing, it does not matters if we accept the node ptr as a
formal argument

5. Suppose that f is a function with a prototype like this:


void f(________ head_ptr);
// Precondition: head_ptr is a head pointer for a linked list.
// Postcondition: The function f has done some manipulation of
// the linked list, and the list might now have a new head node.

What is the best data type for head_ptr in this function?


a.
b.
c.
d.

node
node&
node*
node*&

Ans : d, since the linked list might change, we have to accept its address rather than the node
pointer as such.

8. What kind of list is best to answer questions such as "What is the item at position n?"
a. Lists implemented with an array.
b. Doubly-linked lists.
c. Singly-linked lists.
d. Doubly-linked or singly-linked lists are equally best
Ans. : a, the list implemented using an array, because array only gives instant access.
9.

Linear order linked list is provided through _________


a.
b.
c.
d.

variables
arrays
Pointer
strings

Ans: c

10.

In a Single Link List_________ node contains no links.


a. First

b. Last
c. last but one
d. middle
Ans : b
11.

A linked list is which type of data structure.


a.
b.
c.
d.

Linear
Non Linear
Hierarchical
None

Ans. : a
12.

In Single Linked List a node contain minimum how many fields(assuming one for data).
a.
b.
c.
d.

2
3
1
None

Ans. a
13. Implementation of priority queue
1) Tree
2) Linked list
3) Doubly linked list
a.
b.
c.
d.

1 and 2
2 and 3
1 and 3
All

Ans. b
14. Null pointer is used to tell
1) End of the linked list
2) Empty pointer field of a structure
3) The linked list is empty
a.
b.
c.
d.

1
2 and 3
1 and 3
All

Ans. a
15. Single link list performs which of the following methods
1) Insertion
2) Modification
3) Searching
a.
b.
c.
d.

1 and 2
2 and 3
1 and 3
All

Ans)D
16. The list with no node is called as
1) Empty list
2) Null list
3) Zero list
a.
b.
c.
d.

1 and 2
2 and 3
1 and 3
All

Ans)A
17. An application that make use of Multilinked Structures Is_________?
a.
b.
c.
d.

Sparse matrix
Linked list
Tree
Stack

Ans)A
18. Given a arbitrary pointer to an element in a singly linked list, the time complexity for its
deletion ___________.
a.
b.
c.
d.

O(n/2)
O(n*n)
O(n)
O(n*n/2)

Ans)C
19. In C language to implement the heterogeneous linked list__________ pointer is used.

a.
b.
c.
d.

Void
Null
Int
Structure

Ans)A
20. Searching a linked list requires linked list be created
a.
b.
c.
d.

In sorted order only


In any order
Without under flow condition
None

Ans)B
21. In linked list the logical order of elements
a.
b.
c.
d.

Is same as their physical arrangement


Is not necessarily equivalent to their physical arrangement
Is determined by their logical arrangement
None

Ans)B
22. According to Storage strategies Linked list is a
a.
b.
c.
d.

Nonlinear
Linear
Sequential
dynamic

Ans : a

23. Implementation of a list in a dynamic fashion is


a.
b.
c.
d.

To call upon the system to allocate and free storage may not be time consuming
A set of nodes not reserved in advance for use
The address computation is complex
None

Ans)B
24. If you are using C language to implement a heterogeneous linked list, the pointer type u
will prefer is ________

a.
b.
c.
d.

int*
Null
void*
float*

Ans)C
25. Which of the following statement is true
a. The next address field of the node can be empty
b. A list can exist with no nodes
c. In a singly linked list the starting address of the list is stored in the address field of the last node
d. All of the above

Ans : b, A list with no nodes is called empty list or null list

26. Type of storage is used to represent Lists


a.
b.
c.
d.

Random
Sequential
Dynamic
Logical

Ans : c
27. The node in a singly linked list can be deleted,
a. Without traversing the list
b.By traversing the list from the head
c. By traversing the list from the tail
d.
All of the above
Ans: b
28.
a.
b.
c.
d.

Which of the following operations is not efficiently supported


by a singly-linked list?
accessing the element in the current position
insertion after the current position
insertion before the current position
moving to the position immediately following the current position
Ans : c

a.
b.
c.
d.

29.What is an ordered list


where the address is ordered
where the smaller items precede the larger ones
both a and b
none

Ans : b

a.
b.
c.
d.

30.According to Access strategies Linked list is a


Nonlinear
Linear
Sequential
dynamic
Ans : b
31.How many nodes are accessed, on the average, in inserting a new element into an ordered list
with n nodes
a.(n+1)/2
b.n/2
c.1/(n+1)
d.None
Ans : b
32.A priority Queue implemented as an ordered linked list requires examining an
average of approximately _______ nodes for insertion
a. (n+1)/2
b.1/(n+1)
c.n/2
d.one
Ans : c
33.A priority Queue implemented as an ordered linked list requires examining an
average of approximately _______ nodes for deletion
a. (n+1)/2
b.1/(n+1)
c.n/2
d.one
Ans : d

34.The advantage of lists over an array for implementing a priority queue is


a.Extra space should be left empty in the end to achieve this
b.Lists will take less time compared to arrays
c.No shifting of elements or gaps are necessary in a list
d.Lists dont have direct access
Ans : c
35. An item can be inserted into ______,without moving any other items
a. List
b. an array if extra space is left empty
c. both a and b
d. none

Ans : b
36. An extra node at the front of the list, which doesnot represent an item in the list is
Called
a. header node
b. List node
c. List header
d. Both a and c
Ans : d

37) A __________is a self-referential data type because it contains a pointer or link to another
data of the same type.
a.
b.
c.
d.

Stack
Linked list
Queue
Priority queue

Ans) B
Exp) A Linked list is a self-referential data type because it contains a pointer or link to
another data of the same type.

38) Linked lists, at any point in the list in constant time, does not allow __________.
a.
b.
c.
d.

Random access.
Insertion
Deletion
Insertion at end

Ans)A
Exp) Linked lists permit insertion and removal of nodes at any point in the list in constant time,
but do not allow random access.For more refer to http://en.wikipedia.org/wiki/Linked_list
39) __________ permits insertion and removal of nodes at any point in the list in constant time,
but do not allow random access
a.
b.
c.
d.
Ans)B

Stack
Linked list
Queue
Priority queue

Exp) Linked lists permit insertion and removal of nodes at any point in the list in constant time,
but do not allow random access.For more refer to http://en.wikipedia.org/wiki/Linked_list
40) To traverse a___________, you begin at any node and follow the list in
either
direction until you return to the original node.
a.
b.
c.
d.

Doubly linked list


Two way linked list
Circular linked list
Singly linked list

Ans) C
You begin at any node and follow the list in either direction until you return to the original node,
to traverse a circular linked list. Doubly linked lists and two way linked lists are the same. For
more refer to http://en.wikipedia.org/wiki/Linked_list
41) The pointer, in case of a circular linked list, pointing to the whole list is usually called
the___________.
a.
b.
c.
d.

Double pointer
List pointer
Circular pointer
End pointer

Ans )D
The pointer, in case of a circular linked list, pointing to the whole list is usually called the end
pointer. For more refer to http://en.wikipedia.org/wiki/Linked_list
42) In a ______________, each node has one link, similarly to an ordinary singly-linked list,
except that the next link of the last node points back to the first node.
a.
b.
c.
d.

Doubly linked list


Singly-circularly-linked list
Doubly circular linked list
Two way linked list

Ans) B
Each node has one link, similarly to an ordinary singly-linked list, except that the next link of the
last node points back to the first node, in a singly circularly linked list. For more refer to
http://en.wikipedia.org/wiki/Linked_list
43) In a______________, each node has two links, similarly to doubly-linked list, except that
previous link of the first node points to the last node and the next link of the last node points to
the first node.
a. Doubly-circularly-linked list

b. Doubly linked list


c. Singly-circularly-linked list
d. Two way linked list
Ans) A
Each node has two links, similarly to doubly-linked list, except that previous link of the first node
points to the last node and the next link of the last node points to the first node
in a doubly-circularly-linked list. For more refer to http://en.wikipedia.org/wiki/Linked_list
44) In a __________, insertions and removals can be done at any point with access to any nearby
node.
a.
b.
c.
d.

Doubly-circularly-linked list
Doubly linked list
Singly-circularly-linked list
Two way linked list

Ans) B
For more refer to http://en.wikipedia.org/wiki/Linked_list
45) _______________are most useful for describing naturally circular structures, and have the
advantage of regular structure and being able to traverse the list starting at any point.
a.
b.
c.
d.

Doubly linked list


Two way linked list
Singly linked list
Circular linked list

Ans) D
46)Which of the following operations is not efficiently supported by a singly-linked list?
a. Accessing the element in the current position
b. Insertion after the current position
c. Insertion before the current position
d. Moving to the position immediately following the current position
e. All of the above are efficiently supported
Ans.: c, To insert before the current position another pointer has to be made to point to the
position before the current position.
47) The header node of a linked list
(a) Simplifies deletion
(b) Simplifies insertion
(c) Points to null
(d) Both (a), (b)
Ans) D

48) If a header node is used, which of the following indicates a list L with one item?
(a) L.Header.Next = null
(b) L.Header.Next /= null
(c) L.Header.Next /= null and then L.Header.Next.Next /= null
(d) L.Header.Next /= null and then L.Header.Next.Next = null
(e) None of the above
Ans)D
49) Insertion of a node into a doubly linked list requires how many changes to various Next and
Prev pointers?
(a) No changes
(b) 1 Next, 1 Prev
(c) 2 Next, 2 Prev
(d) 3 Next, 3 Prev
(e) None of the above
Ans)C
50)What operation is supported in constant time by the doubly linked list, but not by the singly
linked list?
(a) Advance
(b) Move back
(c) First
(d) Retrieve
(e) All of the above are always constant time
Ans)B, Doubly linked list has two pointers pointing to forward and backward Simultaneously
51) Consider the following statements.
(i) A linked list consists of a series of structures, which are necessarily adjacent in memory.
(ii) In a singly linked list, each structure contains an element and a reference to a record
containing its successor.
(iii) In an array-based list, even if the array is dynamically allocated, an estimate of the
maximum size of the list is required.
(iv) In an array based list, inserting at position 0 requires first pushing the entire array down one
spot to make room.
(v) In an array-based list, deleting elements from the middle can be performed without shifting
the remaining elements.
Which of the above statements is/are valid for a list?
a.
b.
c.
d.
e.

(ii) & (iv) only


(ii), (iii) & (iv) only
(iii), (iv) & (v) only
(ii) & (iv) only
(ii), (iii), (iv) & (v) only

Ans) B
52)Consider the following operations.
(i) Append an element to the end of a list.
(ii) Concatenate two lists.
(iii) Free all the nodes in a list.
(iv)Reverse a list, so that the last element becomes the first and so-on.
(v) Delete the last element from a list.
(vi)Delete the nth element from a list with at least n elements.
(vii) Combine two ordered lists into a single ordered list.
Which of the above are valid operations in singly linked lists?
a.
b.
c.
d.
e.

(i), (ii), (iii), (v), (vi) & (vii)


(iii), (iv), (v), (vi) & (vii)
(i), (ii), (iii), (iv), (vi) & (vii)
(i), (ii), (iii), (iv) & (vii)
(i), (ii), (iii), (iv), (v), (vi) & (vii)

Ans) E

53) Consider the following algorithm.


(i) An empty node is created.
(ii) The nodes information field is initialized to an integer e1.
(iii) The node is being included at the end of the list, and the next field is set to null.
(iv) The node is now included in the list by making the next field of the last node of the list a
reference to the newly created node.
(v) The new node follows all the nodes of the list, but this fact has to be reflected in the value of
the tail, which now becomes the reference to the new node.
Which of the following does the above algorithm describe?
a.
b.
c.
d.
e.

The process of adding a new node to the last node of the tree
The process of adding a new node to any location of the list
The process of adding a new node to the end of the list
The process of deleting a node from the end of the list
The process of deleting a node from the beginning of the list

Ans) C

54. In Linked list implementation, a node carries information regarding ______?

a. Link
b. Data and Link
c. Data
d. None of the above

Ans : b
55. A Linked list in which the last node of Linked list points to the first is called a __________
a. Singly Linked List
b. Circular Linked List
c. None of these
d. Doubly Linked List
Ans : b
56. A doubly linked list performs traversal in ______________
a. Circular direction
b. Any direction
c. Either direction
d. Forward direction
Ans. c
57. Linked list data structure usage offers considerable saving in
a. Computational time
b. Space utilization & computational time
c. Space utilization
d. None of the above
Ans. b
58. Consider linked list is used to implement the Stack then which of the following node is
considered as Top of the Stack?
a. Any node
b. First Node
c. Middle Node
d. Last Node
Ans : b
59. The link field in the last node of the linked list contains _____
a. Zero value
b. Link to the first node
c. Pointer to the next element location
d. data
Ans. a
60. When new element is added in the middle of SLL then _________
a. Only elements that appear before the new element need to be moved

b. Only elements that appear after the new element and before need to be moved.
c. No need to move element
d. Only elements that appear after the new element need to be moved.
Ans. c
61. Which of the following operation is performed more efficiently in DLL?
a. Deleting a node at given position
b. Searching a node at given position
c. None of these
d. Inserting a node at given position
Ans. a
62. If in a linked list address of first node is 1020 then what will be the address of node at 5th
position
a. 1028
b. 1036
c. None of these
d. 1040
Ans. c ( linked list is not a linear list. Each node is allocated dynamically thus each node have
random address.
63. In Circular linked list insertion of a node involves the modification of ______ links.
a. 4
b. 1
c. 2
d. 3
Ans. c

64. Consider the following linked list representation struct node


{
int data;
struct node *next;
}start = NULL;
struct node *new_node;
Which of the following statement is used to create a node?
a. new_node = (struct node *) malloc(sizeof(struct node));
b. new_node = (struct *) malloc(sizeof(struct node));
c. new_node = (struct node ) malloc(sizeof(struct node));
d. new_node = (struct node *) malloc(sizeof(struct node *));

Ans. a
65. struct node
{
int data;
struct node *next;
}*start;
Consider the above representation and predict what will be printed on the screen by following
statement : start->next->data ?
a. Access the "data" field of 3rd node
b. Access the "data" field of 2nd node
c. Access the "data" field of 1st node
d. None of these
Ans : b

66. struct node * current = start->next


what "current" will contain if it is variable of type struct node?
a. Data Field of 2nd node
b. Address of 2nd node
c. Address field of 2nd node
d. none of these
Ans. b
67. Consider the following linked list
and following linked list representation
struct node {
int data;
struct node *next;
}*start;
what will tbe value of following statement?
start->next->next->next->data
a. 12
b. 25
c. 15
d . 30
Ans. b

68.

If start is pointing to first node of the linked list then consider the following statementstart = start->next;
current = start->next
What will be the value of address field of current?
a. 2184
b. 3225
c. 5572
d. 5571
Ans: d
69. Which of the following is correct syntax to print linked list
a. struct node *temp;
do {
printf("%d",temp->data);
temp = temp->next;
}while(temp != NULL);
b. struct node *temp = start;
do {
printf("%d",temp->data);
temp = temp->next;
}while(temp != NULL);
c. struct node *temp = start;
do {
temp = temp->next;
printf("%d",temp->data);
}while(temp != NULL);
d. struct node *temp;
do {
temp = temp->next;
printf("%d",temp->data);
}while(temp != NULL);
Ans. b

70. Consider the SLL having n elements. What will be the time taken to add an node at the end
of linked list if Pointer is initially pointing to first node of the list.
a. O(n-1)
b. O(1)
c. O(n2)
d. O(n)
Ans : a
71. Pointer is pointing to the first element of the node then time required to insert element to
second position is ___________?
a. O(n2)
b. O(1)
c. O(n-1)
d. O(n)
Ans. b
72. Consider a linked list of n elements. what is the time taken to insert an element after element
pointed by same pointer?
a. O(1)
b. O(log n)
c. O(n)
d. O(n-1)
Ans. a
73. The concatenation of two lists is to be performed in O(1) time. Which of the following
implementations of a list could be used?
a. SLL
b. DLL
c. Array implementation of List
d. Circular DLL
Ans. d
74. Time require to find any element of the linked list is ________?
a. None of these
b. O(n2)
c. O(1)
d. O(n)
Ans. d
75. Generally collection of nodes is called as ________ ?
a. Heap

b. Linked List
c. Pointer
d. Stack
Ans. b
76. A Linear collection of data element given by mean of pointer is called ________ ?
a. Graph
b. Queue
c. Stack
d. Linked list
Ans. d
77. Which of the following is not a type of Linked List?
a. DLL
b. Hybrid Linked list
c. SLL
d. Circular linked list
Ans. b
78. Linked list is generally considered as an example of _____________ type of memory
allocation.
a. Compile Time
b. None of these
c. Static
d. dynamic
Ans. d
79. Each node contain minimum two fields one field called data field to store data. Another field
is of type _________
a. Pointer to character
b. Pointer to Class
c. Pointer to Node
d. Pointer to Integer
Ans. c

80. A linear collection of data elements where the linear node is given by means of pointer is
called
a. linked list
b. node list

c. primitive list
d. None of these
Ans. a
81. Which of the following operations is performed more efficiently by doubly linked list
than by singly linked list?
a. Deleting a node whose location in given
b. Searching of an unsorted list for a given item
c. Inverting a node after the node with given location
d. Traversing a list to process each node
Ans . a
82. Consider a linked list of n elements. What is the time taken to insert an element after an
element pointed by some pointer?
a. O (1)
b. O (log2 n)
c. O (n)
d. O (n log2 n)
Ans: a
83. In a circular linked list
a. components are all linked together in some sequential manner.
b. there is no beginning and no end.
c. components are arranged hierarchically.
d. forward and backward traversal within the list is permitted.
Ans: b

84. In a linked list with n nodes, the time taken to insert an element after an element pointed by
some pointer is
a. O (1)
b. O (log n)
c. O(n)
d. O (n 1og n)
Ans:a

You might also like