ALLInterview.com :: Home Page            
 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                      
Google
   
 
Categories >> Software >> Microsoft Related >> C Sharp
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions (614)
 C Sharp interview questions  C Sharp Interview Questions (721)
 ASP.NET interview questions  ASP.NET Interview Questions (1442)
 VB.NET interview questions  VB.NET Interview Questions (150)
 COM+ interview questions  COM+ Interview Questions (41)
 ADO.NET interview questions  ADO.NET Interview Questions (198)
 IIS interview questions  IIS Interview Questions (86)
 MTS interview questions  MTS Interview Questions (5)
 Crystal Reports interview questions  Crystal Reports Interview Questions (62)
 BizTalk interview questions  BizTalk Interview Questions (33)
 Dot Net interview questions  Dot Net Interview Questions (861)
 Exchange Server interview questions  Exchange Server Interview Questions (103)
 SharePoint interview questions  SharePoint Interview Questions (25)
 WCF interview questions  WCF Interview Questions (8)
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions (193)
Question
1.write a program in C# to find a given point which is 
inside in a circle. Given circle's radius and its center 
point?
2.Write a program in C# to generated 20 prime numbers 
greater than a given number? (It should be more efficient 
for large numbers also)
3. Write a Code to check whether a given point is inside a 
circle or not? given Circle's raduis and its center point.
4. using oops concept, design an elevator do not forget 
buttons on each floor..
 Question Submitted By :: Saranyabalaraman
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 1.write a program in C# to find a given point which is inside in a circle. Given circle's radius and its center point? 2.Write a program in C# to generated 20 prime numbers greater than a given number? (It should be more efficient for large numbers also) 3. Write a Code to check whether a given point is inside a circle or not? given Circle's raduis and its center point. 4. using oops concept, design an elevator do not forget buttons on each floor..
Answer
# 1
answer for 3rd question
static void Main(string[] args)
{
Console.Write("Please Enter the radius of the circle : ");
int r = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please Enter the center of the circle ");
Console.Write("Please Enter x coordinate of the centre : ");
int x1 = Convert.ToInt32(Console.ReadLine());
Console.Write("Please Enter y coordinate of the centre : ");
int y1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please Enter the Point ");
Console.Write("Please Enter x coordinate of the point : ");
int x2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Please Enter y coordinate of the point : ");
int y2 = Convert.ToInt32(Console.ReadLine());
int check =Convert.ToInt32(Math.Sqrt(Math.Pow(x2-x1,2)+Math.Pow(y2-y1,2)));
if (check < r)
Console.WriteLine("Inside the Circle");
else if (check == r)
Console.WriteLine("On the Circle");
else
Console.WriteLine("Outside the Circle");
}
//don't enter centre of the circle and point (1,2) ,(5,6) like this enter each coordinate individually
 
Is This Answer Correct ?    5 Yes 1 No
Chandra Kiran
 
  Re: 1.write a program in C# to find a given point which is inside in a circle. Given circle's radius and its center point? 2.Write a program in C# to generated 20 prime numbers greater than a given number? (It should be more efficient for large numbers also) 3. Write a Code to check whether a given point is inside a circle or not? given Circle's raduis and its center point. 4. using oops concept, design an elevator do not forget buttons on each floor..
Answer
# 2
take 4 textboxes , cx=centre x, cy=centre y, r=radius,
x=x co-oridnate, y=y co-ordinate.
double d;

calculate the distnace between centre and point taken
if distance less than radius(inside) else outside

simple


d = Math.Sqrt(Math.Pow((int.Parse(cx.Text) - int.Parse(x.Text)), 2) + Math.Pow((int.Parse(cy.Text) - int.Parse(y.Text)), 2));


if (d <Double.Parse( r.Text))
Label1.Text = "inside";
else
Label1.Text = "outside";
 
Is This Answer Correct ?    3 Yes 0 No
Ganesh
 
 
 

 
 
 
Other C Sharp Interview Questions
 
  Question Asked @ Answers
 
1)what is difference between char and varchar in sql server 2005 2) what is composite key and candidate key 3) what is temporary table and derived table 4) how to calculate difference between two dates Wipro 1
Hello Friends..am Mohammed riyash..final year BCA in Jamal Mohamed College 2009. Trichy. My doubt is while connecting SQL2005 Built in Database withing the Visual Studio 2005 Framework.. I am getting the error.. That " An Error occurred and it may be due to , under the default settings of the Server, the connection cannot be established.." But the code works in MS Access for me.. Both in VB.Net and C#.Net am getting the same error.. Any genius please Message me to 9994558822 or mail me.. riyash.ips@gmail.com   3
what does static void Main(string[] args) in C# mean???????? ssinformatics 3
What is the Difference between directcast and ctype? Wipro 1
What’s difference between Association, Aggregation and Inheritance relationships? TCS 2
What is the difference between these statements obj=null and obj.dispose() Fulcrum-Logic 4
how to cleanup object that does not support dispose method? How to implement dispose for such scenarios? ITC-Infotech 1
if i want to transmit binary data,,,will it be support by Webservices or any exceptions ? define   2
What are Generics? TCS 5
What is short circuit logical evaluation? TCS 1
Oops concepts ? Digital-GlobalSoft 2
What is the difference between int.Parse() and Convert.toInt32().   2
 
For more C Sharp Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright © 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com