Anda di halaman 1dari 5

141. #include<stdio.

h>
#include<conio.h>
struct bit
{
int a:5;
int b:12;
};
main()
{
clrscr();
printf("%d",sizeof(struct bit));
getch();
}

a. 2
b. 3
c. 4
d. none of the above
Answer :

143. int size ,*int_ptr,table[20];


char ch,*char_ptr;
double d,grid;
Find out the value for the following statements.

a)size=sizeof(int) = 2.
b)size=sizeof(ch) = 1.
c)size=sizeof(size)= 2.
d)size=sizeof(table) =40.
e)size=sizeof(grid) = 160.
f)size=sizeof(char_ptr)= 4.

144. Suppose i and j are both integer type variables, and j has been
assigned a value of 5.Then find the valie of i for the following expressions.

a)i=2*j-2*j/5. ans:8.
b)i=j/2 ans:2.
c)i=2*j/2 ans:4.
d)i=(2*j)/2 ans:5

145. #include<stdio.h>
main(){
char a[]="hellow";
char *b="hellow";
char c[5]="hellow";
printf("%s %s %s ",a,b,c);
printf(" ",sizeof(a),sizeof(b),sizeof(c));
}
Answer : hellow,hellow,hellow 6,2,5

www.Technicalsymposium.com
148. float x, y, z;
scanf ("%f %f", &x, &y);
if input stream contains "4.2 3 2.3 ..." what will x and y contain after scanf?
a. 4.2, 3.0
b. 4.2, 2.3
Answer :

149. main ()
{
int ones, twos, threes, others;
int c;

ones = twos = threes = others = 0;

while ((c = getchar ()) != EOF)


{
switch (c)
{
case '1': ++ones;
case '2': ++twos;
case '3': ++threes;
break;
default: ++others;
break;
}
}
printf ("%d %d", ones, others);
}

if the input is "1a1b1c" what is the output?

a. 13
b. 33
c. 31
Answer :

150. main()
{
printf("Hello\n");
fork();
printf("Hi\n");
}
Justify:
Answer :

OBJECTIVE TYPE QUESTIONS

151. what does exit() do?


Answer : come out of executing programme.

www.Technicalsymposium.com
152. In 'o' how are the arguments passed?
Answer : by value.

153. Find the prototype of sine function.


Answer : extern double sin(double)

154. Scope of a global variable which is declared as static?


Answer : File

155.the function strcmp(str1,str2) returns


Answer :

156. n=7623
{
temp=n/10;
result=temp*10+ result;
n=n/10
}

Answer : 3267

157. when a function is recursively called all ,automatic variables are


Answer : stored in stack

158. what is the value of 'i'?


i=strlen("Blue")+strlen("People")/strlen("Red")-strlen("green")
Answer : 1

159. what does " calloc" do?


Answer : A memory allocation and initialising to zero.

160. Using pointer, changing A to B and B to A is Swapping the function


using two address and one temperory variable. a,b are address, t is
temporary variable. How function look like?
Answer : swap(int *, int *, int )

161. Pick up the correct function declaration.

1.void *[] name();


2 void int[][] name();
3 void ** name();
4 none of the above.
Answer :

162. how does the C compiler interpret the following two statements

p=p+x;
q=q+y;

a. p=p+x;

www.Technicalsymposium.com
q=q+y

b. p=p+xq=q+y

c. p=p+xq;
q=q+y

d. p=p+x/q=q+y
Answer :

163. main()
{
int i=0;
for( ;i++; )
printf("%d",i);
}
a. Finite Loop
b. Infinite loop
c. one time loop
d. none of the above
Answer :

164. If i = i * 16;
Which of the following is a better approach to do the operation
A) Multiply i by 16 and keep it
B) Shift left by 4 bits
C) Add i 16 times
D) None of the above
Answer :

165. If i=5, what is the output for printf( " %d %d %d", ++i,i,i++);

a) 5,6,7
b) 6,6,7
c) 7,6,5
d) 6,5,6
Answer :

166. How many bytes of memory will the follwing arrays need ?
(a) char s[80] ans: 80.
(b) char s[80][10] ans: 800.
(c) int d[10] ans: 20.
(d) float d[10][5] ans: 200.

167. which of the following is the correct declaration for the function main() ?

Answer : main( int , char *[])

168. if ptr is defined as

int *ptr[][100];

www.Technicalsymposium.com
which of the following correctly allocates memory for ptr?

Answer : ptr = (int *)(malloc(100* sizeof(int));

169. One pointer diff is given like this:


int *(*p[10])(char *, char*)
find the meaning.
Answer :

170. char *a[4]={"jaya","mahe","chandra","buchi"};

what is the value of sizeof(a)/sizeof(char *)

Answer :

171. What is the value of the following expression?


i = 1;
i << 1 % 2

a) 2
b)1
c) 0

172. What is the value of the following expression?


i = 1;
i = (i <<= 1 % 2)
a) 2
b) 0
c) erroneous syntax
Answer :

173. C allows
a) Only call by value
b) Only call by reference
c) Both
d) Only call by value and sometimes call by reference
Answer :

174. The following statement is


" The size of a struct is always equal to the sum of the sizes of its members"

a) valid
b) invalid
c) can't say
Answer :

175.

www.Technicalsymposium.com

Anda mungkin juga menyukai