Professional Documents
Culture Documents
A) !
B) #
C) ~
2.
D) ;
3.
B)
C)
D)
both b and c
B)
C)
D)
# define directive B)
const keyword
C)
symbolic notation D)
None of these
blank,
B) new line, \n
C)
null, \0
D) string, %s
num[4];
B) int a(4);
C)
num(0-4);
D)
num[3];
B)
The expression num [0] designates the first element in the array.
C)
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)
B) 2
C) 0
D)
any
B) #
C) ~
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
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
19.
A)
C)
D) None of above.
0.5
B) 27,822
C) 12345678
D) 0XBCFDAL
if
B) switch
C) break
B)
C)
D)
All of above
D) include
A)
1.8
B) 1
C) 2
D) none of these
&
B) &&
C) ||
D. !
24. How do printf() ` s format specifiers %e and %f differ in their treatment of floating-point
numbers?
A)
%e displays a double in engineering notation if the number is very small or very large.
%e displays an argument of type double with trailing zeros; %f never displays trailing zeros.
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)
before main
B) after main
C)
anywhwre
D) none of above
1 Byte
B) 4 Bytes
C) 8 Bytes
D) 16 Bytes
C)
Infinite Loop
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
else
B) while
if(if(condition)) do this;
B)
else(if(condition) do this;
C)
D)
if&&if(condition)
34. Which symbol is used to separate multiple initialization in the for loop?
A)
&&
B) ,
C)
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
'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
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
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
B)
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.
A)
go_cart
B) go4it
C) 4season
D) run4
45.6
B) -31.8
C)
pi
D) 40
x is equal to y.
B) x is not equal to y.
C)
A3
B) B.A_4
C) if
D) IF
49. Which of the following statements about the ` switch ` statement is false?
A)
B)
C)
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
Compiler commands
B)
Library functions
C)
D)
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);
B)
C)
D)
56. A do...while loop is useful when we want that statement within the loop must be
executed_________.
A)
only once
C)
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)
B)
C)
D)
59. The statement char ch= Z would store what in variable named ` ch ` ___________
A)
the character Z
B)
ASCII value of Z
C)
D)
60. The maximum value that an integer constant can have is_________
A)
-32767
B) 32767
C)
1.70E+38
D) -1.70E+38
thank you
C)
23.56E-03
D)
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)
B)
C)
D)
The code prints Recursive calls are challenging. Recursive calls are challenging (infinitely?.)
blank spaces
B) hyphen
C)
decimal point
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);
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)
C)
**, /, *, +, -
D) . / or *, - or +
switch
B) case
C) for
D) void
1Byte
B) 4 Bytes
C) 8 Bytes
D) 16 Bytes
1 Byte
B) 4 Bytes
C)
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
77.
A)
address of a variable
B) location of a variable
C)
\a
B) \b
C) \m
D) \n
78. Which of the following operators has the 2nd highest priority?
A)
B) * / %
C) + -
D) ||
Single quotes
B) Double quotes
C)
Both a and b
D) None of these
Single quotes
B) Double quotes
C)
Both a and b
D)
None of these
')'
B) '$'
C) 'a'
D) 'abc'
B) 16
C) 32
D) 64
address of a variable
B) value of a variable
C)
84. To return control back to the calling program which keyword is used.?
A)
void
B)
return
C)
back
D)
None
#<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
if-then-else
B) do-while
C)
repeat-until
D) for loop
B) Different constants.
C)
#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)
B) .
C) ->
D) &
A)
Call by value
B) Call by reference
C)
Call by name
D) None
C)
Data types
D) None
B)
C)
D)
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;
Entire program
B) with in function
C)
in a class
D) None
C)
D) Both B and C
B)
C)
Both A and B
D)
B)
C)
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)
C)
D)
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)
B)
Nothing
C)
D)
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)
C)
D)
yes
B) no
C)
error
D) Both B and C
B)
C)
D)
All of above
B) ==
C) >=
D) +
++
B) %
C) +
D) ||
for
B) while
C) do
memory location B)
C)
memory screen
memory store
D) None of these
D) switch
A)
reserved words
B)
compiler words
C)
++
B) %
C) +
D) ||
an alphabet
B)
a number
C)
D)
Both B) and C)
B)
C)
D)
Single quotes
B) Double quotes
C)
A or B
D) None of these
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
B) 4
C) 1
an array variable
B)
a keyword
C)
D)
B)
C)
D)
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
One
B) Two
125. If a static array of integers is not initialized ,the elements will hold default value..
A)
B) 1
C)
B)
C)
D)
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
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)
B)
DO ..& WHILE
C)
D)
casting
B) conversion
C)
disjunction
D) separation
condition
B) statement
C) count
D) value
A)
Variable name
C)
D) All of above
C)
Repetition of code D)
B) Conditional statements
Both B and C
C)
Both A and B
D) None of above
B)
C)
D)
Character input
C)
String input
B) character output
D) string output
Character input
C)
String input
B) character output
D) string output
do { ------; ------;.)
B)
C)
D)
None of these
B)
C)
D)
none of these
array
B) string
C) union
D) structure
C) getch
D)
C) data type
D) None of these
printf
B) scanf
clrscr
if
B) string
%d
B) %c
C) %f
D) %s
C)
combined if statement
D) Nested if statement
C)
both A&B
D) none of above
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
int 1ram;
B) float _calculate;
C)
int if;
D) int run#fast;
B)
C)
D)
C)
format specifier
D) both A&B
BASICSALARY
B) _basic
C)
basic-hra
D) hELLO
Thank You
B)Enter values of P, N, R
C)
23.56E-03
D)
An alphabet
B)
A number
C)
D)
A)
mes = 123.56 ;
B)
C)
this = 'T' * 20 ;
D)
3+a=b;
B)
C)
D)
array
B) structure
C) pointer
D) both A&C
10,20
B) No Output
C)
syntax error
C)
28
B) 32
C) 35
D) 40
B)
C)
D)
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
fwrite
B) fseek
C) fread
D) putc
A)
Pointer
B) Addition
C) Division
D) Assignment
Same
B) Different
C)
address of variable B)
int
C)
char
D) value of variable
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
171. A ` do-while ` loop is useful when the statements within the loop must be executed:
A)
Only once
B) At least once
C)
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,
B) library function
C)
both of above
D) none of above
entire program
B) with in function
C)
with in class
175. Array can be initialized automatically, provided they are declared with following specifiers
A)
automatic
B) external
C) static
D) both B & C
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)
B)
C)
D)
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)
B)
C)
both A and B
D)
keyword
C)
'while' loop executes one or more times and 'do-while' executes zero or more times
B)
C)
D)
'while' loop executes zero or more times and 'do-while' executes one or more times
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
B)
C)
D)
none of these.
'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
Number
B) Keyword
D) float
C)
Alphabet
*M
B) M&
C) &M
D) M*
do-while
B) if-else
C) goto
D) for
function
B) iteration
C)
body of a loop
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)
Primary
B) User defined
C)
Derived
D) Set
B) nameofarray [size];
C)
datatype nameofarray ;
D) all of above
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)
197. The _______ format specification is used to write a long integer variable.
A)
%d
B) %dd
C) %lf
D) %ld
B)
C)
D)
199. Which of the following function is used to read the input from a string?
A)
scanf
B) fscanf
C) fprintf
D) sscanf
to terminate a statement
B) to break a loop
C)
to give a comment
D) none of these
B)
C)
D)
none of these
202. When applied to a variable, what does the unary "&" operator yield?
A)
B)
C)
D)
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;
integer
B) char
C) float
D) long int
char
B) float
C) int
D) logical
operand
B) Mathematical operator
C)
logical operator
Both can occur multiple times, but a declaration must occur first.
B)
C)
D)
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.
b] call by reference
d] call by procedure
3:
a] int p1,p2;
b] int *p1,p2;
c] int p1,*p2
d] int *p1,*p2
b) garbage value
d) code crash
b) garbage value
c)
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
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.
..
10:-- A pointer variable is designed to store ________.
1.
2.
3.
4.
11-- We should use the delete operator for objects that were _______
a)
never used
c)
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
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
sizeof(arr[0]));
}
(a) 10 4 4
(b) 10 4 2
(c) 10 2 2
(d) 10 2 4
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
42
Prior to using a pointer variable it should be
A.
Declared
B.
Initialized
C.
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
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
B.
Different
C.
Not related
D.
Error
First(*second); B.
First(&second);
C.
First(second);
D.
None fo these
int p*;
B.
int *p;
C.
int +p;
D.
int $p;
B.
C.
D.
None fo these
76
77
* is a ________________
a] Indirect operator
c] Assignment operator
d] Address of operator
(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
#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?
80
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
A.stdio.h
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.
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 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.
A. Data Structure
B. Abstract Data Type
C. Primitive Data Type
D. Algorithm
Answer: Option B
8.
A. Recursive
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.
a.
b.
c.
d.
All of Above
Ans:Option A
14.
A.Counting Microseconds.
B.Counting no of statements.
C.Counting no of key opeartions.
D.Counting key algorithm
Ans:Option C
16
17
18
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
a.Strings
b.Lists
c:Queues
d:All of above
Ans:D
23
a.Strings
bLists
c. Stacks
d.None of above
Ans:D
24
A. Best case
B. Worst case
C. Average case
D. NULL case
Answer :D
25
A. O(log2 n)
B. O(n)
C. O(1)
D. 0 (n2)
Answer :D
26
27
A:Atomic data
B:primitive data
C:Composite data
D:None of the above
Answer:A
30
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
A. Constant
B. Linear
C. Logarithmic
D. Quadratic
Ans: (b)
38
A. Byte
B. Integer
C. Float
Ans:D
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
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
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
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
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
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
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
True
False
Answer= B
26. Linked list is a sequential collection of data items.
A
B
True
False
Answer= A
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
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.
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
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.
variables
arrays
Pointer
strings
Ans: c
10.
b. Last
c. last but one
d. middle
Ans : b
11.
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.
Ans)B
21. In linked list the logical order of elements
a.
b.
c.
d.
Ans)B
22. According to Storage strategies Linked list is a
a.
b.
c.
d.
Nonlinear
Linear
Sequential
dynamic
Ans : a
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
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.
a.
b.
c.
d.
Ans : b
a.
b.
c.
d.
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.
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.
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
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.
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.
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.
Ans) 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
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
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
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