Fundamentals of



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

7. The size of structure can be determined by

a. Size of variable name b. Size of (structure tag)




(A) Only a

8. main()

{

(B) Only b

(C) Both a and b (D) None


Struct

{

}xyz;


int i;


(*xyz)->i=10; printf("%d" ,xyz.i); What will be the output?

(A) Program will not compile (B) No answer

9. Pushdown list means:

(C) 10 (D) Address of i




(A) Stack (B) Queue (C) Linked List (D) All the Above

10. What output following program produce?

#include<stdio.h>

main()

{

char str*+=”S\005 B”



printf(" \ n %d" ,sizeof(str);

}


(A) 7 (B) (C) 5

(D) Error





11. fputs function is used to

1. write character to a file

3. returns a character

(A) All are true

(C) Only 1 and 2 are true
12. #include<stdio.h>

Void main()

{

2. takes 2 parameters



4. requires a file pointer

(B) All are false

(D) Only 1 and 3 are true

}

(A)



.

int a;

print(%d a^a)
1 B)0 C)Unexpected D)Runtime error


13. Time taken for addition of element in queue is

(A) O(1) (B) O(logn) (C) O(n) (D) None of these

14. To delete a dynamically allocated array names 'a' , the correct statement is

(A) delete a[10]; (B) delete [] (C) delete a; (D) delete [O]a;



15.What is output of following code?

#include void swap(int&,int&); void main()

{

int a=10,b=20; swap(a++,b++ );

}

void swap(int&x,int&y)



{

x+=2; y+=3;




} (A) Error

(C) 14,24

(B) 10,20

(D) 11,21



16.What will be value of 'a' after following code is executed?

#define square(x) x*x

A = square(2+3);

(A) 25 (B) 13 (C) 11 (D) 10
17.The five items: A, B, C, D and E are pushed in a stack, one after another starting from A. The stack is

popped four times and each element is inserted into queue. Then two elements are deleted from the

queue and pushed back to stack. Now one item is popped from the stack. The popped item is


(A) A (C) C

(B) B (D)D




18.What is output of following code?
#include Void main()

{

int a=0,b=0;



a=(b=75)+9;

printif(" \ n%d%d",a,b);

}

(A) 75,9 (B) 84,75 (C) 75,84 (D) None



19. When applied to a variable, what does the unary & operator means?


(A) The variable value

(C) The variable address

(B) The variable format

(D) The variable's right value





20. FILE

*f=fopen(fname, "r"') ;readData(f) ;if(? ???){puts("End of fIle reached");}



(A) F=EOF()

(B) eof(f);

(C) feof(f) (D) f=NULL



21. Global variables that are declared static are------------ . Which one of the following correctly completed the sentence above?


(A) Deprecated by standard C

(C) Internal to the current translation unit

(B) Allocated to Heap

(D) Visible to all translation units




22. According to standard C, what type of an unsuffixed floating point literal, such as 123.45?

(A) float (B) double (C) unspecified (D) long double




23. Which one of the following valid for opening a read-only ASCII fIle?


(A) fIleOpen(fname,"r"); (C) fopen(fname,"r");

(B) fIleOpen(fname,"ra");

(D) fIleOpen(fname,"read");


24. f = fopen(fname,"r"); Referring to the code, what is proper definition of variable

following?

(A) FILE f; (B) File *f; (C) int f; (D) struct FILE f;

25. short int x; // x is 16 bits

What is the maximum number that can be printed using printf("%d"\ n",x)

(A) 127 (B) 128 (C) 65,536 (D) 32,767

26. char *dwarves[]={"Sleppu", "Dopey""Doc","happy" ,"Grumpy''''sneezy","Bashful",};

f from


how many element will dwarves will contain? Assuming c compiler employed strictly with the requirements of standard C.

(A) 4 (B) 5 (C) 6 (D) 7

27 char *buffer = 0123456789”

char *ptr = buffer;

ptr +=5;

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

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

What will be printed when above code is, executed?




(A) 0123456789,56789

(C) 56789,0123456789



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

//ptr+ l=ptr[l]

(B) 5123456789,5123456789 (D) 56789,56789




(A) 6 (B) 7 (C) 8 (D) 9

29. Penny = one

Nickel = five

Dime = ten

Qurter = twentyfive

How is enum is used to define the values of the American coins listed above?

(A) enum

(B) enum

coin( (penny, l),(nickel,5), coin(penny= 1,nickel=5, (dime, 10),(quarter,25); dime=10,quarte=25);

(D) enum

coin(penny=1,nickel=5, coin{penny,nickel, dime=10,quarter=25} dime,quarter}(l ,5, 1 0,25);


Download 9.46 Mb.

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




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

    Main page