• Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • English APP
  • login
  • Result
  • Today's Puzzle
    • Previous Puzzles
    • Prize & Rules
  • Discussion Board
    • Suggestion Board
    • Trending Articles
  • Maths Tricks
  • Placement Papers
    • Placement Questions
    • Interview Experience
    • Placed user Comment
    • Group Discussion
  • Walkins
    • Corporate Job Exam
    • Government Job Exam
    • Entrance Exam
  • Training
    • Internship
  • Placement Questions

Frequently Asked Interview Questions and Answers

Company

  • 3i-Infotech 345
  • Accenture 548
  • ADITI 81
  • Athenahealth 72
  • CADENCE 37
  • Capgemini 519
  • CMC 49
  • Cognizant 29
  • CSC 480
  • CTS 1340
  • Dell 49
  • Elitmus 44
  • GENPACT 516
  • Google 55
  • HCL 217
  • Hexaware 92
  • Huawei 81
  • IBM 1714
  • IGate 169
  • Infosys 2050
  • L&T 299
  • Microsoft 61
  • Miscellaneous 204
  • Oracle 74
  • Other 95
  • Patni 199
  • Sapient 44
  • Sasken 31
  • Self 38
  • Syntel 530
  • TCS 9109
  • Tech Mahindra 500
  • Wipro 1182

Exam

  • ACIO 119
  • AIEEE 334
  • AMCAT 2636
  • Assessment 108
  • Bank 22
  • CAT 988
  • CMAT 82
  • Cocubes 39
  • Elitmus 2952
  • Exam 39
  • Gate 846
  • GMAT 107
  • Gmate 29
  • GRE 469
  • IIT-JEE 471
  • ITC 28
  • Maths Olympiad 205
  • MBA 3481
  • MCA 32
  • Other 159
  • Others 25
  • R-SAT 111
  • Self 68

Government Jobs Exams

  • Bank Exam 478
  • CDS 57
  • CTET 21
  • IBPS 1258
  • IES EC 44
  • KVPY 364
  • NDA 481
  • NTSE 36
  • REVENUE OFFICE 53
  • RRB 1029
  • SSC 1294
  • UPSC 441

Interview

  • HR Interview 426
  • HR Round 41

Maths Puzzle

  • A website 299
  • Book 23779
  • Campus 250
  • CMAT 49
  • Exam 86152
  • General 399
  • Interview 141
  • M4maths 295
  • Maths 226
  • Orkut 27
  • Other 72
  • Others 1356
  • Reasoning 101
  • Self 3157

Programming and Technical

  • Android 118
  • ASP.NET 60
  • C 459
  • C++ 448
  • DATA STRUCTURE 66
  • DBMS 77
  • ELECTRONICS 39
  • Java 261
  • OOPs Concepts 117
  • Operating Syst 103
  • RDBMS 109
  • UNIX 70
Keep an EYE (0)Interview Experience (261)
Solved Question (6040) UnSolved Question (153944)
Pages: 11
Advertisements

