ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
study the code:
#include<stdio.h>
void main()
{
const int a=100;
int *p;
p=&a;
(*p)++;
printf("a=%dn(*p)=%dn",a,*p);
}
What is printed?
A)100,101       B)100,100       C)101,101  D)None of the 
above
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 1
d)None of the above
It will give compliation error at the line p=&a,pointer to 
integer cannot assign to const int
 
Is This Answer Correct ?    2 Yes 0 No
Santhoo035
[Nan]
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 2
D)
 
Is This Answer Correct ?    1 Yes 0 No
Guest
 
 
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 3
The Answer is C) a=101 and (*p)=101.

Since the variable is not directly accessed and it 
increments thru' the pointer, so the answer is valid
 
Is This Answer Correct ?    0 Yes 0 No
Venkataramani Kumar.t.b.
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 4
The answer is A)100, 101
 
Is This Answer Correct ?    1 Yes 0 No
Hima Bindu Sudhani
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 5
Ans: 100,100
 
Is This Answer Correct ?    0 Yes 0 No
Sathya.r
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 6
(d),because n treat as a chracter.
ans is 100n ,101n
 
Is This Answer Correct ?    0 Yes 0 No
Jitendra Kumar Arya
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 7
ouput will be c)a=101 (*p)=101
 
Is This Answer Correct ?    0 Yes 0 No
Divakar
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 8
D) NONE OF THE ABOVE 
COZ 
ANS IS A=101n (*p)=101n
to get this *p should be an constant pointer
 
Is This Answer Correct ?    0 Yes 0 No
Madhu
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 9
B)100,100
 
Is This Answer Correct ?    0 Yes 0 No
Manoj
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 10
answer is d)none of the above
bcoz in line p=&a it will gve error
 
Is This Answer Correct ?    0 Yes 0 No
Sridevi.halli
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 11
the answer is c) 101, 101

a constant variable can be accessed using a pointer to 
change the value because, during compilation the compiler 
cannot see that the pointer is changing a contant read only 
variable.

the same method can be applied over the private members in 
a c++ class also.
 
Is This Answer Correct ?    1 Yes 0 No
Abdur Rab
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 12
none of the above
pointer value of address increases it cant store its
original value
 
Is This Answer Correct ?    0 Yes 0 No
Biranchi Ranjan Parida
 
  Re: study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Answer
# 13
the output is 

       a=100n(*p)=101n
 
Is This Answer Correct ?    0 Yes 0 No
Sundar
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
how many header file is in C language ?  14
what is op? for(c=0;c=1000;c++) printf("%c",c); Trigent18
what is the use of a array in c  4
Every time i run a c-code in editor, getting some runtime error and editor is disposing, even after reinstalling the software what may be the problem?  2
What are the uses of pre-processor directives?  2
please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }  3
What are volatile variables?  1
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output? Ramco7
Two's compliment of -5 Adobe3
Given an array of numbers, except for one number all the others occur twice. Give an algorithm to find that number which occurs only once in the array.  4
write a Program to dispaly upto 100 prime numbers(without using Arrays,Pointer) Wipro7
What is false about the following A compound statement is a.A set of simple statments b.Demarcated on either side by curly brackets c.Can be used in place of simple statement d.A C function is not a compound statement. TCS1
value = 0xabcd; for (loop = 1; (value >> 1) & 1 | loop & 1; loop++) { foo(); if (loop & 1) value >>= 1; } how many times is foo() executed? Google5
HOW TO ANSWER IF ASKED " WHAT KIND OF A PERSON ARE YOU?" I NEED AN ANSWER THAT IMPRESS THE INTERVIEWER  2
C passes By value or By reference? Geometric-Software5
consider the following program sigment int n,sum=1; switch(n) { case 2:sum=sum+2; case 3:sum*=2; break; default:sum=0;} if n=2, what is the value of sum a.0 b.6 c.3 d.none TCS4
write a program for size of a data type without using sizeof() operator?  7
dibakar & vekatesh..uttejana here..abt ur reply for in place reversal of linked list..wats p stands for there?  1
How can I implement opaque (abstract) data types in C? What's the difference between these two declarations? struct x1 { ... }; typedef struct { ... } x2;  2
what is the output of the following code? main() { int I; I=0x10+010+10; printf("x=%x",I); } give detailed reason  3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com