Saturday, 10 March 2018
To know Compatibility Level of DB in SQL
SELECT compatibility_level
FROM sys.databases WHERE name = 'srs1';
ALTER DATABASE srs1
SET COMPATIBILITY_LEVEL = 100
FROM sys.databases WHERE name = 'srs1';
ALTER DATABASE srs1
SET COMPATIBILITY_LEVEL = 100
Interview Questions faced in 2018 on MS.NET
SQL Server:
1. How will you get same result as Union All of table(tblA and tblB) with out using Union All?
2. Differents between Temp Table and Table Variable?
3.What is Unique key?
4.What is Primary key?
5.Differents between Function and SP?
6.Differents between Group by, Partition and Rank in SQL?
7.How to update two different table's column at same time using same query?
8.How to update one table's column as bit, update 0 to 1, 1 to 0 at same time?
Eg.
column1
0 to 1
1 to 0
Capgemini
9.What is Index?
10.How many types of Indexes?What are they?
11.How many Cluster Index will you able create in one table?
12.How many Non Cluster Index will you able create in one table?
http://sql-plsql.blogspot.in/2013/08/multiple-choice-questions-sql-indexes.html
13.Differents between Function and SP?
14.How to handle Exception in SQL?
15.What is Transaction in SQL?
Example:
16.Write a query to get Max Salary of employee in SQL Server?
Answer:
select * from(
select row_number() over (order by salary) as sal_level,Salary from #tempEmp) A
where A.sal_level=10
17.How to Execute Function to see the result in SQL?
Answer:
declare @aaa varchar(50)
select @aaa= dbo.Func_1(904977, '2018-02-25 00:00:00.000')
select @aaa
Go
select dbo.Func_1(904977, '2018-02-25 00:00:00.000')
OOPs :
1.What is Polymerphism?
2.Differents between Overloading and Overriding?
3.What is Static class?
4.What is Constructor?
5.Is it possible to use Static with Sealed Class?
6.What is Copy Constructor?
7.Differents between ref and out parameter?
8.How Destructor internally used?
Capgemini
9.What is Abstract in c#?
10.What is Polymerphism?
C#:
1.What is Anonymous function?
2.what is 'using' and where do you used it in c#?
3.What is IList and List in c#?
4.What is IEnumerable in c#?
5.What is IQuerable in c#?
6.What is LINQ in c#?
7.What is Collection in c#?
8.What is Generic in c#?
HCL
9.Example of Multiple Inheritance in c#?
Dell
10.Why String and string?
11.You have two .cs file, (A.cs and B.cs file), so how will you get classes of A.cs in to B.cs?
JQuery:
1.Differents between DataType and ContentType?
HCL
2.You have 5 hyper link and 5 Paragraph, Onclick particular hyperlink only show related Paragraph others should hide?
Dell
3.Differents between JS and JQuery?
JavaScript:
Dell
1.Differents between JS and JQuery?
2.Write a query to check palindrome in JS?
3.What is the Pageload function in JS?
//JS
<script type="text/javascript">
function SomeFunction() {
/* do stuff on page load */
}
window.onload = SomeFunction;
</script>
// jQuery
<script type="text/javascript">
SomeFunction();
</script>
$(document).ready( function () {
SomeFunction();
});
CSS:
Capgemini
1.What is Z-Index?
2.What is 'absolute'?
Hint: In Position we use absolute.
-2
-1
Z-Index:0(default)
1
2
Logical:
HCL
1.Write a logic to check Palindrome?
2.Write a logic to Reverse string with out using Array and any Built in function?
3.* Pattern?
Karvy:
1.How do you know that Class/Method is belongs to particular Interface?
Eg:
Interface A
{
int Add(int A,int B)
}
Interface B
{
int Add(int A,int B)
}
Class A:Interface A,Interface B
{
Here how do you know below class is belongs to Interface A or Interface B?
public int Add(int A,int B)
{
return A+B;
}
}
2. Can you able to create instance of Interface?
3.What are the J Query properties, and how to disable textbox?
4.Serialization and De-serialization in c#?
5.How to send data from Controller to Controller in MVC?
Savvy It Solution:
1. Syntax of Session?
2. Differences between Abstract and Interface, when to use Abstract and Interface?
3. How to send data from View to Controller and vice versa?
4. How to send data from Controller to Controller and vice versa?
5. Sql: Write a query to get Super Manager of an Employee?
Eg: Emp table
EmpId EName MgrId
100 Subs 400
400 Naresh 300
300 Venkat 200
200 Pani 100
100 Kumar Null
So here Mgr of ' Employee Subs' is Naresh, and Super Mgr is 'Employee Venkat'.
Ans:
Select A1.* from #tblTemp A1 --3rd Inner Join(To get third super MgrId of Emp)
inner join
(Select E1.* from #tblTemp E1 --2nd Inner Join(To get second super MgrId of Emp)
inner join
(Select Emp1.Ename,Emp1.MgrId --1st Self Join(To get first MgrId of Emp)
from #tblTemp Emp1,#tblTemp Emp2
where Emp1.EId=Emp2.MgrId
and Emp1.EId=100) E2 on E2.MgrId=E1.EId) A2 on A2.MgrId=A1.Eid
1. How will you get same result as Union All of table(tblA and tblB) with out using Union All?
2. Differents between Temp Table and Table Variable?
3.What is Unique key?
4.What is Primary key?
5.Differents between Function and SP?
6.Differents between Group by, Partition and Rank in SQL?
7.How to update two different table's column at same time using same query?
8.How to update one table's column as bit, update 0 to 1, 1 to 0 at same time?
Eg.
column1
0 to 1
1 to 0
Capgemini
9.What is Index?
10.How many types of Indexes?What are they?
11.How many Cluster Index will you able create in one table?
12.How many Non Cluster Index will you able create in one table?
http://sql-plsql.blogspot.in/2013/08/multiple-choice-questions-sql-indexes.html
13.Differents between Function and SP?
14.How to handle Exception in SQL?
15.What is Transaction in SQL?
Example:
CREATE PROCEDURE UpdateSales
@SalesPersonID INT,
@SalesAmt MONEY = 0
AS
BEGIN
BEGIN TRY
BEGIN TRANSACTION;
UPDATE LastYearSales
SET SalesLastYear = SalesLastYear + @SalesAmt
WHERE SalesPersonID = @SalesPersonID;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION;
DECLARE @ErrorNumber INT = ERROR_NUMBER();
DECLARE @ErrorLine INT = ERROR_LINE();
DECLARE @ErrorMessage NVARCHAR(4000) = ERROR_MESSAGE();
DECLARE @ErrorSeverity INT = ERROR_SEVERITY();
DECLARE @ErrorState INT = ERROR_STATE();
PRINT 'Actual error number: ' + CAST(@ErrorNumber AS VARCHAR(10));
PRINT 'Actual line number: ' + CAST(@ErrorLine AS VARCHAR(10));
RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
END CATCH
END;
16.Write a query to get Max Salary of employee in SQL Server?
Answer:
select * from(
select row_number() over (order by salary) as sal_level,Salary from #tempEmp) A
where A.sal_level=10
17.How to Execute Function to see the result in SQL?
Answer:
declare @aaa varchar(50)
select @aaa= dbo.Func_1(904977, '2018-02-25 00:00:00.000')
select @aaa
Go
select dbo.Func_1(904977, '2018-02-25 00:00:00.000')
OOPs :
1.What is Polymerphism?
2.Differents between Overloading and Overriding?
3.What is Static class?
4.What is Constructor?
5.Is it possible to use Static with Sealed Class?
6.What is Copy Constructor?
7.Differents between ref and out parameter?
8.How Destructor internally used?
Capgemini
9.What is Abstract in c#?
10.What is Polymerphism?
C#:
1.What is Anonymous function?
2.what is 'using' and where do you used it in c#?
3.What is IList and List in c#?
4.What is IEnumerable in c#?
5.What is IQuerable in c#?
6.What is LINQ in c#?
7.What is Collection in c#?
8.What is Generic in c#?
HCL
9.Example of Multiple Inheritance in c#?
Dell
10.Why String and string?
11.You have two .cs file, (A.cs and B.cs file), so how will you get classes of A.cs in to B.cs?
JQuery:
1.Differents between DataType and ContentType?
HCL
2.You have 5 hyper link and 5 Paragraph, Onclick particular hyperlink only show related Paragraph others should hide?
Dell
3.Differents between JS and JQuery?
JavaScript:
Dell
1.Differents between JS and JQuery?
2.Write a query to check palindrome in JS?
3.What is the Pageload function in JS?
//JS
<script type="text/javascript">
function SomeFunction() {
/* do stuff on page load */
}
window.onload = SomeFunction;
</script>
// jQuery
<script type="text/javascript">
SomeFunction();
</script>
$(document).ready( function () {
SomeFunction();
});
CSS:
Capgemini
1.What is Z-Index?
2.What is 'absolute'?
Hint: In Position we use absolute.
-2
-1
Z-Index:0(default)
1
2
Logical:
HCL
1.Write a logic to check Palindrome?
2.Write a logic to Reverse string with out using Array and any Built in function?
3.* Pattern?
Karvy:
1.How do you know that Class/Method is belongs to particular Interface?
Eg:
Interface A
{
int Add(int A,int B)
}
Interface B
{
int Add(int A,int B)
}
Class A:Interface A,Interface B
{
Here how do you know below class is belongs to Interface A or Interface B?
public int Add(int A,int B)
{
return A+B;
}
}
2. Can you able to create instance of Interface?
3.What are the J Query properties, and how to disable textbox?
4.Serialization and De-serialization in c#?
5.How to send data from Controller to Controller in MVC?
Savvy It Solution:
1. Syntax of Session?
2. Differences between Abstract and Interface, when to use Abstract and Interface?
3. How to send data from View to Controller and vice versa?
4. How to send data from Controller to Controller and vice versa?
5. Sql: Write a query to get Super Manager of an Employee?
Eg: Emp table
EmpId EName MgrId
100 Subs 400
400 Naresh 300
300 Venkat 200
200 Pani 100
100 Kumar Null
So here Mgr of ' Employee Subs' is Naresh, and Super Mgr is 'Employee Venkat'.
Ans:
Select A1.* from #tblTemp A1 --3rd Inner Join(To get third super MgrId of Emp)
inner join
(Select E1.* from #tblTemp E1 --2nd Inner Join(To get second super MgrId of Emp)
inner join
(Select Emp1.Ename,Emp1.MgrId --1st Self Join(To get first MgrId of Emp)
from #tblTemp Emp1,#tblTemp Emp2
where Emp1.EId=Emp2.MgrId
and Emp1.EId=100) E2 on E2.MgrId=E1.EId) A2 on A2.MgrId=A1.Eid
Get 10th/nth Max salary of employee in SQL Server
Example:
create table #tempEmp(empid int identity(1,1),Salary money)
insert into #tempEmp
select 500
union
select 550
union
select 1000
union
select 1500
union
select 2000
union
select 2500
union
select 3000
union
select 3500
union
select 4000
union
select 4500
Here the Query to get 10th/nth Max salary of Employee
select * from(
select row_number() over (order by salary) as sal_level,Salary from #tempEmp) A
where A.sal_level=10
2.Second way to get the same
select max(sal) from #temp where sal in(select top 10 sal from #temp order by sal desc)
create table #tempEmp(empid int identity(1,1),Salary money)
insert into #tempEmp
select 500
union
select 550
union
select 1000
union
select 1500
union
select 2000
union
select 2500
union
select 3000
union
select 3500
union
select 4000
union
select 4500
Here the Query to get 10th/nth Max salary of Employee
select * from(
select row_number() over (order by salary) as sal_level,Salary from #tempEmp) A
where A.sal_level=10
2.Second way to get the same
select max(sal) from #temp where sal in(select top 10 sal from #temp order by sal desc)
Subscribe to:
Posts (Atom)