(#M40155279) C QUESTION bit Keep an EYE Keep an eye puzzle Keep an eye puzzle

#include

int main()
{
struct value
{
int bit1:1;
int bit3:4;
int bit4:4;
}bit={1, 2, 13};

printf("%d, %d, %dn", bit.bit1, bit.bit3, bit.bit4);
return 0;
}

A. 1, 2, 13 B. 1, 4, 4
C. -1, 2, -3 D. -1, -2, -13

Asked In C Anshul jain (9 years ago)
Unsolved Read Solution (4)
Is this Puzzle helpful?   (5)   (3) Submit Your Solution Output

(#M40155281) C QUESTION bit Keep an EYE Keep an eye puzzle Keep an eye puzzle

#include

int main()
{
struct byte
{
int one:1;
};
struct byte var = {1};
printf("%dn", var.one);
return 0;
}

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

Asked In C Anshul jain (9 years ago)
Unsolved Read Solution (3)
Is this Puzzle helpful?   (6)   (5) Submit Your Solution Definition
Advertisements

(#M40155280) C QUESTION sizeof() Keep an EYE Keep an eye puzzle Keep an eye puzzle

int main()
{
struct value
{
int bit1:1;
int bit3:4;
int bit4:4;
}bit;
printf("%dn", sizeof(bit));
return 0;
}

A. 1 B. 2
C. 4 D. 9

Asked In C Anshul jain (9 years ago)
Unsolved Read Solution (5)
Is this Puzzle helpful?   (7)   (5) Submit Your Solution Technical

(#M40155407) AMCAT QUESTION bfs Keep an EYE Keep an eye puzzle Keep an eye puzzle

)In breadth-first search, which of the following options is true?

(a)Beginning from a node,firsdt all its adjacent nodes are traversed.

(b)Beginning from a node, each adjacent node is fully explored before traversing the next adjacent node

(c)Beginning from a node, nodes are traversed in cyclical order

(d)None of these

Asked In amcat Anshul jain (9 years ago)
Unsolved Read Solution (22)
Is this Puzzle helpful?   (21)   (10) Submit Your Solution Arrays

(#M40155234) C QUESTION pointer Keep an EYE Keep an eye puzzle Keep an eye puzzle

ARRAY-SHEET
Q1. main()
{
int n=10;
int a[n];
printf("n %d bytes",sizeof(a));
}
(a) compilation error (b) garbage values (c) 20 bytes (d) 10 bytes

Q2. main()
{
int a[]={1,2,3}, i, sum=0, *p, *q;
q=p=a;
for(i=0;i<3;i++)
{
++*p++;
printf(" %d", q[i]);
}
}
(a) 1 2 3 (b) 2 3 4 (c) all garbage values (d) no output

Q3. main()
{
int a[25];
a[0]=46;
a[24]=50;
printf("%d %d",a[24]-a[0],&a[24]-&a[0]);
}
(a) compilation error (b) 24 24 (c) 46 50 (d) 4 24

Q4. main()
{
int a[2]={10,20}, *p, i=1;
p=&a+1;
p--;
for(;i>=0;)
{
printf("%d ", *p--);
i--;
}
}
(a) 20 10 (b) 10 20 (c) 11 21 (d) 21 11

Q5. main()
{ static int a[]={2,4,6};
static int *p[]={a,a+1,a+2};
int *q[]={a+2,a+1,a} , *ptr, i;
for(i=0;i<3;i++)
a[i]=**p+**q;
for(i=0;i<3;i++)
printf("%d ",a[i]); }
(a) 4 8 12 (b) 12 12 12 (c) 8 14 14 (d) 2 4 6

Q6. main()
{ static int a[]={2,4,6};
static int *p[]={a,a+1,a+2};
int *q[]={a+2,a+1,a}, *ptr, i; ;
for(i=0;i<3;i++)
a[i]=*p[i]+*q[i];
for(i=0;i<3;i++)
printf("%d ",a[i]); }
(a) 4 8 12 (b) 12 12 12 (c) 12 22 22 (d) 8 8 14

Q7. Suppose the array a starts with the base address 170 andarray p starts with the base address 180
main()
{ static int a[]={10,12,14,16,18};
static int *p[]={a,a+1,a+2,a+3,a+4} , **ptr, *s;
ptr=p+0;
s=a+0;
printf("n %u %u %d %d ",s,ptr,*s,**ptr);
ptr++; s++;
printf("n %u %u %d %d ",s,ptr,*s,**ptr);
*ptr++; *++s;
printf("n %u %u %d %d ",s,ptr,*s,**ptr);
++*ptr; ++*s;
printf("n %u %u %d %d ",s,ptr,*s,**ptr);
*ptr++; *s++;
printf("n %u %u %d %d ",s,ptr,*s,**ptr); }

Q8. main() {
int a[5]={10,20,30,40,50},*p;
int i;
p=a;
for(i=0;i<3;i++)
printf(" %.4d ",++p[i]); }
(a) 10 20 30 (b) 0010 0020 0030 (c) 0011 0021 0031 (d) all garbage

Q9. main()
{ int a[][2][3]={ { {1,2,3}, { 4, 5, 6} },
{ {7,8,9}, {10,11,12} }
};
printf("%u ",***a+1+1+2);
printf("%u ", ***(a+1)+1+2);
printf("%u ",**(*(a+1)+1)+2);
printf("%u ",*(*(*(a+1)+1)+2)); }
(a) error (b) 1 12 12 12 (c) 1 10 11 12 (d) 5 10 12 12

Q10. main()
{ int a[]={10,20,30};
int *p[3]={a}, i;
for(i=0;i<3;i++)
printf("%u ",p[i]);
} suppose the base address of array a is 170
(a) 170 172 174 (b) 170 0 0 (c) 170 and garbage addresses (d) no output

Q11. main()
{ float x[3][3][3]={1.5,2.5};
printf("%.2f %.2f",x[0][0][0],x[2][2][2]); }
(a) 1.50 garbage value (b) 1.50 2.50 (c) 0.00 0.00 (d) 1.50 0.00 ( e) none of these

Q12. main()
{ int a[5]={10,20,30,40,50}, *p;
p=a+4;
p[-2]=50;
printf("n%u %d",p[-2],a[2]); }
(a) 30 50 (b) error (c) 30 30 (d) 50 30 (e) none of these

Q13. main()
{ int a[3]={10,20,30},*p;
for(p=a;p<&a[3];p++)
{ *p=p-a;
printf("%d ",*p); }
}
(a) 10 20 30 (b) garbage values (c) 1 2 3 (d) 0 1 2 (e) none of these

Q14. main()
{
int a[3][3];
printf("%u ",&a+0);
printf("%u ",&a+1);
}
if the base address is 65506
(a) 65506 65508 (b) 65506 65518 (c) 65506 65526 (d) 65606 65524

Q15. main()
{
int a[]={10,20,30} , (*p)[3]=a , i;
for(i=0;i<3;i++)
printf("%d ",(*p)[i]);
}
(a) 10 20 30 (b) 10 0 0 (c) 10 10 10 (d) 10 and all garbage values

Q16. What will be the value of a[i] will be printed out in this program?.
main() {
int a[3] , i;
for(i=0;i<3;i++)
{
a[i]=printf("abcde"+i);
printf("%d",a[i]);
} }
(a) 97 98 99 (b) 1 2 3 (c) 5 4 3 (d) all garbage values

Q17. main()
{ int a[]={10,20,30}, i,*p,j=0;
for(i=0;i<3;i++)
{
p=&a[i];
++*p++;
++a[j++];
printf("%d ",a[i]);
}
}
(a) 10 20 30 (b) 11 21 31 (C) 12 22 32 (d) 13 23 33

Q18. main()
{ int a[]={10,11,12}, I;
for(I=0;I<3;I++)
++*a;
for(I=0;I<3;I++)
printf(“%d”,a[I]);
}
(a) error (b) 10 11 12 (c) 11 12 13 (d) 12 13 15 (e) 13 11 12

Q19. main()
{ int a[][3]={1,2,3,4,5,6};
int (*p)[]={a};
printf(“%d %d”,(*p)[1],(*p)[2]);
*p++;
printf(“%d %d”,(*p)[1],(*p)[2]); }
(a) 2 3 5 6 (b) 2 3 4 5 (c) 4 5 0 0 (d) compilation error

Q20 main()
{ char a[ ]="Jyotir";
char b[ ]="Janmay";
char c[10];
c=a;
a=b;
b=c;
printf("%s %s",a,b); }
(a) Jyotir Janmay (b) Janmay Jyotir (c) Jyotir Jyotir (e) error

Q21 main()
{ char *a="Jyotir";
char *b="Janmay";
char *c;
c=a;
a=b;
b=c; printf("n %s %s ",a,b); }
(a) Jyotir Janmay (b) Janmay Jyotir (c) Jyotir Jyotir (d) Janmay Janmay

Q22 main()
{
int *p=&"Janmayjay";
printf("%s",p);
}
(a) Compiolation Error (b) garbage (c) J (d) Janmayjay (e) none of these

Q23 main()
{ char a[10][10];
char *b[10];
char (*c)[10];
printf("n %d %d %d",sizeof(a),sizeof(b),sizeof(c));
}
(a) 100 10 10 (b) 200 20 20 (c) 100 20 2 (d) none of these

Q24. main()
{
char *a[2]={"Jyotir" , "Janmay"};
printf("n%s",*a+1);
printf("n%s",*(a+1));
}
(a) Jyotir Janmay (b) Janmay Janmay (c) yotir Janmay (d) none of thsee

Q25. main()
{ static char *a[]={"Sanjay Sapra", "Janmayjay Sapra", "Jyotirmay Sapra"};
printf("%s",*(a+2)-16); }
(a) Jyotirmay Sapra (b) Sanjay Sapra (c) Janmayjay Sapra (d) none of these

Q26. main()
{ char a[]="AABBCC";
int i;
for(i=0;i<3;i++)
printf("%d",(int)a[i]);
}
(a) compilation error (b) 65 65 66 (c) 65 65 66 66 67 67 (d) 65 66 67

Q27. main()
{ char a[0];
printf("%d",sizeof(a));
}
(a) compilation error (b) 1 (c) 2 (d) 0

Q28. main()
{
char s[ ]={'a','b','c','n','c',''};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}

Q29. What will be the output of this program if I store 3 strings
at time of scanf( ). “Sanjay” “Jyotirmay” “Janmayjay”
main( )
{ char *q;
int j;
for (j=0; j<3; j++) scanf(“%s” ,(q+j));
for (j=0; j<3; j++) printf(“%c” ,*(q+j));
for (j=0; j<3; j++) printf(“%s” ,(q+j));
}
(a) S J J Sanjay Jyotirmay Janmayjay (b) S J J
(c) S J J Sanjay anjay njay (d) S J J SJJanmayjay JJanmayjay Janmayjay

Q30 main()
{
char *p;
p="%dn";
p++;
p++;
printf(p-2,300);
}

Q31. main()
{
char *p = “Iyqm”;
char c;
c = ++*p++;
printf(“%c”,c);
printf(“%s”,p);
}

Q32.
void main()
{ printf(“sizeof (void *) = %d n“, sizeof( void *));
printf(“sizeof (int *) = %d n”, sizeof(int *));
printf(“sizeof (double *) = %d n”, sizeof(double *));
printf(“sizeof(struct unknown *) = %d n”, sizeof(struct unknown*));
}

Q33. main()
{ char a[ ]={10,20,30,40,50,60,70,80};
char *ptr;
ptr=&(a+2)[5];
printf(“%d”,*ptr);
}

Q34.
main()
{
char *str;
str=(char*) malloc(12);
strcpy(str,”Jyotirmay”);
printf(“%s”,str);
str=(char*) realloc(str,22);
strcat(str,”Janmayjay”);
printf(“%s”,str);
}

Q35. main( )
{ static char *arr[ ]={ “sanjay”, “balou” , ”Janmay” , ”Jyotir” };
static char **ptr[ ]={ arr+3, arr+2, arr+1, arr};
char ***p=ptr;
**p++;
printf(“%s”,**p);
printf(“%s”,*--*++p);
printf(“%s”,*p[-2]+3);
printf(“%s”,p[-1][-1]+1);
}

Q36. What will be output if you will compile and execute the following c code?
void main()
{ int i=320;
char *ptr=(char *)&i;
printf("%d",*ptr);
}
(a) 320 (b) 1 (c) 64 (d) Compilation error

Q37. What will be output if you will compile and execute the following c code?
void main()
{ int array[]={10,20,30,40};
printf("%d",-2[array]);
}
(a) 60 (b) -30 (c) 60 (d) Garbage value (e) Compilation error

Q38. int main()
{ char str[] = "Programming";
printf("%s ",&str[2]);
printf("%s ",str);
printf("%s ",&str);
}

Q39. What will be output if you will compile and execute the following c code?
void main()
{ int i;
float a=5.2;
char *ptr;
ptr=(char *)&a;
for(i=0;i<=3;i++)
printf("%d ",*ptr++);
}
(a)0 0 0 0 (b)Garbage Garbage Garbage Garbage (c)102 56 -80 32 (d**)102 102 -90 64

Q40. What will be output if you will compile and execute the following c code?
void main()
{
printf("%s","c" "question" "bank");
}
(a) c question bank (b) c (c) bank (**d) cquestionbank (e) Compiler error

Q41. What will be the output of the following program
main( )
{ char a[ ]=”hello”, b[ ]=”hello”;
if(a==b)
printf(“String matched “);
else
printf(“String not matched”);
}

Q42. main( )
{
printf(“%c”, “abcde”[2]);
printf)”%c”,”abcde”+1)[2]);
}

Q43. main( )
{ printf(“%s”, &“abcde”[2]);
printf(”%s”,&”abcde”+1)[2]);
}

