Tuesday, July 30, 2019

Interview Questions 1-2 Years

1 - 2 Years

C#

1. What is OOPS, please brief
2. How to implement multiple inheritance
3. What is encapsulation
4. Difference between encapsulation and Abstraction
5. Difference between var and dynamic
6. Difference between read-only and const
7. What is static class, What is static function?
8. What is extension Methods? Have you created any?
9. What is Dependency Injection? How many ways to implement it?
10. What is constructor chaining?
11. What is default constructor? Can I make database call from constructor?
12. What is private constructor?
13. How to call base class constructor from drived class?
14. How can we access private variable outside a class?
15. Difference between ref and out parameter?
16. Difference between IEnumerable and List?
Ans. IEnumerable is readonly
17. What is difference between IEnumerable and IQueryable?
Ans. IEnumerable executes in memory i.e. load all records and then apply filter. IQueryable will execute in database directly.
18. What is generic?
19. What is delegate?

MVC

1. Page life cycle
2. How many Filters?
3. How to implement Filters?
4. What is action result and how many types?
5. How to create a form in razor syntex?
6. What is authentication and authorization?
7. What is Model binding?
8. How to do model validations?


Web Api

1. Which protocol it works on?
2. What are Http verbs and which verb used for what purpose?
3. How to use multiple Get and multiple Post methods in a controller?
4. How many types of routings? Which you used?
5. How to enable CORS?

Javascript

1. It is multi threaded?
2. What are selectors?
3. What is promise?
4. Can we implement async await ?
5. What is fat arrow function?
6. What is spread operator?
7. Ajax?

Sqlserver

1. Why we use view?
2. Difference between View and SP?
3. Difference between Primary and Unique key?
4. Why SP execute faster?
5. How to optimize a SP?
6. What are triggers and its types
7. What is indexing?

Monday, July 29, 2019

Interview Questions 4+

4 + Years
---------

1. What is CDN
2. What is diamonds issue in asp. Net
3. What data contract in WCF
4. What is important components in WCF
5. Can we call WCF from angular
6. What rest call
7. How to extend the view
8. ACID Property in SQL

C#

1. Why we can't implement multiple inheritance using a class?
2. What is generic and what benefits?
3. What is delegate and its types?
4. What are SOLID principles?
5. Know any Design Patterns?
6. What is extension Methods? Have you created any?
7. What is Dependency Injection? How many ways to implement it?
8. Difference between encapsulation and Abstraction
9. Difference between var and dynamic
10. Difference between read-only and const
11. Difference between ref and out parameter?
12. What are collections?
12. What is constructor chaining?
13. What is default constructor? Can I make database call from constructor?
14. What is private constructor?
15. How to call base class constructor from drived class?
16. How can we update private variable outside a class?
17. Difference between IEnumerable and List? 
Ans. IEnumerable is readonly
18. What is difference between IEnumerable and IQueryable? 
Ans. IEnumerable executes in memory i.e. load all records and then apply filter. IQueryable will execute in database directly.

Web Forms

1. In which event of page cycle is the ViewState available?
2. Difference between Server.Transfer and Response.Redirect
3. What is ViewState? How long the items in ViewState exists?
4. Different Session state management options available in ASP.NET
5. Web application running without web.Config file?
6. Boxing and Unboxing?
7. File extension of web service? Ans. .asmx
8. Components of ADO.NET? Ans. Dataset, Data Reader, Data Adaptor, Command, connection
9. Difference between ExecuteScalar and ExecuteNonQuery? Ans. ExecuteScalar returns output and ExecuteNonQuery returns number of rows affected by the query.
10. 

MVC

1. Page life cycle
2. How to authenticate and authorize?
2. How many Filters? How to implement Filters?
5. What is action result and how many types?
5. A form and a submit button. How to prevent form submit?
6. What is difference between authentication and authorization?
7. What is Model binding?
8. How to do model validations?
9. What global.asax file does?
10. Can we have project without web.config?
11. What are Action filters


Web Api

1. Which protocol it works on?
2. What are Http verbs and which verb used for what purpose?
3. How to use multiple Get and multiple Post methods in a controller?
4. How many types of routings? Which you used?
5. How to enable CORS?
6. How to do api versioning?


Javascript

1. It is multi threaded?
2. What are selectors?
3. What is promise?
4. Can we implement async await ?
5. What is fat arrow function?
6. What is spread operator?
7. What is pure function?
7. Ajax?

