Basic Interview Questions For .Net Full Stack Developer

I am trying to list down some interview question which I found. It's  basic but important as there are many questions which are tricky. 
 
Consider the below table,
  1. Employee  
  2. ===========  
  3. ID  
  4. Name  
  5. DeptID  
  6. Status  
  7. ManagerEmpID  
  8. Salary  
Q 1
 
What is the output of this query?
  1. select Name from employee order by 2 desc  
Q 2
 
Find the largest 7th Salary from the above table
 
Consider another table
  1. Dept  
  2. ========  
  3. ID  
  4. Name  
Q 3
 
Write a query for the below output  
 
 Department Name  No. Of employee
 HR  28
 Admin  40
 IT  35
 
Q 4
 
Write a query for the below output. if there is no employee for the department then show 0
 
Department Name No. Of employee
HR 28
Admin 40
IT 35
Finance 0
 
Q 5
 
What will happen when we run the below code
  1. BEGIN TRAN  
  2. TRUNCATE TABLE Employees  
  3. ROLLBACK  
  4. SELECT * FROM Employees  
Q 6
 
What is the output of the below query?
  1. Select * from Employee, Dept  
Q 7
 
What is the output of the below code:
  1. var x;  
  2. x = 10;  
  3. Console.WriteLine("x");   
Q 8
 
What is the output of the below code snippet when it gets executed?
 
Basic Interview Questions For Dotnet Full stack 
 
Q 9
 
What is the output of the below code snippet when it gets executed?
 
Basic Interview Questions For Dotnet Full stack 
 
Q 10
 
What is the output of the below code snippet when it gets executed?
 
Basic Interview Questions For Dotnet Full stack 
 
Q 11
 
What is the output of the below code snippet when it gets executed?
 
Basic Interview Questions For Dotnet Full stack 
 
Q 12
 
What is the output of the below JavaScript statement?
  1. console.log(1 + "2" + "2");  
Q 13
 
What is the output of below code. Also which statement is fast?
  1. Document.getElementById("logo");  
  2. or  
  3. $("#logo");   
Q 14
 
What is the difference between document.ready() and window.onload()
 
Q 15
 
What is the output of the below C# code:
  1. string nullString = (string)null;  
  2. Console.WriteLine (nullString is string);  
Q 16
 
In Entity framework code-first approach if we do not want to create any column of the table what are the ways to achieve this?
 
Q 17
 
Fix the Bug 
  1. function average(a, b) {  
  2.   return a + b / 2;  
  3. }  
  4.   
  5. console.log(average(2, 1));  
Q 18
 
Fix the Bug 
  1. using System;  
  2.   
  3. public class MathUtils  
  4. {  
  5.     public static double Average(int a, int b)  
  6.     {  
  7.         return a + b / 2;  
  8.     }  
  9.       
  10.     public static void Main(string[] args)  
  11.     {  
  12.         Console.WriteLine(Average(2, 1));  
  13.     }  
  14. }   
Q 19
 
You have the following property. How can you change its value from a constructor? 
  1. public int Foo {getset;}  
  2.   
  3. public MyClass(string name)  
  4. {  
  5.     Foo = 5;  
  6. }   
Q 20
 
What is the result of following code? 
  1. int i;  
  2. for(i=0; i<=10; i++)  
  3. {  
  4.     if((i%2) == 0)  
  5.     continue;  
  6.     writeline(i)  
  7. }   
Q 21
 
You have the following 2 lines of code. What is the difference between the two? 
  1. [TestCategory(nameof(MyClass) + "-UnitTest")] //Line A  
  2. [TestCategory($"{nameof(MyClass)} -UnitTest")] //Line B   
Q 22
 
You have the following code, but you get an index out of range exception for empty collection (customers). How can you fix that?  
  1. int? first = customers?[0].Orders.Count();  
Q 23
 
Write a query that selects userId and average session duration for each user who has more than one session. 
  1. TABLE sessions  
  2.     id INTEGER PRIMARY KEY,  
  3.     iserId INTEGER NOT NULL,  
  4.     duration DECIMAL NOT NULL  
Q 24
 
What is the difference between Equality Operator ( == ) and Equals() Method in C#.
 
Q 25
 
Refactor the Code,
  1. class Class1  
  2. {  
  3.     public Class1(){}  
  4.     public Class1(int val){}  
  5. }  
  6.   
  7. class Program  
  8. {  
  9.     static void Main(string[] args)  
  10.     {  
  11.         Class1 ref1 = new Class1();  
  12.     }  
  13. }  
Q 26
 
Fix the bug,
  1. function getMessageText() {  
  2.   return $('message').text;  
  3. }  
  4.   
  5. document.body.innerHTML = '<div id="message">The message</div>';  
  6. console.log(getMessageText());  
Q 27
 
What does .size() method of jquery returns?
 
Que 28
 
jquery.size() or  jquery.length Which is faster?
 
Que 29
 
What is the time period of this Cache object? 
  1. Cache["sample"]="New Cache";   
Que 30
 
Is it possible to change the value of a variable while debugging a C# application?
 
These are few questions which I have been asked in one of my interviews. These questions are basic but tricky. I have not posted the answer to any, while finding the answers to the  above questions you will get to know many things. Try to run the code and find the answers. I found many extra things/answers/concepts while finding the answers to the questions listed above.
 
__Happy Coding__


Blue Ocktopus Technology Systems Private Limited
Enabling revenue generation through brand loyalty and customer retention for enterprise retail and e