Q44. main()
{
static int a[3]={10,20,30},**c,****d;
int *b[]={a,a+1,a+2,a+3,a+4};
c=b;
d=&c;
++*++*c;
printf("%d %d %d",a[0],a[1],a[2]);
}

Q45 main()
{
static int a[3]={10,20,30},***d;
static int *b[]={a,a+1,a+2};
static int **c[]={b,b+1,b+2};
d=c;
++*++*++*d;
printf("%d %d %d",a[0],a[1],a[2]);
}

Q46. main( )
{
if(strcmp(&“abc”,&”abc”))
printf(“matched”);
else
printf(“not matched”);
}
(a) matched (b) not matched (c) no output (d) compilation error

Q47. main( )
{
if(strncmpi(“ramesh”,”RAMNARESH”,3))
printf(“matched”);
else
printf(“not matched”);
}
(a) matched (b) not matched (c) no output (d) compilation error

Q48. What will the output?
main( )
{
int array[ ] = {1, 2, 3, 5, 8, 13, 21, 34, 55};
int sum = 0,i;
for (i = 0; i < 4; i++)
sum += array[array[i]];
printf(“%d”,sum);
}

Q49. What will the output?
main()
{
char *p = NULL;
char *q = 0;
if (p)
printf(" p ");
else
printf("nullp");
if (q)
printf("qn");
else
printf(" nullqn");
}

