You are on page 1of 46

o

QuestionText

AnswerText1

AnswerText2

unalloc()

dropmem()

int z,x=5,y=-10,a=4,b=2;z = x++ - --y * b / a; What number


will z in the sample code above contain?
1

With every use of a memory allocation function, what func


void *ptr;myStruct myArray[10];ptr = myArray;Which of the
following is the correct way to increment the variable
"ptr"?

ptr = ptr + sizeof(myStr ++(int*)ptr;


char* myFunc (char *ptr){ptr += 3;
return (ptr);}int main(){char *x, *y;x = "HELLO";y = myFunc
(x);
printf ("y = %s \n", y);
return 0;}What will print when the sample code above is
executed?
y = HELLO
y = ELLO

"My salary was increased by 15%!" . Select the statement printf("\"My salary was printf("My salary

What is a difference between a declaration and a definition Both can occur multipleThere is no differ
3

int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1

int a=10,b;b=a++ + ++a;printf("%d,%d,%d,%d",b,a++,a,++a)12,10,11,13


-3

int x[] = { 1, 4, 8, 5, 1, 4 };int *ptr, y; ptr = x + 4;y = ptr

22,10,11,13
0

10

void myFunc (int x){if (x > 0) myFunc(--x);printf("%d, ", x

1, 2, 3, 4, 5, 5,

4, 3, 2, 1, 0, 0,

11

11 ^ 5 What does the operation shown above produce?

12

#define MAX_NUM 15 Referring to the sample above, w

13

Which one of the following functions is the correct choice f memcpy()

MAX_NUM is an integerMAX_NUM is a link

memset()
22

26

14

int x = 2 * 3 + 4 * 5;What value will x contain in the sampl

15

int var1;If a variable has been declared with file scope, as Yes; it can be referenceNo; it would have t

16

time_t t;Which one of the following statements will properly t = clock();

time( &t );

17

Which one of the following provides conceptual support for The system stack

The data segment

18

C is which kind of language?

Procedural

Machine

19

20

int i,j;int ctr = 0; int myArray[2][3];for (i=0; i<3; i++)for (j

int x = 0;for (x=1; x<4; x++);printf("x=%d\n", x);What will


int x = 3; if( x == 2 );x = 0; if( x == 3 )x++; else x +=
2;What value will x contain when the sample code above
is executed?

21

22

char *ptr;char myString[] = "abcdefg"; ptr = myString;ptr + fg

efg
-4: 4 -3:3

23

double x = -3.5, y = 3.5;printf( "%.0f : %.0f", ceil( x ), ceil( y )3:4 -4:3

24

Which one of the following will declare a pointer to an int int *x;*x = 0x200;
int x = 5;int y = 2;char op = '*';switch (op){ default : x += 1;
case '+' : x += y; /*It will go to all the cases*/case '-' : x -=
y;
}After the sample code above has been executed, what
value will the variable x contain?

int *x = &0x200;
4

25
x = 3, counter = 0; while ((x-1)){++counter;x--;} Referring
to the sample code above, what value will the variable
counter have when completed?
26
char ** array [12][12][12]; Consider array, defined above.
Which one of the following definitions and initializations of
p is valid?
27

char ** (* p) [12][12] = char ***** p = array

void (*signal(int sig, void (*handler) (int))) (int);Which one


of the following definitions of sighandler_t allows the
above declaration to be rewritten as follows: sighandler_t
signal (int sig, sighandler_t handler);
28

typedef void (*sighandletypedef sighandler_t

29

struct customer *ptr = malloc( sizeof( struct customer ) );

ptr = realloc( ptr, 10 * realloc( ptr, 9 * siz

30

Which one of the following is a true statement about pointe A pointer of type void Standard C mandate
6

31

short testarray[4][3] = { {1}, {2, 3}, {4, 5, 6} }; printf( "%d

32

char buf [] = "Hello world!";char * buf = "Hello world!"; In

The first definition cer The first definitio

33

In a C expression, how is a logical AND represented?

@@

34

How do printf()'s format specifiers %e and %f differ in thei %e always displays an %e expects a corre

35

Which one of the following Standard C functions can be useclearerr()

fseek()

36

Which one of the following will read a character from the key
c = getc();

getc( &c );

||

#include <stdio.h> int i;


void increment( int i ){ i++; } int main() { for( i = 0; i < 10;
increment( i ) )
{ } printf("i=%d\n", i); return 0;} What will happen when the
program above is compiled and executed?
37

It will not compile.

It will print out: i=9

38

int i = 4; switch (i){ default:; case 3:i += 5;if ( i == 8) { i++

39

Which one of the following C operators is right associative =

40

What does the "auto" specifier do?

41

How do you include a system header file called sysheader.h#include <sysheader.h #incl "sysheader.h

42

Which one of the following printf() format specifiers indicates


%-30.4e

%4.30e

43

int x = 0;for ( ; ; ){ if (x++ == 4)


break;continue;}printf("x=%d\n", x); What will be printed
when the sample code above is executed?

x=1

44

According to the Standard C specification, what are the resp1, 2, 2

It automatically initializ It indicates that a

x=0

1, 2, 4

int y[4] = {6, 7, 8, 9}; int *ptr = y + 2;printf("%d\n", ptr[ 1 ] );


/*ptr+1 == ptr[1]*/ What is printed when the sample code
above is executed?
45

46

penny = one, nickel = five , dime = ten, quarter = twenty-fi enum coin {(penny,1), (n
enum coin ({penny,1

char txt [20] = "Hello world!\0"; How many bytes are


allocated by the definition above?
47

11 bytes

12 bytes

48

int i = 4; int x = 6; double z; z = x / i; printf("z=%.2f\n",

z=0.00

z=1.00

49

Which one of the following variable names is NOT valid?

go_cart

go4it

int a [8] = { 0, 1, 2, 3 }; The definition of a above explicitly


initializes its first four elements. Which one of the
following describes how the compiler treats the remaining
four elements?
50

Standard C defines thi The remaining eleme

51

Which one of the following statements allocates enough space


int *ptr = (int *) malloc( int *ptr = (int *) cal

52

What are two predefined FILE pointers in C?

stdout and stderr

console and error

if (x == 0) return 0;

return 1;

long factorial (long x) { ???? return x * factorial(x - 1); }


With what do you replace the ???? to make the function
shown above return the correct answer?
53

54

How is a variable accessed from another file?

The global variable is r The global variable

55

When applied to a variable, what does the unary "&" operatThe variable's value

The variable's bina

56

Which one of the following is NOT a valid identifier?


__ident
FILE *f = fopen( fileName, "r" ); FILE *f = fopen( fileName,
"r" );
if( ???? ){ puts( "End of file was reached" ); } Which one
of the following can replace the ???? in the code above to
determine if the end of a file has been reached?
f == EOF

auto

57

feof( f )

Global variables that are declared static are


____________.Which one of the following correctly
completes the sentence above?
58

Deprecated by StandarInternal to the curr

59

Which one of the following is NOT a valid C identifier?

___S

1___

60

According to Standard C, what is the type of an unsuffixed flong double

Unspecified

61

Which one of the following is valid for opening a read-only fileOpen (filenm, "r");

fileOpen (filenm, "r

62

f = fopen( filename, "r" );Referring to the code above, what iFILE f;

FILE *f;

63

If there is a need to see output as soon as possible, what fuflush()

output()

64

short int x; /* assume x is 16 bits in size */ What is the m


char * dwarves [] = { "Sleepy", "Dopey" "Doc",
"Happy","Grumpy" "Sneezy", "Bashful",}; How many
elements does the array dwarves (declared above)
contain? Assume the C compiler employed strictly
complies with the requirements of Standard C.

65

127 128

char *buffer = "0123456789"; char *ptr = buffer; ptr += 5;


printf( "%s ", ptr ); printf( "%s ", buffer );What will be
printed when the sample code above is executed?
66

5123456789
5123456789
0123456789 56789

67

What number is equivalent to -4e3?

68

How does variable definition differ from variable declaratio Definition allocates sto Declaration allocat
int x[] = {1, 2, 3, 4, 5}; int u; int *ptr = x; ???? for( u = 0; u
< 5; u++ ) { printf("%d-", x[u]); } Which one of the following
statements could replace the ???? in the code above to
cause the string 1-2-3-10-5- to be printed when the code
is executed?
*ptr + 3 = 10;
*ptr[ 3 ] = 10;

69

#include <stdio.h> void func() { int x = 0;static int y = 0;


x++; y++; printf( "%d -- %d", x, y ); } int main()
{ func(); func();return 0;}What will the code above print
when it is executed?

-4000

1 -- 1 1 -- 1

-400

1 -- 1 2 -- 1

70
struct node *nPtr, *sPtr; /* pointers for a linked list. */ for
(nPtr=sPtr; nPtr; nPtr=nPtr->next)
{ free(nPtr);} The sample code above releases memory
from a linked list. Which of the choices below accurately
describes how it will work?
71

72

It will work correctly si It may fail since e

What function will read a specified number of elements fromgetline()

fileread()

73

What is a proper method of opening a file for writing as binaFILE *f = fwrite( "test.biFILE *f = fopenb( "t

74

Which one of the following functions returns the string repr localtime

gmtime

char ptr1[] = "Hello World"; char *ptr2 = malloc( 5 );


ptr2 = ptr1;What is wrong with the above code (assuming
the call to malloc does not fail)?
75

76

77

78

There will be a memoryThere will be a me

Which one of the following is a true statement about pointe They are always 32-bit For efficiency, poi
void
freeList( struct
nodeported
*n ) { while(
n ){ ???? } }No
Which
/*sum_array()
has been
from FORTRAN.
*
one of the
following
replace
thedouble
???? for the function
logical
changes
havecan
been
made*/
above to release the
memory
sum_array(double
d[],int
n) allocated to a linked list?
{ register int i;double total=0;
assert(d!=NULL);
for(i=l;i<=n;i++)
total+=d[i];
return total; } The function sum_array(), defined above,
contains an error. Which one of the following accurately
describes it?

struct node m =
n;n = n->next;
free( m );
n = n->next;free( n );

The range of the loop The loop processes

int x = 011 | 0x10;What value will x contain in the sample


code above?
79

13

80

#include<stdio.h>int x=printf("Hello"); void main()


{printf("%d",x);}

Hello

Hello5

81

#include<stdio.h>void main(){ const int i=100;printf("\n


%d",++i);}

100

101

82

#include<stdio.h>int main(){int const i=100;int


*p=&i;*p=999;printf("%d",i);return 0;}

83

Irresespective of datatype pointer size is 4 bytes, Why?

84

#include<stdio.h>#include<stdlib.h> int main(){char


*p,*q;p=q=(char*)malloc(20);free(p);} Q is called ?

85

#include<stdio.h>int main(){int i=0;while(i<=5){i++;if(i==3)


continue;printf("\n%d",i);}return 0;}
0,1,2,4

1,2,4,5

86

#include<stdio.h>int main(){float f=10.25;printf("%f",+


+f);return 0}

11.26

87

#include<stdio.h>int main(){int i=printf("\nHello");printf("\n


%d",i);return 0;}
Hello, 5

Hello , 6

88

#include<stdio.h>int main(){int i=1;while(i=5){printf("\n


%d",i);i++;}return 0;}

12345

Loop will not be


terminated.
Keeps printing 5.

89

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

Error

3 6 9 12

90

#include<stdio.h>int main(){int
i;printf("%d",scanf("%d",&i));return 0;}

Error

Unpredicted

100

Garbage Value

Stray Pointer

Invalid Pointer

10.36

91

What is EOF

EOF is a macro
whose body is 0 and
defined in stdio.h

92

#include<stdio.h>int main(){int a=10;{int


a=20;printf("%d",a);}return 0;}

Redeclaration Error

10

93

#include<stdio.h>int main(){int i=300;printf("%d",


(char)i);return 0;}

Error

44

94

#include<stdio.h>int main(){int i;i= 10 &&


0;printf("%d",i);return 0;}

Unpredicted

Error

95

#include<stdio.h>int main(){int x=4;printf("%d",x <<


2);return 0;}

16

96

#include<stdio.h>int main(){int x=4;printf("%d",x >>


2);return 0;}

Unpredicted

Error

97

x - = y + 1;means

x=x-y+1

x=-x -y -1

98

#include<stdio.h>int main(){int x=10;printf("%d %d %d",x+


+,x,++x);return 0;}
10 , 11 , 12

11, 11, 11

99

#include<stdio.h>int main(){int a=5,b=2;printf("%d",a++


+b);return 0;}

RunTimeError

Syntax Error

EOF is a non
constant whose
value is 0

100 What is the Maximum value unsigned char supports

255

256

101 How many bits are needed to store 256

16

The Minimum number of temporary variables needed to


102 swap the contents of two variables is

If Integer needs tow bytes of storage , then maximum


103 value of an unsigned integer is

2^16-1

2^15-1

Consider the function int find(int x,int y){return((x<y) ? 0 :


(x-y));} Let a,b be two non-negative integers. The call
104 find(a,find(a,b)) can be used to find the

maximum of a , b

positive
difference of a,b

105 Which of the following comments are true

C provides no inputoutput features

C provides no file
access features

The value of an automatic variable that is declared but not


106 initialized will be
0

-1

107 Which of the Operators take only integer operands

108 Pick the operators that associate from the right

" ?: "

" += "

The following code fragment int x,y=2,z,a; x=(Y *= 2) +


109 (z=a=y);printf("%d",x);

prints 8

prints 6

#include<stdio.h>int main(){unsigned char


110 ch=1000;printf("%d",ch);return 0;}

232

Unpredicted

#include<stdio.h>int main(){char
111 ch=1000;printf("%d",ch);return 0;}

negative value

Unpredicted

112 Negative Integers are stored using 1's compliment

113 In a for loop if the condition is missing then ,

