GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  TCS  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 13 of 87    Print  
read the folllowing code
# define MAX 100
# define MIN 100
....
....
if(x>MAX)
x=1;
else if(x<MIN)
x=-1;
x=50;
if the initial value of x=200,what is the vlaue after executing this code?
a.200
b.1
c.-1
d.50
D



  
Total Answers and Comments: 1 Last Update: February 10, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
February 10, 2006 16:24:36   #1  
laxmikanth        

RE: read the folllowing code# define MAX 100# ...
The ans is 50 irrespective of the initial value of x bcos at the end of the code we are overwriting the variable x with 50.
 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Here the statement if(x=6) is true because this is not a conditional operator it assigns 6 to x so it is true, the if condition is truethen y=7; ...

Read the function conv() given belowconv(int t){int u;u=5/9 * (t-32);return(u0;}What a.15b.0c.16.1d.29

Which of the following is not an infinite loop ?a.while(1){....}b.for(;;){...}c.x=0;do{/*x unaltered within the loop*/...}while(x==0);d.# define TRUE 0while(TRUE){....}

Read the folllowing code# define MAX 100# define MIN 100........if(x>MAX)x=1;else if(x

Given the piece of codeint a[50];int *pa;pa=a;to access the 6th element of the array which of the following is incorrect?a.*(a+5)b.a[5]c.pa[5]d.*(*pa + 5)

Latest Answer : I think value of y = 5.Because if you format the code, it will look like thisx = 10;y=5;if (x==10){}else if(x==9){}else{   y=8;}Since value of x is 10 so condition if (x==10) will satisfy. And there is no assignment for y. So value of y ...

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 yearb.computes amount on compound interest for 1 to 4 yearsc.computes simple interest for four year d.computes compound interst for 1 year

# define prod(a,b)=a*bmain(){int x=2;int y=3;printf("%d",prod(x+2,y-10)); }the output of the program is a.8b.6c.7d.none

Consider the following C codemain(){int i=3,x;while(i>0){x=func(i);i--;}int func(int n){static sum=0;sum=sum+n;return(sum);}the final value of x isa.6b.8c.1d.3

Latest Answer : scope of x=6 will take precedenc on x=7so y=7 ...


 Sponsored Links

 
Related Articles

ODP.NET - Handling Nulls when Executing with ExecuteScalar

ODP NET Handling Nulls when Executing with ExecuteScalar The most important issue to remember is that ExecuteScalar simply returns an object type of data The object refers to any data type within NET If the data type of your variable matches with the type of object returned by ExecuteScalar an impli
 

jQuery Table Row Finished Code

jQuery Table Row Finished Code The Finished Code Our second example page has demonstrated table row striping highlighting tooltips collapsing expanding and filtering Taken together the JavaScript code for this page is mosgoogle geshibot lang php&quot; document ready function var highlighted
 

jQuery Interacting with Other Code

jQuery Interacting with Other Code We learned with our sorting and paging code that we can t treat the various features we write as islands The behaviors we build can interact in sometimes surprising ways; for this reason it is worth revisiting our earlier efforts to examine how they coexist with t
 

jQuery Completed sorting and paging code

Learning jQuery The Finished Code The completed sorting and paging code in its entirety follows mosgoogle geshibot lang php&quot; fn alternateRowColors function tbody tr odd this removeClass even addClass odd ; tbody tr even this removeClass odd addClass even ; return this; ; document
 

How to define command line arguments

The main functions can have arguments passed which are called as command line arguments. There are two command line arguments: Argument count denoted by argc and Argument vector denoted by argv The argc is an integer variable which denotes the number of parameters passed and argv is pointer to a
 

How to Improve Your Vocabulary While You Read

How to Improve Your Vocabulary While You Read Reading is The Key Perhaps the best method you can use to improve your vocabulary is to read When I say read I m not just talking about comic books mainstream magazines or celebrity tabloids I m talking about reading materials that are actually challengi
 

How To Persuade Those Who Read Your Essays

How To Persuade Those Who Read Your Essays An essay is a document in which an author expresses his or her views on a particular subject Because of this essays tend to be documents in which you will want to persuade a reader to share your point of view mosgoogle Being able to successfully do this wil
 

How Code Reviews and PMD Can Crush Bugs In Your Code

How Code Reviews and PMD Can Crush Bugs In Your Code The ability to review your code is one of the best methods to find bugs and other issues which can cause your program to perform poorly In fact one of the hardest things about writing a program is debugging it When programmers get together and sha
 

Web 2.0 and The Read/Write Web

Web 2 0 and The Read Write Web One of the emerging themes of Web 2 0 is the ability for users to add data to web sites directly In Web 1 0 web content was managed by so called webmasters&rdquo; The webmaster would update HTML web pages using simple text editors like Notepad or advanced web
 

WebSphere V5.0 : Debugging - Step-through code

WebSphere V5 0 Debugging Step through code In this tutorial you will learn about WebSphere V5 0 Debugging Stepping through the execution of a Java program Step over Step into Run to return and Run to line mosgoogle Stepping through the execution of a Java program When a thread is suspended the step
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape