You are on page 1of 2

[21] The time complexity for fibonacci series is

Choice a
O(2n) - ans

Choice b
O(n*n)

Choice c
O ( n ) ans
Choice d
O(1)


[22] Which of the following things of an algorithm are kept
same for both the algorithm while comparing two
algorithms ?

Choice a
Speed of the computer

Choice b
Language used for the algorithm

Choice c
Both speed of the computer and the language used for the algorithm

Choice d
Number of iterations made in the algorithm

[29] Consider the following code snippet:
void main( )
{
struct sample
{
char *ch ;
int i ;
struct sample *s ;
} ;
static struct sample s1[ ] = {
{ "Nagpur", 1, s1 + 1 },
{ "Maharashtra", 2, s1 + 2 },
{ "India", 3, s1 }
} ;
struct sample *ptr = s1 ;
printf ( "%s", ++( ptr -> ch ) ) ;
}
What will be the output of the above program?
Choice a
NagpurMaharashtraIndia
Choice b
Nagpur
Choice c
agpur- ans
Choice d
No output
[30] Consider the following code snippet:
void main( )
{
static char str[] = { 0, 0, 0, 0, 0 } ;
char *ptr ;
int i ;
ptr = str ;
for ( i = 0 ; i <= 4 ; i++ )
{
if ( *ptr )
printf ( "%c ", *ptr ) ;
ptr++ ;
}
}
Which of the following statement is correct about the above program?

Choice a
The code reports an error.
Choice b
The code causes an exception.
Choice c
The code runs successfully but will not give an output. - ans
Choice d
The code gives output 0 0 0 0 0

You might also like