C# Interview questions for Automation Engineer
a)
Write the C# code to solve
each problem.
b)
Use appropriate string
manipulation methods and programming constructs to accomplish the given tasks.
c)
Test your code with
different inputs to ensure correctness.
d)
Once you have completed the
test, review your code for any improvements.
e)
Submit your code for
evaluation.
Console Input/Output :
1.
Write a program to display welcome message to
the user
2.
Write a program asking for
the username and printing the user name along with welcome message
Data Types :
1.
Write a program that
calculates the sum, difference, product, and quotient of two given numbers.
Prompt the user to enter the numbers and display the results
2.
Write a program that
prompts the user to enter a decimal number and rounds it to the nearest
integer. Display the rounded value
3.
Write a program that
prompts the user to enter a binary number and converts it to its decimal
representation. Display the decimal equivalent.
4.
Write a program that
prompts the user to enter their name and age. Display the entered values with
appropriate labels.
String :
1.
Write a program that
replaces all occurrences of a given word in a sentence with another word.
Prompt the user to enter a sentence, the word to be replaced, and the
replacement word. Display the modified sentence.
2.
For above problem count the
number of Replacements and the total number of words in the sentence.
3.
Capitalizes the first
letter of each word in the sentence
4.
Counts the number of vowels
(a, e, i, o, u) in each string
5.
Write a program that
prompts the user to enter a sentence and displays the sentence in uppercase.
Loops and Array :
1.
Write a program that
prompts the user to enter five numbers and stores them in an array. Display the
sum of the numbers.
2.
Write a program that counts
the number of even and odd numbers in array of integers. Display the counts.
3.
Write a program that
prompts the user to enter a sentence and splits it into an array of words.
Display the number of words in the sentence.
4.
Write a program that
multiplies each element in array of integers by a given factor. Prompt the user
to enter the factor and display the modified array.
5.
Make a FIFO pipeline with
actions like Push, Pop, Replace, Delete.
6.
Write a program to print
the below format and reverse of it
*
**
***
****
Collections(List, Set, Maps) :
1.
Write a program that prompts the user to enter five names and
stores them in a List<string>. Display the names in reverse order.
2.
Write a program that counts the frequency of each word in a
given sentence using a Dictionary<string, int>. Prompt the user to enter
a sentence and display the word frequency.
Exception handling(try/catch) :
1.
Write a program that prompts the user to enter two numbers
and divides them. Handle the exception if the user enters an invalid number or
attempts to divide by zero. Display an appropriate error message.
2.
Write a program that prompts the user to enter their age.
Handle the exception if the user enters a negative value or a non-numeric
input. Display an appropriate error message
3.
Write a program that prompts the user to enter their username
and password. Handle the exception if the user enters an incorrect password
three times consecutively. Display an appropriate error message.