GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 424 of 431    Print  
C# Program to test efficient coding
You have several instances of the following class (User). Provide a class with three methods:
"AddUser" accepts a User instance as a parameter and add it to a collection.
"GetUser" accepts a UserID as a parameter and returns the corresponding User instance. It is important that this executes quickly as it will be used often.
"GetOrderedUserArray" returns an array of User instances ordered by UserID. It is important that this executes quickly as it will be used often.

public class User
{
public int UserID;
public string FamilyName;
public string GivenName;

public User(
int userID,
string familyName,
string givenName)
{
UserID = userID;
FamilyName = familyName;
GivenName = givenName;
}
}



  
Total Answers and Comments: 0 Last Update: June 17, 2008     Asked by: netacct 
  
 Sponsored Links

 

No answers are posted for this question yet.
Be the first to answer it!


 Related Questions

C# does not support an explicit fall through for case blocks. The following code is not legal and will not compile in C#: switch(x){case 0:// do somethingcase 1:// do something in common with 0default:// 
Latest Answer : c# switch allows fall through if and only if in empty case. as long as there is a statement in the case it must  use break or go to to  jump out of the case. ...

The most common problem is that you used a lowercase 'm' when defining the Main method. The correct way to implement the entry point is as follows: class test {static void Main(string[] args) 
Latest Answer : class test   {  public test() { } public static void Main(string[] args) {}  }   modifier for Main is public and inside the clas default constructor is necessary ...

From language spec:The list of similarities between classes and structs is as follows. Longstructs can implement interfaces and can have the same kinds of members as classes. Structs differ from classes 
Latest Answer : Following are the main points of difference between classes and structs in C#:Value type vs Reference type: Structs are value type and classes are reference type. Whenever a struct object is assigned to another struct object a copy is created. In case ...

StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it is being operated on, a new instance is created.  
Latest Answer : Ans:Yes,it is right.Answer: StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it is being operated on, a new instance is created. function checkf(form) { var f = document.form1;if ...

In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true. 
Latest Answer : Ans:In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true. ...

Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).  
Latest Answer : Ans:Yes,It is corect.Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly). ...

.NET FRAMEWORK1. What is .NET Framework?The .NET Framework has two main components: the common language runtime and the .NET Framework class library.You can think of the runtime as an agent that manages 
View Question | Asked by : Prasanna Muthukrishnan

Skill/Topic: BeginnerA) csc.exeB) csharp.exeC) compilescs.exe 
Latest Answer :  The ans is csc.exe ...

Skill/Topic: BeginnerA) main()B) Main()C) Enter() 
Latest Answer : Ans:B) Main() ...

Skill/Topic: IntermediateA) ClassB) NamespaceC) Program 
Latest Answer : Namespace ...


 Sponsored Links

 
Related Articles

How to develop compile and run a C program

The steps involved in building a C program are: 1. First program is created by using any text editor and the file is stored with extension as .c 2. Next the program is compiled. There are many compilers available like GNU C compiler called as gcc, Sun compiler, Borland compiler which is pop
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

Creating an Efficient Process for Data Warehouses

Creating an Efficient Process for Data Warehouses Since data warehouses were first introduced during the 1990s a large number of companies have failed when attempting to implement and use them Many of these failures are not a result of the data warehouse itself but rather the policies and the proces
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

HR Interview - How To Prepare For Your HR Interview

How To Prepare For Your HR Interview Before you begin thinking about how you are going to dress for the interview it is important to do your research first You should learn everything you can about the company you wish to work for When you have detailed information about your employer you will conve
 

HR Interview - Telephone Interview Etiquette

Telephone Interview Etiquette When you conduct a telephone interview for a job it is important to show the proper etiquette Not only is it important it is critical is you wish to be hired by the company There are a number of things you will want to do and other things should never be done mosgoogle
 

HR Interview - How To Succeed At HR Interviews

How To Succeed At HR Interviews There are a number of things you will need to do in order to make sure you pass the interview process Your appearance is something that you will want to pay close attention to Even if you feel that your appearance shouldn t be a factor in whether or not you re highere
 

Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape