Fundamentals of



Download 9.46 Mb.
Page38/57
Date09.01.2017
Size9.46 Mb.
#8172
1   ...   34   35   36   37   38   39   40   41   ...   57

14. File manipulation function in C are available in which header file?

A. files.h B. streams.h C. stdio.h D. stdlib.h

15. C support how many basic looping constructs

A. 2 B. 3 C. 4 D. 5

16. What should be the expression return value for a do-while to terminate

A. 1 B. 0 C. -1 D. NULL

17. Which among the following is a unconditional control structure

A. Do-while B. if-else C. goto D. for

18. continue statement is used for


A. to go to next iteration in the loop

C. exit and return to main function

B. come out of loop

D. Restart interations beginning from loop




19. Which of following header file is required for strcpy() function?

A. strings.h B. strcpy.h C. files.h D. string.h

20. A compound statement is a group of statements included between a pair of


A. Double quotes

21. A link is

A. A computer



B. Parenthesis C pair of /’s
B. A C interpreter

D. Curly braces


C. An active debugger D. An analysing tool

22. The continue command cannot be used with

A. switch B. while C. do D. for

23. When the main function is called, it is called with the arguments


A. argc

24. Parameters are used-

B. argv C. Both A & B D. None of these


A. To return values from the called function

B. To send values to the called function

C. A & B both

D. To specify return type of function

25. Recursive call result when

A. A function calls itself

B. A function calls another function, which in turn call the function

C. A & B both

D. A function call another function

26. The main function calls in a C program


A. Allows recursive calls

C. Is built in function

B. does not allows recursive calls



D. Is optional


27. With every use of memory allocation function, which function should be used to release allocated memory which is no longer needed?

A. unalloc() B. free() C. dealloc() D. release()

28. char*myFunction(char*ptr)

{

ptr +=3;

returnptr;

}




int main()

{

char *x, *y;

x =”:ello”

y = myFunction(x);

printf(y = %s” y)

}

What will be output of program?


A. y= Hello

C.y= llo

29. void myFunc(int x)

{ if(x>4) myFunct(--x); printf(%d ” x)

}

int main()

{ myFunc(5); return 0;

}

What will be code print?

A. 0,0,1,2,3,4



B)y= ello

D)y= lo

B.4,3,2,1,0,0 C.1,2,3,4,5,5 D.0,1,2,3,4,5




30. Which function is correct choice for moving binary data that are of arbitrary size and position in

memory?


A. memcpy() C. memset()

B. Strncpy()

D. memmove()


31. Which one of following provides conceptual support for function call?


A. The system stack

B. The processors registers

32. int i,j:

int ctr = 0;

int myArray[2][3];

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

for(j=0;j<2;j++)

{

B.The data segment

D. The text segment


myArray[j][i]=ctr;

ctr++;

}

What is value of myArray[1][2]?

A. 2 B. 3 C. 1 D. 5

33. int x=3;

if(x==2)

x =0; if(x==3) x++;

else

x+=2;

What will be the value of x?

A. 1 B. 3 C. 4 D. 5






34. x=3,counter=0;

while((x-1))

{



x--;

}

++counter;


What will be value of counter?

A. 0 B. 1 C. 2 D. 5



35. 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 below:

sighandel_tsignal(int sig, sighdler_thandler);



A. typdef void*sighandler _t(int);

B. typedefsighandler_t void(*)(int);



C. #define sighandler_t void(*)(int);

D. Typedef

void(*sighadler_t)(int);

36. struct customer *ptr =

malloc(sizeof(struct customer));

Give then sample allocation for the pointer found above, which of the following statement is used to reallocptr to be an array of 10 elements?

A. ptr+=malloc(9*sizeof(struct customer));

B. realloc(ptr, 10 *sizeof(struct customer));

C. ptr= realloc(ptr, 10*sizeof(struct customer));

D. relloc(ptr, sizeof(struct customer));

37. shorttestarray[4][3]= {{1},{2,3}.{4,5,6}};

printf(%d\n” sizeof(testrray))

What will be output assuming short need 3 bytes?

A. 6

B. 7

C. It will not compile since not enough initializations

D. 24

38. char buf*+ =”hello World!

char*buf= hellow World!

in term of code generation do above initializations differ?

A. The first definition certainly allow the contents to be safely modified at runtime; the second does not

B. They do not differ they are functionally equivalent

C. The first definition is not legal because it does not indicate the size of array to be allocated, the second

one is legal.

D. The first definition allocates enough space for a NUL_ character, nor does it append one; he second

definition does.


Download 9.46 Mb.

Share with your friends:
1   ...   34   35   36   37   38   39   40   41   ...   57




The database is protected by copyright ©ininet.org 2024
send message

    Main page