Q50. int main()
{
int ary[4] = {1, 2, 3, 4};
int *p = ary + 3;
printf("%d %dn", p[-2], ary[*p]);
}

Q51. void main()
{
char a[10][5] = {"hi", "hello", "fellows"};
printf("%d", sizeof(a[1]));
}

Q52. What will be output of following program?
int main(){
char *ptr1 = NULL;
char *ptr2 = 0;
strcpy(ptr1," c");
strcpy(ptr2,"questions");
printf("n%s %s",ptr1,ptr2);
return 0;
}
(a) c question (b) c (null) (c) (null) (null) (d) Compilation error (e) none of these

Q53.
What will be output of following program?
int main(){
int a = 10;
void *p = &a;
int *ptr = p;
printf("%u",*ptr);
return 0;
}
(a) 10 (b) address (c) 2 (d) Compilation error

Q54. What will be output of following program?
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

Q55.What will be output of following program?
int main()
{
int a = 5,b = 10,c;
int *p = &a,*q = &b;
c = p - q;
printf("%d" , c);
return 0;
}
(a) 1 (b) 5 (c) -5 (d) Error (e) None of these

Q56. What will be output if you will compile and execute the following c code?
int main()
{
int a[2][4]={3,6,9,12,15,18,21,24};
printf("%d %d %d",*(a[1]+2),*(*(a+1)+2),2[1[a]]);
return 0;
}
(a) 15 18 21 (b) 21 21 21 (c) 24 24 24 (d) Error (e) None of these

