Interview Questions MNC Companies in ASP.NET , C# and SQL

Questions

1. What will be the output of following query.

select top 2 1 '5'

2. Update the salary from 0 to 30000 by using join.

table

3. Insert all data from table a into table b without using & insert command.

4. Select emp_name & city without using like operator where emp_name starts with ‘R’ & city with ‘Pune’ in country table.

5. Most widely used conceptual model is:

  1. ER
  2. External
  3. Chen
  4. Attribute

6. What is surrogate key?

7. Global view of data.

  1. Master
  2. Model
  3. tempdb

8. Table store inforamtion about database or system is:

  1. Sql
  2. Master
  3. Nested

9. Write a query to select distinct records from table.

10. Where is table space located.

11. What is memory leak & how can we avoid it.

12. Which of the following is used to delete entire MYSQL database.

  1. Mysql_drop_database
  2. mysql_drop_entiredb
  3. Mysql_drop_db
  4. mysql_drop_dbase

13. The USE command ?

  1. It used to load code from another file.
  2. Has been deprecated & should be avoided for security reasons.
  3. Is a pseudonym for the SELECT command.
  4. Should be used to choose the databaseyou want to use once you have connected.

14. Select names which are not in ‘L’ ‘n’ ( these are the starting letters of names).

15. Replace “Ajit” with “sam” from employee table.

16. Which of the following are not a member of server object.

  1. Execute
  2. Transfer
  3. Open
  4. HTML Decode

17. Which of the following is not a keyword.

  1. if
  2. delegate
  3. private
  4. implements

18. What will be the output:

  1. public unsafe static void Main(string[] args) {  
  2.     int a = 45;  
  3.     int * p = & a; * p = 666;  
  4.     Console.WriteLine(a);  
  5.     Console.Readkey();  
  6. }  

  1. 45
  2. 666
  3. Garbage value
  4. Compile time error

19.

  1. string str = null;  
  2. var abcd = str.ToString();  

  1. Compile time error
  2. Run time error

20. Namespace can shared between two different solutions / projects.

  1. True
  2. False

21. What will be the output:

  1. class apple {  
  2.     enum Demo_enum {  
  3.         a, b, c, d, e, f  
  4.     };  
  5.     public static void Main() {  
  6.         Demo_enum i;  
  7.         for (i = Demo_enum.a; i < Demo_enum.f; i++)  
  8.             Console.WriteLine(i + " has value of: " + (int) i);  
  9.         Console.WriteLine();  
  10.         Console.ReadKey();  
  11.     }  
  12. }  

  1. Compile time error
  2. 0
  3. 0,1,2,3,4,5
  4. Run time error

22. What will be the output:

  1. class Divide_by_zero {  
  2.     static void Main(string[] args) {  
  3.         int[] my_array = {  
  4.             4, 5, 16, 80, 60, 900, 2000, 5555  
  5.         };  
  6.         int[] division = {  
  7.             2, 0, 4, 5, 0, 10  
  8.         };  
  9.         for (int i = 0; i < my_array.Length; i++) {  
  10.             try {  
  11.                 Console.WriteLine(" {0} ", +my_array[i] + " / " + division[i] + " is: " + my_array[i] / division[i]);  
  12.             } catch (Exception ex) {  
  13.                 Console.WriteLine(" {0} ", ex.Message);  
  14.             }  
  15.             Console.WriteLine();  
  16.         }  
  17.         Console.WriteLine(" thank you for doing code");  
  18.         Console.ReadLine();  
  19.     }  
  20. }  
23. What is the return type of constructors?

  1. int
  2. float
  3. void
  4. None of the mentioned

24. Correct statement about run time polymorphism is?

  1. The overridden base method should be virtual,abstract or override.
  2. An abstract method is implicitly a virtual method.
  3. An abstract inherited property cannot be overridden in a derived class.
  4. Both override method and virtual method must have same access level modifier.

25. What will be the output:

  1. public class Program {  
  2.     abstract class CBaseClass {  
  3.         public int iCount;  
  4.         public CBaseClass() {  
  5.             Console.WriteLine("Base class created");  
  6.             iCount = 20;  
  7.         }  
  8.         public virtual void add() {  
  9.             iCount += 10;  
  10.         }  
  11.         public virtual void add(int iAdd) {  
  12.             iCount += iAdd;  
  13.         }  
  14.         public void sub() {  
  15.             iCount -= 10;  
  16.         }  
  17.         public abstract void sub(int iSub);  
  18.         public override string ToString() {  
  19.             return base.ToString() + " -- Method of CBaseClass";  
  20.         }~CBaseClass() {  
  21.             Console.WriteLine("CBaseClass Deleted");  
  22.         }  
  23.     };  
  24.     class CDerived: CBaseClass {  
  25.         public CDerived() {  
  26.             Console.WriteLine("In CDerived Class");  
  27.             iCount = 30;  
  28.         }  
  29.         public override void add() {  
  30.             iCount += 20;  
  31.         }  
  32.         public void add(int iAdd) {  
  33.             iCount += iAdd;  
  34.         }  
  35.         public void sub() {  
  36.             iCount -= 50;  
  37.         }  
  38.         public sealed override void sub(int iSub) {  
  39.             iCount -= 30;  
  40.         }~CDerived() {  
  41.             Console.WriteLine("CDerived Class Deleted");  
  42.         }  
  43.     };  
  44.     static void Main(string[] args) {  
  45.         CDerived derivedObj = new CDerived();  
  46.         CBaseClass basePtr = new CDerived();  
  47.         CDerived notUsed;  
  48.         Console.WriteLine("1:" + derivedObj.iCount);  
  49.         derivedObj.add();  
  50.         Console.WriteLine("2:" + derivedObj.iCount);  
  51.         basePtr.add(30);  
  52.         Console.WriteLine("3:" + basePtr.iCount);  
  53.         basePtr.sub();  
  54.         Console.WriteLine("4:" + basePtr.iCount);  
  55.         basePtr.sub(20);  
  56.         Console.WriteLine("5:" + basePtr.iCount);  
  57.         Console.WriteLine("6: {0}", basePtr);  
  58.         Console.ReadKey();  
  59.     }  
  60. }  
Summary

This blog helps to fresher as well as experience candidates to crack the technical test rounds.

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now