Sqlserver

1. Why we use view?
2. Difference between View and SP?
3. Difference between varchar and nvarchar?
3. Types of indexing ? Difference between clustered and non-clustered indexing?
4. Order of fields in non-clustered indexing matters?
4. Why SP execute faster? Can a SP have multiple execution plan?
5. Ever done performance optimization?
6. What are triggers and its types
7. When to use CTE?
8. When to use Cursor?
9. Nested transaction rollback tricky questions
10. Different Types of Locks and their use in SQL
11. Recursive Stored Procedures
12. Magic Table in SQL
13. Basic Types of Joins in SQL (HASH, MERGE and LOOP)



AngularJS

1. Can we have multiple ng-app in a application?
2. If controller function gets called multiple times what can  be possible issue?
3. What is the use of 'track by' in ng-repeat?
4. What is isolated scope?
5. How is scope in directive different from scope in controller?
6. What is the difference between compile and link?
7. Can parent controller access the methods of child controller or vice versa?
8. Difference between broadcast and emit?

Angular

1. How do Observables differ from Promises?
2. How typescript converted to javascript?
3. What is compilation in Angular? And what are the types of compilation in Angular?
4. types of Directives? 
    Ans: They are attribute directives, structural directives, and components.
5. What types of form you have used?
6. Have you used angular universal SSR?

NodeJS

1. How to create server?
2. What is middleware?
3. What you use for state management?
4. What you use to work with mongodb?
5. How can we do encrupt/ decrypt?
6. How to enable CORS in node server?
   A:   const app = express()
app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
  next();
});
7. How to declare environment variables?
8. What you use for file upload?
   A: multer
9. What is an error-first callback?
10. How to avoid callback hells? 
    A: modularization, control flow libraries, generators with promises, async/await

ReactJS

1. WHere does react rendering starts?
2. How we render a DOM?
   A. ReactDOM.render( )
3. How can we call API?
4. What we use for state management?
5. What is action, reducer and store in react-redux?
6. What is difference between 'export' and 'export default'?
7. Do you know react native also?

IONIC

1. What is IONIC?
2. Explain Ionic lifecycle hooks?
3. What is the difference between PhoneGap, Cordova, and Ionic?
4. What is 'collection-repeat' directive in IONIC?
    A. Renders only visible items in the DOM. Only items visible in a viewport are rendered.
5. How to access camera in ionic?
    A. ionic cordova plugin add cordova-plugin-camera
       npm install @ionic-native/camera
6. How to browse file in ionic?
    A. ionic cordova plugin add cordova-plugin-filechooser
       npm install @ionic-native/file-chooser

Typescript

1. How do you compile TypeScript files?
    A. tsc helloworld.ts
2. Does TypeScript support all object oriented principles?
    A. Yes
3. What are modules in TypeScript?
    A. Modules are the way to organize code in TypeScript.
4. Can we create generic class in typescript?
5. Explain Relative vs. Non-relative module imports.

Monday, February 18, 2019

SQL Database Backup - Restore Using SQL Query

Here we have some script to take database backup and restore quickly using SQL queries.
We can bypass the wizard by using the following TSQL scripts.

In below our database name is Test_DB, for which we will take backup and restore using TSQL scripts.

Backup Database

USE [master];
GO

/*
@date - Will Create a Date Timestamp to attach with database Backup file name for our future reference (this is an optional, we can set anything instead of Date Timestamp)
@disk1 : This is a Database backup File Location
*/

DECLARE @date NVARCHAR(19) = REPLACE(REPLACE(REPLACE(CONVERT(NVARCHAR(19), GETDATE(), 120), ':', ''),'-',''),' ',''),
        @disk1 NVARCHAR(256) = N'';

SET @disk1 = N'C:\DataBase Backup\Test_DB_' + @date + N'.bak';

BACKUP DATABASE [Test_DB]
TO  DISK = @disk1
WITH NOFORMAT,
     NOINIT,
     NAME = N'Test_DB-Full Database Backup',
     SKIP,
     NOREWIND;


Restore Database

USE [master];
GO

--Main DB
RESTORE DATABASE [EMS_Amajuba_Niren]
FROM DISK = N'C:\DataBase Backup\Test_DB_20190511091135.bak' --do a find and replace on the date string
WITH FILE = 1,
     --REPLACE, /* On second restore, add this to overwrite the previous backup */
     MOVE N'Test_DB'
     TO N'C:\Data\Test_DB.mdf',
     MOVE N'Test_DB_Log'
     TO N'C:\Log\Test_DB.ldf',
     STATS = 5;
