DEV Community

Shivansh Srivastava
Shivansh Srivastava

Posted on

Interview Experience--- OSource Software Developer 6-8 LPA 2YOE 29/11/24

1. i) diff bw Abstraction and Encapsulation and ii) write the code for them iii) explain

my code--

class Employee{

private string name; //encapsulation
public string Name{
get{return value ;}
set{name=value};
}
}

abstract class Shape{
{
public abstract void Draw()
}
{
class circle :Shape
public override void Draw(){
Console.WritLine("drawing Circle");
}
}

can abstract class have non abstract methods

Do u know virtual keyword when and how to use

for Given Code
public interface A { public void MethodA(); }
public interface B { public void MethodB(); }
public class C : A,B
{

}

How to replace this interface to classes and all code .

my ans---
public class A { public void MethodA(); }
public class B { public void MethodB(); }
public class C : A
{

}
pubic class c : B
{

}

How you do exceptional handling . why finally . What we write inside in finally block.

string s="shivansh";
char[] result=new char[s.Length];

for(int i=0;i<s.Length;i++){
result[]=s[i];
}

return string(result);

What is diff between datatable and datareader

Null query Execute

Constant and static difference

have you worked on webforms

write a query to fetch top 3 names from a table

i wrote this ------- subqueryy select Max(c1) from t1 where c1 (select max(c1) from t1 where c1<(select c1) from t1))

SELECT TOP 3 CustomerName
FROM customers

write program to reverse a string

string s="shivansh";
char[] ans=new char[s.Length];
for(int i=0;i<s.Length;i++)
{
ans[i]=s[s.Length-1];

}

return string(ans);

*Give Output not clear about the exact question but answered *

private string msg="hello";
public class Hey(){
Console.WriteLine(msg)
}

string msg="world";
Console.WriteLine(msg);

give Output

string s ="test";
for(int i=0;i<s.Length;i++)
{
string newS=s[i]+"";
Console.WriteLine(newS);
}

give output

in mvc project what is return type
not clear about the exact question but answered

my asnwwr was IActionResult

How to protect a class to be inherited

my ans was sealed keyword

there is 2 same name class can we inherit one from another

About Stored Procedure how to replace stored Procedure

Result yet to come -- my feeling ---negative

Top comments (0)