0% found this document useful (0 votes)
1 views4 pages

Interview Questions .NET Developer

The document outlines the details for a .Net Developer candidate test, including instructions, written and practical sections with specific questions and tasks. The written section covers topics such as structs in C#, LINQ queries, and background operations in .NET applications, while the practical section requires the creation of a web form application with user signup, login, and weather data display functionalities. Each section has allocated marks and emphasizes the importance of understanding the questions.

Uploaded by

Kaleem Shahzad
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views4 pages

Interview Questions .NET Developer

The document outlines the details for a .Net Developer candidate test, including instructions, written and practical sections with specific questions and tasks. The written section covers topics such as structs in C#, LINQ queries, and background operations in .NET applications, while the practical section requires the creation of a web form application with user signup, login, and weather data display functionalities. Each section has allocated marks and emphasizes the importance of understanding the questions.

Uploaded by

Kaleem Shahzad
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CANDIDATE DETAILS

Name: Post Applied For: .Net Developer


Contact No: Language: C#
(For office use only)
Total Marks: 40 Obtained Marls:
Instructions:
 This test contains descriptive questions as well as one liner questions.
 Time allowed for written test is 60 minutes and for practical test maximum 2.5 hours allowed (grace time
30 minutes allowed).
 Each question carries different marks based on the requirement.
 Understanding of questions is the part of test.

Written Section [Total Marks: 20]

1. Explain the role of structs in C#. Why would you choose to define a type as a struct instead of a
class? [3 Marks]
ANS:
A Struct in C# is a value type designed to represent small data, its primary role is to model values
rather then objects with identity.

structs avoid heap allocation and garbage collection, making them ideal for representing the simple
values for complex objects, shared state or interference, I always prefer a class

2. Predict the output of the code below. [4 Marks]

public class Program


{
delegate void Iterator();
static void Main(string[] args)
{
List<Iterator> iterators = new List<Iterator>();
for(int i = 0; i < 15; i++)
{
[Link](delegate { [Link](i); });
}
foreach(var iterator in iterators)
{
iterator();
}
}
}
The anonymous delegate captures the variable i by reference not its value. By the time the
delegates are executed the for loop has finished and i equals 15. So every delegate prints the
same final value of i.

3. List<int> rollNumbers = new List<int> { 15,5,10,100,8,1,20}; [3 Marks]


a. Write LINQ Query To:
i. Retrieve All Roll Numbers greater than or equal to 10
ii. Retrieve All Roll Numbers List in Ascending Order
iii. Retrieve List of Roll Numbers skipping first 3

i var result1 = [Link](n => n>= 10).toList();


ii var result2 = [Link](n => n).toList();
iii var result3 = [Link](3).toList();

4. How are the different background operations carried out in Windows Form/ (Any .net based
app) also write about Lifecycle? [4 Marks]
Background operations help to keep the user Interface responsive, if need to perform heavy task
like complex calculation, downloading large file it will runs on background and won’t freezes the
main thread.

Methods to carry out background operations:


i Background worker: A normal way to run the operation on a separate thread.
ii Task parallel library: Using [Link]() or async/await

Life cycle:

i Initialization of the Thread.

ii Execution of the Thread.

Iii Completion of the Thread.

5. Write a query to fetch employee names (replace hyphen with space) and salary records.
Display the employee details even if the salary record is not present for the employee.
[6 Marks]

EmployeeDetails:
EmpId FullName ManagerId DateOfJoining City
121 John-Snow 321 01/31/2014 Toronto
321 Jamshed-Ali 986 01/30/2015 Pakistan
421 Qasim 876 27/11/2016 Kharian
EmployeeSalary:
EmpId Project Salary Variable
121 P1 8000 500
321 P2 10000 1000

SELECT
REPLACE([Link], '-', ' ') AS EmployeeName,
[Link],
[Link]
FROM
EmployeeDetails e
LEFT JOIN
EmployeeSalary s ON [Link] = [Link];

Practical Section [Total Marks: 30]


1. Practical Question: [Marks 20]

Create a Single Window form/Web Form Application Project which Contains Following:

a. Signup With SQL Server Local Database. [Marks 9]


i. Take Username, Contact No. Password and type (Admin, Customer) as input.
ii. Password must be stored in DB as SHA256 Encrypted Format and should be
used while logging in.
iii. Duplicate username should not be allowed in signup process.

b. Login Using SQL Database [Marks 4]


i. If type is Admin, then redirect user to Point C otherwise redirect to Point D.
ii. If username or password is not matched, then show error using dialog

c. Dashboard Form Containing: Take City as input from user and shows current weather
Data of provided city using following weather API. [Marks 10]
[Link]

d. Create New Form Containing Following: [Marks 7]


*[Minimum 2 LINQ Queries Must be used To Complete Below Provided Tasks]
i. Welcome user with greeting text on top of new form as “Welcome
Customer_User_Name”
ii. Place a label where Current City Name is shown automatically when user lands
on page.
iii. Display weather data of current city by getting current location.

You might also like