GO


Some times we have error while database restore that database on which we are going to restore is still in use by some one, we can use below script to check whoever is using the database or if any active query window for this database

SELECT spid,
       hostname,
       program_name,
       hostprocess,
       loginame,
       login_time
FROM sys.sysprocesses
WHERE dbid IN
      (
          SELECT database_id FROM sys.databases WHERE name = 'EMS_Amajuba_niren'
      );


Thursday, January 3, 2019

Replace Patter in String in SQL Server

To Replace a specific String Pattern in SQL server, create a below function first

CREATE FUNCTION dbo.PatternReplace
(
   @InputString VARCHAR(4000),
   @Pattern VARCHAR(100),
   @ReplaceText VARCHAR(4000)
)
RETURNS VARCHAR(4000)
AS
BEGIN
   DECLARE @Result VARCHAR(4000) SET @Result = ''
   -- First character in a match
   DECLARE @First INT
   -- Next character to start search on
   DECLARE @Next INT SET @Next = 1
   -- Length of the total string -- 8001 if @InputString is NULL
   DECLARE @Len INT SET @Len = COALESCE(LEN(@InputString), 8001)
   -- End of a pattern
   DECLARE @EndPattern INT

   WHILE (@Next <= @Len)
   BEGIN
      SET @First = PATINDEX('%' + @Pattern + '%', SUBSTRING(@InputString, @Next, @Len))
      IF COALESCE(@First, 0) = 0 --no match - return
      BEGIN
         SET @Result = @Result +
            CASE --return NULL, just like REPLACE, if inputs are NULL
               WHEN  @InputString IS NULL
                     OR @Pattern IS NULL
                     OR @ReplaceText IS NULL THEN NULL
               ELSE SUBSTRING(@InputString, @Next, @Len)
            END
         BREAK
      END
      ELSE
      BEGIN
         -- Concatenate characters before the match to the result
         SET @Result = @Result + SUBSTRING(@InputString, @Next, @First - 1)
         SET @Next = @Next + @First - 1

         SET @EndPattern = 1
         -- Find start of end pattern range
         WHILE PATINDEX(@Pattern, SUBSTRING(@InputString, @Next, @EndPattern)) = 0
            SET @EndPattern = @EndPattern + 1
         -- Find end of pattern range
         WHILE PATINDEX(@Pattern, SUBSTRING(@InputString, @Next, @EndPattern)) > 0
               AND @Len >= (@Next + @EndPattern - 1)
            SET @EndPattern = @EndPattern + 1

         --Either at the end of the pattern or @Next + @EndPattern = @Len
         SET @Result = @Result + @ReplaceText
         SET @Next = @Next + @EndPattern - 1
      END
   END
   RETURN(@Result)

END

then try with below

DECLARE @Description NVARCHAR(1000) = '##[2455]## submitted feedback for ##[2794]## project request.'
SELECT REPLACE(dbo.PatternReplace(@Description, '[##0-9##]', ''),'[]','')

Tuesday, January 1, 2019

Setting Up RabbitMQ




Steps on Installing RabbitMQ

1. Install otp_win64_19.0.exe
2. Install rabbitMQ-server-3.6.3.exe
3. Click Start > All Programs > RabbitMQ Server > RabbitMQ Command Prompt
4. Type .\rabbitmq-plugins.bat enable rabbitmq_management > then press Enter
5. Check if the User Interface shows on your browser > http://localhost:15672/
6. Type .\rabbitmqctl.bat add_user shuttle shuttle! > then press Enter
7. Type .\rabbitmqctl.bat set_user_tags shuttle administrator > then Press Enter
8. Type rabbitmqctl set_permissions shuttle ".*" ".*" ".*"  > then Press Enter
9. Go to the Interface on http://localhost:15672/ 


If RabbitMqis already installed and not working try below commands to remove and install it again

Run RabbitMQ sbin command prompt as administrator.

Run "rabbitmq-service remove"

Run "rabbitmq-service install"

Try: rabbitmq-server start.

Configure Console Application as Windows Service

  To configure a  console application  as a  Windows Service , you'll need to follow several steps, which typically involve writing a se...