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   To Refer this Site to Your Friends   Click Here
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
12. Look at the Code:
main()
{
int a[]={1,2,3},i;
for(i=0;i<3;i++)
{
printf("%d",*a);
a++;
}
}
Which Statement is/are True w.r.t the above code?
I.Executes Successfully & Prints the contents of the array
II.Gives the Error:Lvalue Required
III.The address of the array should not be changed
IV.None of the Above.
A)Only I   B)Only II       C)II & III          D)IV
 
 Question Submitted By :: Harsha
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 12. Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV
Answer
# 1
B)only 2
 
Is This Answer Correct ?    1 Yes 0 No
Rakesh
 
  Re: 12. Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV
Answer
# 2
error: wrong type argument to increment
 
Is This Answer Correct ?    0 Yes 0 No
Basha
 
 
 
  Re: 12. Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV
Answer
# 3
2
 
Is This Answer Correct ?    0 Yes 0 No
Fakkad
 
  Re: 12. Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV
Answer
# 4
2 gives the error because array name is nothing but a
constant pointer we cannot increment the constant pointer so
it will give error
 
Is This Answer Correct ?    0 Yes 0 No
Jaleelbaig
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
What is the purpose of Scanf Print, getchar, putchar, function?  2
AMMONG THE 4 STROAGE CLASSES IN C, WHICH ONE FASTEST? HCL9
what is differnence b/w macro & functions  1
char S; char S[6]= " HELLO"; printf("%s ",S[6]); output of the above program ? (0, ASCII 0, I,unpredictable) Mascot3
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } CitiGroup3
wap in c to accept a number display the total count of digit  4
What is the result main() { char c=-64; int i=-32 unsigned int u =-16; if(c>i){ printf("pass1,"); if(c<u) printf("pass2"); else printf("Fail2");} else printf("Fail1); if(i<u) printf("pass2"); else printf("Fail2") } a)Pass1,Pass2 b)Pass1,Fail2 c)Fail1,Pass2 d)Fail1,Fail2 e)none IBM7
i want to know aptitude questions,technical questions  1
what is the function of void main()?  4
What's wrong with "char *p; *p = malloc(10);"?  5
how many times of error occur in C  7
Explain in detail how strset (string handling function works )pls explain it with an example.  1
How to use c/c++ code in JAVA Satyam4
How many types of linked lists what are they? How many types of data structures?  3
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.  1
difference between semaphores and mutex?  1
why TCS selected more student in the software field from all institution. TCS3
what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; } Honeywell2
Can we write a program without main() function?  6
difference between memcpy and strcpy  1
 
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