GeekInterview.com
Series: Subject: Topic:

C# FAQs

Showing Questions 1 - 20 of 67 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

Find substring in string

Asked By: yrs_abhishek | Asked On: Apr 10th, 2013

Hi All, I have written the below program to find the substring in the string. in case one word coming multiple time how to handle this situation ? the below program retuning -1 as position which is wrong.

Code
  1. Input ("abhijit" , "jit")
  2. public int FindSubString(string strSuper, string strSub)
  3.         {
  4.             char[] charSuper = strSuper.ToCharArray();
  5.             char[] charSub = strSub.ToCharArray();
  6.  
  7.             //int position = -1;
  8.             for (int i = 0; i <= charSuper.Length - charSub.Length; i++)
  9.             {
  10.                 int counter = 0;
  11.                 for (int J = 0; J < charSub.Length; J++)
  12.                 {
  13.                     if (charSuper[i] != charSub[J])
  14.                         continue;
  15.                     else
  16.                     {
  17.                         i++;
  18.                         counter++;
  19.                     }
  20.                 }
  21.                 if (counter == charSub.Length)
  22.                     position = i - charSub.Length;
  23.             }
  24.             return position;            
  25.         }

How to fixi it ?

Second maximum number

Asked By: tmounika | Asked On: Nov 1st, 2012

How to find out second maximum number in c#?

Reference variable of interface

Asked By: krish3636 | Asked On: Oct 26th, 2012

It is possible to create the reference variable of an interface which is 100% abstract in nature.Then why it is not possible to create a reference of an abstract class?

How to clear screen using c# console application...?Like clrscr() in c++..!

Asked By: Kannan | Asked On: Nov 22nd, 2006

Answered by: Anuj Malik on: Oct 5th, 2012

Console.Clear(); its work absolute in c# "c# using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication9 { class stud...

Answered by: amreenkhader on: Jan 20th, 2012

To clear the screen we can use the clrscr() command followed by ; to clear the input given to the program

Define reflection

Asked By: kritisrivastava11 | Asked On: Sep 5th, 2012

What is reflection and assembly?

Answered by: Poornima on: Sep 12th, 2012

Fetching the assembly information at runtime

Wap on 3d matrix by using random function print o/p in a file.

Asked By: k.sampath kumar | Asked On: Jun 1st, 2012

Wap on 3d matrix by using random function print in a file. find the prime numbers from out put of above program. find the even numbers from o/p of 1st program. find the odd numbers from o/p of 1st program.

Multicast delegate

Asked By: sudheer5561 | Asked On: Aug 12th, 2010

What is multicast delegate? When it is used?

Answered by: swaraj on: May 12th, 2012

delegate is a type-safe pointer to a method

Answered by: neeraj deshwal on: Feb 22nd, 2012

Delegate is used like as a method for method.

Program in c#

Asked By: arnoba | Asked On: Nov 10th, 2011

Need a program to search a word with all its synonymous ex : if I write screen find all that match of screen , lcd, monitor ,------ and so on

How to convert string to integer without using any builtin functions ?

Asked By: Chandu | Asked On: Aug 2nd, 2007

Answered by: Pattiwack on: Nov 2nd, 2011

I tihnk they want to see if you can manually convert the string..."c# int nResult = 0; int nNeg = '-'; int nMin = '0'; int nMax = '9'; bool bNegate = false; for(int i =0; i < sStr...

Answered by: latapaka on: Oct 14th, 2008

string test = "100"; int test1 = Convert.ToInt32(test); Console.Write(test1); Console.Read();

Convert string to integer

Asked By: ntelluri | Asked On: Jan 9th, 2010

How to convert sting to integer without using library function?

Answered by: NCHALAKOVA on: Aug 29th, 2011

int myStr = Int32.Parse("-105");

C# constructor types

Asked By: pradeep_gupta49 | Asked On: Sep 16th, 2010

How many types of constructor are in c#? What are they?

Answered by: Chockolate on: Aug 22nd, 2011

C# supports two types of constructor.

1. A class constructor (static constructor)
2. An instance constructor (non-static constructor)

Ajax in c#

Asked By: Deepak Shelake | Asked On: Jul 24th, 2010

How to implement Ajax in c#?

Answered by: Ashish on: Jul 23rd, 2011

Download ajax toolkit. Add "AjaxControlToolkit.dll" to our project..

C# program to count first 50 number divisible by 3

Asked By: Shaikh Aamir | Asked On: Jul 3rd, 2011

How to write c# program to count first 50 number divisible by 3 or 4.How to write c# program to count first 50 number divisible by 3 and 4.

Answered by: Chaitrali Deshpande on: Jul 16th, 2011

Code
  1. int counter = 0;
  2. int no = 1;
  3. while(counter != 50)
  4. {
  5. if(no% 3 == 0)
  6. {
  7. counter++;
  8. no++;
  9. }
  10. else
  11. no++;
  12. }

Windows service

Asked By: Deepak Shelake | Asked On: Jul 24th, 2010

What is windows service? Can we develop windows service using c#? If yes, how? How to install or start windows service?

Wcf webservice and rest webservice

Asked By: Deepak Shelake | Asked On: Jul 24th, 2010

What is extension of file? What is wcf webservice? How to call webservice? How to call method of webservice? What is rest webservices?

Jscript use

Asked By: Deepak Shelake | Asked On: Jul 24th, 2010

What is the use of jscript? How to get value of input tag? How to change inner value of div tag from Javascript.

Debug c# web application

Asked By: Deepak Shelake | Asked On: Jul 24th, 2010

How to debug c# web application?

C# error - overload for method

Asked By: aarruunnaa | Asked On: Nov 27th, 2007

I took a button in form.I have two classes emp and bonus.Bonus class is inherited from emp class.If bonus is giving ie in dialog box if we select ‘yes’ b ie bonus is added to sal and we get ts ie total sal along with eno.If bonus is not given ie in dialog box if we select ‘no’ we need to get...

Answered by: bhanu supriya on: Jul 19th, 2010

Here you are passing parameters to the class itself...
You have to pass the parameters to method.

Answered by: sudhakarr.net on: Jul 11th, 2008

Hi aarruunnaa,You try this code, if it is useful for you send me reply otherwise ask me again dont hesitate class emp {public int eno,sal; public emp(){}public emp(int eno,int sal) {this.eno=eno;...

Declare two or more methods

Asked By: guruprasad.v | Asked On: Jul 20th, 2010

How to declare two or more methods in c# program..How to implement that methods in the c# program

C# static objects

Asked By: VishalD | Asked On: Jul 20th, 2010

How to create static objects in c#?

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.