Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what does the following code do?
fn(int n,int p,int r)
{
static int a=p;
switch(n){
case 4:a+=a*r;
case 3:a+=a*r;
case 2:a+=a*r;
case 1:a+=a*r;
}
}
a.computes simple interest for one year
b.computes amount on compound interest for 1 to 4 years
c.computes simple interest for four year
d.computes compound interst for 1 year

Answers were Sorted based on User's Feedback



what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / vikraman85

Here a is declared as static,so it can't be re-initialized..

Is This Answer Correct ?    4 Yes 1 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / subbu

gives an error because at the time of initialization we
should not use variables, we can use only constants at the
time of initialization.

Is This Answer Correct ?    4 Yes 3 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / vignesh1988i

this code depends upon the value of 'n' actually....... if
the value is 4 the operation is differewnt... if 3 its
different..... so give the value of 'n'!

Is This Answer Correct ?    3 Yes 2 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / deepali

b

Is This Answer Correct ?    2 Yes 1 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / eswaran

initializer is a constant value..so its not possible to
change the value at run time..

Is This Answer Correct ?    1 Yes 0 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / mani thangaraj

I feel it as d.computes compound interest for one
year.because of switch statement any one of the four gets
executed .. and it seems to be C.I

Is This Answer Correct ?    0 Yes 0 No

what does the following code do? fn(int n,int p,int r) { static int a=p; switch(n){..

Answer / nila

d.computes compound interest for 1 year

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

wat is the meaning of c?

9 Answers   CTS, IBM, Wipro,


what would be the output of the following prog? Justify your answer? main() { unsigned char ch; unsigned char i; ch = -255; printf("%d",ch); i = -1; printf("%d",i); }

1 Answers  


What is the deal on sprintf_s return value?

0 Answers  


what is the output on the screen? int n; n=printf("my name is %d",printf("kiran %d",printf("kumar"))); printf("\n %d \n",n);

4 Answers   TCS,


write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.

0 Answers   Subex,


Write a c program to find, no of occurance of a given word in a file. The word is case sensitive.

2 Answers  


What are the different pointer models in c?

4 Answers  


Explain how can I convert a string to a number?

0 Answers  


Write a program in C to convert date displayed in gregorian to julian date

0 Answers   HCL, Wipro,


What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file

0 Answers  


1.what are local and global variables? 2.what is the scope of static variables? 3.what is the difference between static and global variables? 4.what are volatile variables? 5.what is the use of 'auto' keyword? 6.how do we make a global variable accessible across files? Explain the extern keyword? 7.what is a function prototype? 8.what does keyword 'extern' mean in a function declaration?

2 Answers   nvidia,


How are pointers declared in c?

0 Answers  


Categories