Beruflich Dokumente
Kultur Dokumente
Department of CSE/ IT
Branch: CSE, IT, EEE and E&I Date &Time: 22/4/16
Semester: VI Max. Marks: 50
Subject: Technical Training- C Programming
Staff In-charge: A.Sivarama Krishnan/IT, P.Vasantha Kumari/IT
25.What will be output if you will compile and execute the following c code?
void main()
5
{
char c=125;
c=c+10;
printf("%d",c);
}
A.135 B. +1NF C. -121 D. -8
29.
What will be output of following program?
#include<stdio.h>
int main()
{
int i = 3;
int *j;
int **k;
j=&i;
k=&j;
6
printf("%u %u %d ",k,*k,**k);
return 0;
}
A. Address, Address, 3 B. Address, 3, 3 C. 3,3,3 D. Compilation Error
30. What will be output of following program?
#include<stdio.h>
#include<string.h>
int main()
{
char *ptr1 = NULL;
char *ptr2 = 0;
strcpy(ptr1," c");
strcpy(ptr2,"questions");
printf("\n%s %s",ptr1,ptr2);
return 0;
}
A. c questions B. c (null) C. (null) (null) D. Compilation Error
31. What will be output of following program?
#include<stdio.h>
int main()
{
char arr[10];
arr = "world";
printf("%s",arr);
return 0;
}
A. world B. w C. Null D. Compilation Error
32. What will be output of following program?
#include<stdio.h>
#include<string.h>
int main()
{
int a,b,c,d;
char *p = ( char *)0;
int *q = ( int *q)0;
float *r = ( float *)0;
double *s = 0;
a = (int)(p+1);
b = (int)(q+1);
c = (int)(r+1);
d = (int)(s+1);
printf("%d %d %d %d",a,b,c,d);
return 0;
}
A. 2 2 2 2 B. 1 2 4 8 C. 1 2 2 4 D. Compilation Error
33.What will be output of following program?
#include<stdio.h>
int main()
{
7
int i = 5 , j;
int *p , *q;
p = &i;
q = &j;
j = 5;
printf("%d %d",*p,*q);
return 0;
}
A. 5 5 B. Address Address C. 5 Address D. Compilation
Error
34.What will be output of following program?
#include<stdio.h>
int main()
{
int i = 100;
printf("value of i : %d addresss of i : %u",i,&i);
i++;
printf("\nvalue of i : %d addresss of i : %u",i,&i);
return 0;
}
A. value of i : 100 addresss of i : Address
value of i : 101 addresss of i : Address
B. value of i : 100 addresss of i : Address
value of i : 100 addresss of i : Address
C. value of i : 101 addresss of i : Address
value of i : 101 addresss of i : Address
D. Compilation error
35. What will be output when you will execute following c code?
#include<stdio.h>
int main()
{
printf("%d\t",sizeof(6.5));
printf("%d\t",sizeof(90000));
printf("%d",sizeof('A'));
return 0;
}
Choose all that apply:
A. 4 2 1 B. 8 2 1 C. 8 4 1 D. 8 4 2
36. Consider on following declaring of enum.
(i) enum cricket {Gambhir,Smith,Sehwag}c;
(ii) enum cricket {Gambhir,Smith,Sehwag};
(iii) enum {Gambhir,Smith=-5,Sehwag}c;
(iv) enum c {Gambhir,Smith,Sehwag};
Choose correct one:
A. Only (i) is correct declaration B. Only (i) and (ii) is correct declaration
C. Only (i) and (iii) are correct declaration D. D. All four are correct declaration
37. What will be output when you will execute following c code?
#include<stdio.h>
8
int main()
{
double num=5.2;
int var=5;
printf("%d\t",sizeof(!num));
printf("%d\t",sizeof(var=15/2));
printf("%d",var);
return 0;
}
Choose all that apply:
A. 4 2 7 B. 4 4 5 C. 2 2 5 D. 2 4 7
38.What will be output when you will execute following c code?
#include<stdio.h>
int main()
{
const int *p;
int a=10;
p=&a;
printf("%d",*p);
return 0;
}
Choose all that apply:
A. 0 B. 10 C. Garbage value D. Any memory address
39. Consider on following declaration:
(i) short i=10; (ii) static i=10; (iii) unsigned i=10; (iv)
const i=10;
Choose correct one:
A. Only (iv) is incorrect B. Only (ii) and (iv) are incorrect
C. Only (ii),(iii) and (iv) are correct D. All are correct declaration
40. Which of the following is integral data type?
A. void B. char C. float D. double
41. What will be output when you will execute following c code?
#include<stdio.h>
int main()
{
char a=250;
int expr;
expr= a+ !a + ~a + ++a;
printf("%d",expr);
return 0;
}
Choose all that apply:
A. 249 B. 250 C. 0 D. -6
42. Which of the following is not derived data type in c?
A. Function B. Pointer C. Enumeration D. Array
43. What will output when you compile and run the above code?
#include<stdio.h>
#include<conio.h>
void main()
9
{
int a=5,b=6,c=11;
clrscr();
printf("%d %d %d");
getch();
}
A.Garbage value garbage value garbage value B.5 6 11
C.11 6 5 D.Compiler error
44. What will output when you compile and run the above code?
#include<stdio.h>
void main()
{
clrscr();
printf("%d",printf("CQUESTIONBANK"));
getch();
}
A.13CQUESTIONBANK B.CQUESTIONBANK13
C.Garbage CQUESTIONBANK D.Compiler error
45. What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
char data[2][3][2]={0,1,2,3,4,5,6,7,8,9,10,11};
printf("%o",data[0][2][1]);
}
Choose all that apply:
A. 5 B. 6 C. 7 D. Compilation Error
46. What will be output when you will execute following c code?
#include<stdio.h>
void main()
{
int array[2][3]={5,10,15,20,25,30};
int (*ptr)[2][3]=&array;
printf("%d\t",***ptr);
printf("%d\t",***(ptr+1));
printf("%d\t",**(*ptr+1));
printf("%d\t",*(*(*ptr+1)+2));
}
Choose all that apply:
A. 5 Garbage 20 30 B. 10 15 30 20 C. 5 15 20 30 D. Compilation
error
47. What will be the output of the program below
#include<stdio.h>
void main()
{
int num[] = {1,4,8,12,16};
int *p,*q;
int i;
p = num;
10
q = num+2;
i = *p++;
printf("%d, %d, %d\n",i, *p, *q);
}
A. 4, 4, 8 B. 1, 4, 8 C. 2, 1, 8 D. 2, 4, 8
48. Which is not a storage class?
A. Auto B. Struct C.Typedef D.Static
49. Which of the following statement are correct?
(i) The value stored in the CPU register can always be accessed faster than that stored in
memory.
(ii) A register storage class variable will always be stored in a CPU register.
A. Only I is correct B. Only II is correct
C. Both I & II are correct D. Both I & II are incorrect
50. Which of the following statement are correct?
(i) The maximum value a variable can hold depends upon its storage class.
(iI) By default all variables enjoy a static storage class.
A. Only I is correct B. Only II is correct
C. Both I & II are correct D. Both I & II are incorrect
11