Q57. What will be output if you will compile and execute the following c code?
int main()
{
char arr[]="C Question Bank";
char *p;
p+=3;
p=arr;
p+=3;
*p=100;
printf("%s",arr);
return 0;
}
(a) C question Bank (b) C quesdion Bank (c) C qdestion Bank (d) C q100estion Bank

Q58. What will be output the following c code?
int main()
{
int i;
char *arr[4] = {"C","C++","Java","VBA"};
char *(*ptr)[4] = &arr;
for(i=0;i<4;i++)
printf("Address of String %d : %un",i+1,(*ptr)[i]);
return 0;
}

Q59. What will be output the following c code?
int main()
{
int i;
char *arr[4] = {"C","C++","Java","VBA"};
char *(*ptr)[4] = &arr;
for(i=0;i<4;i++)
printf("String %d : %sn",i+1,(*ptr)[i]);
return 0;
}

Q60. What will be output the following c code?
int main()
{
int i;
char *arr[4] = {"C","C++","Java","VBA"};
char *(*ptr)[4] = &arr;
printf("%s",++(*ptr)[2]);
return 0;
}

Asked In C Anshul jain (9 years ago)
Unsolved Read Solution (4)
Is this Puzzle helpful?   (2)   (0) Submit Your Solution Arrays