It is assumed to be
present and taken to
be false

It is assumed to
be present and
taken to be true

114 zero is considered as false condition

Which of the following features of C is meant to provide


115 reliable access to special memory locations

static_const

pragma

#include<stdio.h>int main(){char str[]="welcome";} what is


116 the size of str
7

117 Why an array address cannot be changed

118 Why array index starts from zero

119 What is a tripple dimenssional Array

An array with 3 rows

An Array with 3
columns per row

120 Arrays are dynamic in C

The Maximum Index of array is one less than the number


121 of elements
1

#include<stdio.h>void main(){int x=6;int


122 a[x]={10,20,30,40,50};printf("%d",a[4]);}

50

Garbage Value

#include<stdio.h>void main(){int x=5;int


123 a[5]={10,20,30,40,50};printf("%d",a[++x]);}

Garbage Value

Error

The Order in which actual arguments are evaluated in a


124 funcion call

is from the left

125 Choose the correct statements

During external
variable defination,
storage is set aside
by the compiler

is from the right


During external
variable
declaration, no
storage is set
aside by the
compiler

126 The storage class static can be used to

restrict the scope of


an external identifier

preserve the exit


value of variables

127 What is meant by recurssion

128 #include<stdio.h>int main(){printf("\nHello");main();}

Error(main is not
recurssive)

