Fundamentals of



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

39. In a c expression, how logical AND operator represented?


A. && C. ||

B. @@ D. AND




40. :ow to print()s format specifier %e and %f differ in their treatment of floating number?

A. %e display a double in engineering notation if the number is very small or very large. Otherwise it

behaves like %f and displays numbers in decimal notation




B. %e display a argument of type double with trailing zeros and %f never displays trailing zeros



C. %f and %e both expect a corresponding argument of type double and format it identically. %e is left over

from K && C; standard C prefers %f for new code

D. %e always display and argument type double I engineering notation %f always displays ad argument of

type double in decimal point

41. Which one of the following will read a character from the keyboard and will store it in the variable C?


A. c = getch(); B. C = getchar();

42. #include<stdio.h>

int I;

void increment(int i)

{

C. c = getchar(stdin); D. getchar(&c);


i++;

}

int main()

{

for(i=0;i<10;increment(i))

printf(i=%d\n” i)

return 0;

}

what is output of above program?

A. i=9;

B. it will not compile

C. i=10

D. it will loop indefinitely

43. int i=4;

switch(i)

{

default: ; case 3: i+=5; if(i==8)

{

i++; if(i==9)break; i*=2;

}

i-=4; break; case 8:



break;

}

i+=5;


printf(i=%d\n ” i)

what will be output of the sample code above be?

A. i=5; B.i=9; C. i=10; D.i=18;

44. Which one of the following operators is right associator ?
A. -> B. []


C. = D. ,



45. What does the auto specifier do?
A. It automatically increament the variable when used

B. It indicate that a variable memory will automatically be preserved

C. It automatically initialised a variable to 0

D. It indicate that a variables memory space is allocated upon entry in to a block

46. How do you include a system header file called sys header .h in C source file?

A. #inclsheader.h>

B. #includefilesheader>

C. #includesysheader.h

D. #include<sysheader.h>

47. Which one of following printf()format specifier indicates to print double value in decimal notation, left

align in a 30 character forrmat field 4 digit precision?

A. %30f.4e B. %4.30f C. %30.4f D. %4.30e



48. int x=0;

for(;;)

{

if(x++=4) break; continue;

}

printf(x=%d\n” x)

what is the output of above code?

A. x=5


B. x=0

C. x=4

D. x=1
49. According to the standard C specification what are the respective minimum size of following three data types :short,int,long?

A. 1,2,2

B. 1,2,4

C. 2,4,8

D. 2 ,2,4

50. What is output of following code?

#include<stdio.h>

void main()

{

char letter=Z

printf(\n %c” letter)

}

A. 90

B. Z

C. Error

D. Garbage Value





Answers:
1. C

11. B

21. D

31. A

41. B
2. B 3. C 4. D 5. B 6. A 7. A 8. B 9. A 10. B

12. D 13. A 14. C 15.B 16.B 17.C 18.A 19.D 20. D

22. A 23.C 24.B 25.A 26.A 27.B 28.D 29.D 30. D

32. D 33.C 34.C 35.D 36.C 37.D 38.B 39.A 40. D

42. D 43.A 44.C 45.B 46.D 47.C 48.A 49.B 50. B




1. What will be output of following program?

#include



#define a 10

void main()

{

printf(%d a)



foo();


printf("%d .. "

,a);

}

void foo()

{

#undef a

#define a 50

}

(A) 10.10



(B) 10.15 (C) Error (D) 0


2. Array is passed as an argument to a function is interpreted as

(A) Address of array (B) Number of elements in array

(C) Value of the first element in array (D) Address of the first element of

3.

main()

{

char thought [20] [30] = {"Don't walk in front of me .. ", "1 may not follow" };



printf("%c%c", * (th ought [0]+9), *(*(thou ght+0)+5));

}

What is output of program?





(A) Don't walk in front of me

4.

#include <stdio.h>

void main()

{

int i=3, *j, **k;



j = &i;

k=&j;

printf("%d%d %d", *j, **k, *(*k));

}

What is output of above code?

(B) kk (C) 1 may not follow (D)K


(A) 000 (B) 333 (C) 444 (D) 433

5. Which of the following is the correct way of declaring a float pointer?


Prepared By:- Mr. Pawar A. B.
105


(A) float ptr; (B) *float ptr; (C) float *ptr; (D) None



6.The reason for using a pointer is ....

(A) Accessing arrays or strings (B) Dynamic memory allocation

(C) Implementing Linked lists, trees, graphs and many other data structures

(D) All the above


Download 9.46 Mb.

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




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

    Main page