(#M40155285) C QUESTION bitwise Keep an EYE Keep an eye puzzle Keep an eye puzzle

#include

int main()
{
printf("%d %dn", 32<0);
printf("%d %dn", 32>>-1, 32>>-0);
return 0;
}

Asked In C Anshul jain (9 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (5)   (1) Submit Your Solution

(#M40155286) C QUESTION bitwise Keep an EYE Keep an eye puzzle Keep an eye puzzle

#include

int main()
{
printf("%d %dn", 32<0);
printf("%d %dn", 32>>-1, 32>>-0);
return 0;
}

Asked In C Anshul jain (9 years ago)
Unsolved Read Solution (5)
Is this Puzzle helpful?   (8)   (5) Submit Your Solution Mathematical Reasoning

(#M40157217) OTHER QUESTION Pattern Program Keep an EYE Keep an eye puzzle Keep an eye puzzle

print this pattern
HEXAHEXA
HEX EXA
HE XA
H A

Asked In Other Anshul jain (9 years ago)
Unsolved Read Solution (1)
Is this Puzzle helpful?   (3)   (2) Submit Your Solution

(#M40155268) C QUESTION String Keep an EYE Keep an eye puzzle Keep an eye puzzle

#include

int main()
{
char *names[] = { "Suresh", "Siva", "Sona", "Baiju", "Ritu"};
int i;
char *t;
t = names[3];
names[3] = names[4];
names[4] = t;
for(i=0; i<=4; i++)
printf("%s,", names[i]);
return 0;
}

Asked In C Anshul jain (9 years ago)
Unsolved Read Solution (3)
Is this Puzzle helpful?   (0)   (1) Submit Your Solution Output
Keep an EYE (0)Interview Experience (261)
Solved Question (6040) UnSolved Question (153944)
Pages: 11
  • Login
  • Register

Resend

Sponsored Links

Advertisements

Challenger of the Day

no image
Dimple
India
Punjab
Time: 00:01:33
Points
19

Maths Quotes

GREAT PEOPLE LOVES MATHS . TO BE A GREAT PERSON YOU SHOULD LOVE MATHS

NAREN

"Maths is the queen of all sciences", Whatever rules your world ; "SHE" rules them!!!

Arun V K

Placed User Comments

M4Math helped me a lot.

Vipul Chavan 5 years ago

Thanks m4 maths for helping to get placed in several companies.
I must recommend this website for placement preparations.

yash mittal 5 years ago

Now enjoy Offline Access of latest Question.

Get M4maths app to avail expert's solution and latest selected questions.

Download m4maths app now

  • 2533K+Registerd user
  • 1774K+Engineers
  • 759K+MBA Asprirant
  • 3K+Enginnering College
  • 250+Company Exam
  • 150K+Interview Questions
  • Site Links
  • Home
  • Result
  • Today's Puzzle
  • Discussion Board
  • Maths Tricks
  • Advertise with us
  • Contact Us
  • Useful Info
  • Maths Quotes
  • Previous Puzzles
  • Prize
  • Privacy Policy
  • Disclaimer and Copyright
  • Terms and Conditions
  • Sitemap
  • Placement papers
  • TCS Placement Paper
  • HCL Placement Paper
  • INFOSYS Placement Paper
  • IBM Placement Paper
  • SYNTEL Placement Paper
  • TECHNICAL Interview
  • HR Interview
All rights are reserved to @m4maths.com