keeps printing
Hello

129 Use of Functions

Code Reusability

Modularity

What is the difference between call by value and call by


130 reference

#include<stdio.h>int increment(){ static int x;printf("%d ",+


131 +x);}int main(){increment();increment();increment();}
error

1,2,3

132 printf("abc","def","ghi");

abcdefghi

Error

133 The scope of a macro defination

cannot be beyond the


file in which it is
may be part of a
defined
file

Which of the following comments about preprocessor


134 directive # are correct

It converts the formal


argument in the
macro defination into It strips out
a string
redundant blanks

135 calloc(m,n); is equivalent to

malloc(m*n,0);

memset(0,m*n);

the declaration enum cities{AP,MP,TN=1,UP} assigns the


136 value 1 to

AP

TN

#include<stdio.h>int main(){int x=100;int


137 *p=&x;printf("%d",++*p);}

101

incremented
Address

It is not advisable to use macros instead of functions


138 because

It increases the code


size

no type checking
will be done

139 Choose the correct statements

enum variables can


be assigned new
values

enum variables
can be compared

140 The statement printf("%d",10 ? 0 ? 5 : 11 : 12); prints

10

141 Choose the statement the best defines an array

It is a collection of
items that share a
common name

0
It is a collection of
items that share a
common name
and occupy
consecutive
memory locations

#include<stdio.h>void first(){} void second(){putchar('d');}


void main(){ putchar('M');first();putchar('m');} If Madam is
142 the required then the body of first() must be

Empty

second();putchar(
'a');

#include<stdio.h>void change(int a){printf("%d",++a);}


143 void main(){int a=4;change(a);printf("%d",a);}

5 5

4 5

144 Choose the best anwser . Storage classes define

the datatype

the scope

145 what is the difference between structure and union

int m, n, b=m=n=8;char wer[80];sprintf(wer,"%d%d


146 %d",m,n,b);puts(wer);

8 8

147 puts(argv[0])

Prints the name


Prints the name of the of the executable
source code file
code file

#include<stdio.h>void main(){int abc();abc();(*abc)();} int


148 abc(){ printf("Come");}

Error

ComeCome

149 #include<stdio.h>void main() { int a[2][3];printf("%d",*a);}

Error

Array Address

150 int a[0]; what is the size of this array

Error

0 bytes

#include<stdio.h>#define sqr(x) x*x void main()


151 {printf("%d",sqr(2+1);}

#include<stdio.h>void main(){int x=300;char


152 *p=(char*)&x;printf("%d",*p);}

Error

Segmentation
Fault

#include<stdio.h>union Test{short int x;char a[2];};void


main(){union Test t1;t1.x=300;printf("%d
153 %d",t1.a[0],t1.a[1]);}

Garbage Value

Error

prints the null


string

#include<stdio.h>void main(){char
154 str[]="wel0come";printf("\n%s",str);}

Error

wel0come

#include<stdio.h>void main(){char
155 str[]="wel\0come";printf("\n%s",str);}

Error

wel0come

int *x;double *d;x++;d++;by how many bytes x and y will


156 be incremented(assume that size of pointer is 4 bytes)

1,1

4,4

choose is the equivalent code for the following in pointer


157 notation a[i][j]

*(a+i+j)

*a(i+j)

158 int a[3][4]; *(a+i); gives access to

Error

First Row First


Column Value

159 How to open a file to over write a record

fopen("emp.txt","r
fopen("emp.txt","w+"); +");

What is the difference between w+ and r+ modes in


160 fopen()

161 how to use a variable of another file the current c file

by including the
by defining the
contents of that file in variable static in
the current file
the current file

162 Pick the operators whose meaning is context dependent

Which of the following comments regarding the reading


163 ofa string, using scanf(with %s option) and gets, is true

Both can be used


interchangeably

scanf is delimited
by end of line,
while gets is not

164 The program fragment int i=263;putchar(i);

prints 263

prints ASCII
equivalent of 263

The following program fragment


165 4;printf("%u",i+j);

Garbage Value

-3

unsigned i=1; int j=-

166 a -> b is syntactically correct if

a is a structure
and b is a pointer
a and b are structures to a structure

167 A file is prefereble to an array of structures because

file lives even after


the program
terminates

void max(int x,int y,int m){if(x>5) m=x; else m=y;}int main()


168 {int i=20,j=5,k=0;max(I,j,k);printf("%d",k);}
5

169 Bit Field

170 What is a runtime error

Apart from syntax, what is the difference between while


171 and for loop

memory space
will not be wasted

20

is a structure
declaring the
sizes of the
is a field having many members in
sub-fields
terms of bits

172 What is the difference between iteration and recurssion

173 What is the difference between return and exit(0)

default case, if
used should be
the last case

174 If switch feature is used,then

default case must be


present

175 The switch feature

can always be placed


by a nested if-thenenhances logical
else clause
clarity

176 C is a

high level language

low level
language

177 C is often called middle level language

cosider the declaration static char hello[]="hello"; The


178 out put of printf("%s\n",hello); will be same as that of

puts("hello");

puts(hello);

The following progr main(){ static int a[] = "{7,8,9};


179 printf("%d",2[a]+a[2]);}

Results in bus error

Segmentation
fault

Under which of the following conditions, the size of an


180 one-dimenssional array need not be specified

when initialized is a
part of defination

when it is a
declaration

If Two dimenssional array is used as a formal parameter,


181 then

both the subscripts


may be left empty

the first(row)
subscript may be
left empty

Consider the following declaration int a,*b=&a,**c=&b;


182 The following program fragment a=4;**c=5

does not change the


value of a

assigns address
of c to a

183 Pointers are of type

Integer DataType

Character
DataType

AnswerText3

xt4

10

11

CorrectAnswer

Topic
3

C & Data
Structures
dealloc()

free()

C & Data
Structures

ptr = ptr + sizeof(myArrayincrement(ptr)

C & Data
1 Structures

y = LLO

C & Data
4 Structures

y = LO

printf("My salary was incr printf("\"My s

C & Data
4 Structures

A definition occurs once, A declaration

C & Data
4 Structures

11

C & Data
Structures

22,11,11,11

22,13,13,13

C & Data
4 Structures
3

C & Data
Structures

5, 4, 3, 2, 1, 0,

0, 0, 1, 2, 3, 4

14

C & Data
4 Structures
4

C & Data
Structures

MAX_NUM is a precompile
MAX_NUM is a

C & Data
4 Structures

strncpy()

C & Data
4 Structures

memmove()
46

50

C & Data
Structures

Yes; it can be referenced No; it would n

C & Data
4 Structures

t = ctime();

C & Data
1 Structures

t = localtime();

The processor's registers The heap

C & Data
1 Structures

Assembly

C & Data
2 Structures

Object-orient

C & Data
Structures
3

C & Data
Structures
3

C & Data
Structures

defg

cdefg

-4: 3 4:3

-4:3 -3:4

C & Data
1 Structures

C & Data
Structures

int *x = *0x200;

int *x = 0x200
6

C & Data
1 Structures
3

C & Data
Structures
3

C & Data
Structures

char * (* p) [12][12][12] = const char ** p

C & Data
1 Structures

typedef void *sighandler_t#define sighand

C & Data
1 Structures

ptr += malloc( 9 * sizeof( ptr = realloc(

C & Data
1 Structures

A C program knows the typ


Pointers may b

C & Data
4 Structures

12

24

C & Data
Structures

The first definition is not They do not dif

C & Data
4 Structures

AND.

C & Data
4 Structures

&&

%e displays a double in e%e displays an

C & Data
1 Structures

ferror()

feof()

C & Data
4 Structures

c = getchar( stdin );

c = getchar();

C & Data
4 Structures

C & Data
4 Structures

It will print out: i=10.

It will loop ind

10

C & Data
Structures

>

C & Data
Structures

It automatically incremen It automaticall

C & Data
2 Structures

#includefile <sysheader> #include sysh

C & Data
1 Structures

%-4.30f

%-30.4f

C & Data
4 Structures

x=4

x=5

C & Data
4 Structures

1, 2, 8

2, 2, 4

C & Data
4 Structures

C & Data
Structures

enum coin (penny=1,nick enum coin {pe

C & Data
4 Structures

13 bytes

20 bytes

C & Data
4 Structures

z=1.50

z=2.00

C & Data
2 Structures

4season

run4

C & Data
3 Structures

It is illegal to initialize

They are left i

C & Data
2 Structures

int *ptr = (int *) alloc(10*s int *ptr = (int

C & Data
4 Structures

stdout and stdio

stdio and stde

C & Data
1 Structures

if (x >= 2) return 2;

if (x <= 1) retu

C & Data
4 Structures

The global variable is ref The global vari

C & Data
1 Structures

The variable's format

The variable'

C & Data
4 Structures

bigNumber

g42277

C & Data
2 Structures

eof( f )

f == NULL

C & Data
1 Structures

Visible to all translation u Allocated on

C & Data
4 Structures

___1

S___

C & Data
2 Structures

float

double

C & Data
3 Structures

fileOpen (filenm, "read"); fopen (filenm,

C & Data
4 Structures

int f;

struct FILE f;

C & Data
2 Structures

dump()

write()

C & Data
1 Structures

255

32767

C & Data
Structures

C & Data
Structures

56789 0123 4

C & Data
Structures

56789 56789

-40

0.004

C & Data
1 Structures

Variable definition must Variables may

C & Data
4 Structures

*(ptr + 3) = 10;

(*ptr)[ 3 ] = 10

C & Data
3 Structures

1 -- 1 2 -- 2

1 -- 1 1 -- 2

C & Data
1 Structures

In the for loop, the assi

This is invali

C & Data
2 Structures

readfile()

fread()

C & Data
4 Structures

FILE *f = fwriteb( "test.binFILE *f = fopen

C & Data
4 Structures

strtime

C & Data
4 Structures

ctime

There will be a segmentatiNot enough spa

C & Data
2 Structures

With the exception of genA pointer to o

C & Data
1 Structures

struct node m =
n;free( n );
n = m->next;

free( n );n =
n->next;

C & Data
2 Structures

total is initialized with a

The code above

19 25

C & Data
1 Structures

C & Data
Structures

Garbage Value

Error

C & Data
Structures

Error

None

C & Data
Structures

C & Data
Structures

C & Data
Structures

Dangling Pointer

Pointer
without
allocation

C & Data
Structures

0,1,2,3,4,5

1,2,3,4,5

C & Data
Structures

11.25

Error

C & Data
Structures

Hello , Garbage Value

Error

C & Data
Structures

Error

C & Data
Structures

15

C & Data
Structures

Run Time
Error

C & Data
Structures

address of i

999

EOF is a structure
variable

EOF is an
end of file
character

C & Data
Structures

Unpredicted

20

C & Data
Structures

300

Unpredicted 2

C & Data
Structures

10

C & Data
Structures

Error

Unpredicted 1

C & Data
Structures

C & Data
Structures

x=-x+y+1

x=x-y-1

C & Data
Structures

10 , 10 , 11

None

C & Data
Structures

C & Data
Structures

127

none

C & Data
Structures

10

C & Data
Structures

C & Data
Structures

2^15

2^16

C & Data
Structures

sum a,b

minimum of
a,b

C & Data
Structures

C borrowed most of its


ideas from BCPL

All the
options

C & Data
Structures

Unpredictable

none

C & Data
Structures

C & Data
Structures

" = "

All the
options

C & Data
Structures

prints 6 or 8 depending
on the compiler
implimentation

syntactically
wrong
3

C & Data
Structures

Error

1000

C & Data
Structures

Error

1000

C & Data
Structures

C & Data
Structures

C & Data
Structures

C & Data
Structures

Syntax Error

Execution
will bw
terminated
abruptly

volatile

immutable

C & Data
Structures

undefined

declaration
leads to an
error

C & Data
Structures

C & Data
Structures

An Array with 3 rows


and 3 columns

C & Data
Structures

More than
one double
dimenssional
Array
4

C & Data
Structures

C & Data
Structures

C & Data
Structures

Error

40

C & Data
Structures

50

10

C & Data
Structures

is compiler dependent

will be
decided at
runtime

C & Data
Structures

The use of external


variables may make
debugging difficult

All the
options

C & Data
Structures

provide privacy to a set


of functions

All the
options

C & Data
Structures

Hello will be printed only Run Time


once
Error

makes debugging easy

All the
options

C & Data
Structures

C & Data
Structures

C & Data
Structures

C & Data
Structures

0 , 1, 2

Garbage

C & Data
Structures

abc

none

C & Data
Structures

excludes string of
characers within double All the
quotes
options

C & Data
Structures

It concatenates adjacent All the


strings,if any
options

C & Data
Structures

p=malloc(m*
p=malloc(m*n);memset( n);
p,0,m*n);
strcpy(p,0); 3

C & Data
Structures

AP , TN

MP,TN

C & Data
Structures

Error

100

C & Data
Structures

All the
recursion is not possible options

C & Data
Structures

Enumeration feature
does not increase the
power of C

C & Data
Structures

C & Data
Structures

C & Data
Structures

putchar('a');second();pri none of the


ntf("%c",'a');
above

C & Data
Structures

5 4

4 4

C & Data
Structures

the scope and


permanence

the scope ,
permanence
and datatype 3

C & Data
Structures

All the
options

12
11
It is a collection of items
of the same type and
storage class that share
a common name and
occupy consicutive
none of the
memory locations.
above

C & Data
Structures

888

none of the
above

C & Data
Structures

Error

prints
number of
command
line
arguments

C & Data
Structures

run time error

Come Come 2

C & Data
Structures

Array's first element

garbage
value

C & Data
Structures

4bytes

Depends on
compiler
implementati
on
4

C & Data
Structures

Error

none

C & Data
Structures

300

44

C & Data
Structures

none of the
above

C & Data
Structures

44

wel0come and Garbage


value
wel

C & Data
Structures

wel0come and Garbage


value
wel

C & Data
Structures

4,8

Unpredicted 3

C & Data
Structures

*(*(a+i)+j)

((a+i)+j)

C & Data
Structures

Base Address

segmentatio
n fault
3

C & Data
Structures

fopen("emp.txt","a+");

fopen("emp.t
xt","w");
2

C & Data
Structures

C & Data
Structures

by defining the variable


extern in the current file Not possible 3

C & Data
Structures

&

All the
options

C & Data
Structures

scanf is delimited by
blank space, while gets none of the
is not
above

rings the bell

C & Data
Structures

C & Data
Structures

C & Data
Structures

a is a pointer
to structure
in which b is
a field
4

C & Data
Structures

garbage
value

an integer that changes


from machine to
none of the
machine
above

a is a pointer to a
structure and b is a
structure

there are many system All the


tools to manipulate files options

C & Data
Structures

none of the
above

C & Data
Structures

is member of a structure
whose size is specified none of the
in terms of bits
above

C & Data
Structures

C & Data
Structures

C & Data
Structures

C & Data
Structures

C & Data
Structures

C & Data
Structures

can't always be
replaced by a nested ifthen-else clause
both a and b 4

C & Data
Structures

low level
language
with some
high level language with high level
some low level features features

C & Data
Structures

C & Data
Structures

printf("%s\n","hello");

All the three 4

C & Data
Structures

will not compile


successfully

none of the
above

C & Data
Structures

when it is a formal
parameter

All the three 4

C & Data
Structures

default case , if used,


can be placed any
where

none of the
above

the first subscript must


be left empty

both the
subscripts
must be left
empty

C & Data
Structures

assigns the value of b to assigns 5 to


a
a
4

C & Data
Structures

Unsigned Integer
DataTypes

C & Data
Structures

none of
these

Sno

QuestionText

AnswerText1 AnswerText2

AnswerText3

in while condition is
checked first
where as in do
while condition is Only Syntactical
checked last
Difference

What is the difference between


while and do while loops

No difference

Which is true of conditional


Compilation

It is setting the
It is taken care of compiler option
by the compiler conditionally

It is compiling a
program based on
a condition

Choose the correct statements

Casting refers to Coercion refers to


implicit type
implicit type
conversion
conversion

Casting refers to
Explicit type
conversion

The const feature can be applied


to
an identifier

Choose the correct statements

In Standard C, trigraphs in the


source program are translated

Constant
expressions are
evaluated at
compile time

an array argument

String constants
can not be
concatenated at
compile time

Size of an array
must be known at
compile time

before the lexical after the syntax


analysis
analysis

If a global variable is of storage


class static , then

All the elements


of the array
should be if the
datatype ans
storage class
the static
declaration is
unnecessary if
the entire source
code is in a
single file

void can be used

as a datatype of
a function that
returns nothing
to its calling
environment

Choose the correct statements

an array

The number of
subscirpts
determines the
dimension of the
array

before the
recognition of
escape characters
in strings
The array
elements need
not be of the
same storage
class

the variable is
recognized only in
the file in which it if it results in a
defined
syntax error
inside the brackets
of a function that
does not needany
arguments
in an expression

10

The Use of macro in place of


function

reduces
execution time
It is possible for
a function to
access a
variable that is
Which of the following statements local to another
are correct
function

increses
reduces code size execution time
The scope of a
local variable
should be a
function

Which of the following is true of


external variables

Two local variables


may have the
same name
Their scope
They provide a extends from the
way for two way point of defination
communication through the
between
remainder of the
functions
program

In an expression involving ||
operator,evaluation

will be stopped if
one of its
components
evaluates to
false

will be stopped if
one of its
components
evaluates to true

takes place from


right to left

14

ftel() is used for

position the file


pointer

gives the current


file position
indicator

used to find the


size of a file

15

choose the correct comments.In


a Bit field

a field can be
unnamed

a field can be of
width 0

if a field is unnamed, its width


must not be zero

16

choose the correct statement

Address
operator cannot Address operator
be applied to
can be applied to
register variables register variables

17

The Address operator & , cannot


act on
R values

11

12

13

arithmetic
expressions

If they are not


initialized, they will
have garbage
value

Misuse of register
declaration will
increase the
execution time

members of a
structure

AnswerText4

CorrectAnswer

Topic

In do while statements
will be executed atleast
once

2,4

C & Data
Structures

It is taken care of by the


preprocessor

3,4

C & Data
Structures

Coercion refers to
Explicit type conversion

2,3

C & Data
Structures

none of the above

1,2,3

C & Data
Structures

none

1,3

C & Data
Structures

During the intermediate


code generation phase

1,3

C & Data
Structures

In an array defination,
the subscript can be any
expression yielding a
non-zero integer value
1,2

C & Data
Structures

none of the above

1,2

C & Data
Structures

in a printf statement

1,2

C & Data
Structures

1,4

C & Data
Structures

The scope of a local


variable may be a single
statement
2,4

C & Data
Structures

none of the above

1,2

C & Data
Structures

takes place from left to


right

2,4

C & Data
Structures

to check whether file is


existing or not

2,3

C & Data
Structures

a field must have a name 1,2

C & Data
Structures

none of the above

1,3

C & Data
Structures

local variables

1,2

C & Data
Structures

increses code size

You might also like