Friday, 31 December 2021

Thursday, 30 December 2021

IQ

  1.  What is C#
  2. Types of comment in C#
  3. Object in C#
  4. What is the .NET framework
  5. components of .NET
  6. What is OOP
  7. difference between Array and ArrayList
  8. Control Statement in C#
  9. Classes in C#
  10. abstract class and interface in .net
  11. Constructors ?
  12. Assembly?
  13. Private/PublicAssembly?
  14. MVC (Model, View, Controller)
  15. Languages Supported by .net platform
  16. Project details
  17. Some logics (C#/.net)
  18. Viewbag VS view data
  19. Action filters
  20. Authorized filter BTW action filter
  21. Extension methods
  22. async,await
  23. solid principles
  24. dependency injection
  25. singleton design pattern
  26. delegate types- func,predicate delegate
  27. abstract class vs interface
  28. sealed class
  29. caching Technics
  30. use of using 
  31. GC.collect vs finalize vs Dispose
  32. What tecnics are using for generating tokens
  33. Which one is faster DBfirst or code first
  34. what is bundle config and CDN
  35. what is application object and session object and differenece
  36. abstarct class and interface
  37. IIS request processing
  38. ref vs out
  39. status codes-403,200,500
  40. what render
  41. web api testing tecnincs
  42. difference web api,wcf.
  43. without using try block how to handle exceptions
  44. verbs in web api
  45. what are contracts
  46. diffbetween service contract and message contract
  47. solid principles
  48. How to Install certificates in IIS
  49. Passport authentication works
  50. Difference between Webservice/WCF
  51. Webapi Token types
  52. Code first/DB first approach Which one better
  53. Where configure endpoints in WCF
  54. Differenec between XML/JSON
  55. Bundle config/CDN which one is better.
  56. Authentication and Authorization in Web API
  57. Secure a Web API with Individual Accounts in Web API 2.2
  58. External Authentication Services with Web API (C#)
  59. Preventing Cross-Site Request Forgery (CSRF) Attacks in Web API
  60. Enabling Cross-Origin Requests in Web API 2
  61. Authentication Filters in Web API 2
  62. Basic Authentication in Web API
  63. Forms Authentication in Web API
  64. Integrated Windows Authentication
  65. Working with SSL

Saturday, 20 November 2021

React JS IQ

React JS:
Remove duplicate characters in array of elements
var sandwiches = ['turkey', 'ham', 'turkey', 'tuna', 'pb&j', 'ham', 'turkey', 'tuna'];
var deduped = Array.from(new Set(sandwiches));

// Logs ["turkey", "ham", "tuna", "pb&j"]
console.log(deduped);


  • given word last letter should be capital.
  • Cloure function
          Closures are inner functions that have access to the outer function’s variables and parameters. Even after the outer function’s execution is finished, the inner functions have access to the variables in the outer function. Closures are everywhere in JavaScript and you’ve probably been using it even if you have not realised it yet.

  • diff class component, functional component
Functional Components                                           Class Components                
A functional component is just a plain JavaScript function that accepts props as an argument and returns a React element.A class component requires you to extend from React. Component and create a render function which returns a React element.
There is no render method used in functional components.It must have the render() method returning HTML
Also known as Stateless components as they simply accept data and display them in some form, that they are mainly responsible for rendering UI.Also known as Stateful components because they implement logic and state.
React lifecycle methods (for example, componentDidMount) cannot be used in functional components.React lifecycle methods can be used inside class components (for example, componentDidMount).
  • Error Handling in React.
  • how to give generic exception and display the message
  • error boundaris
  • what is call back hell function
  • what is non blocking io---asyncronous call
  • what is stright mode
  • Differenec Virtual dom and Real dom.
  • react life cycle
  • what is promise unchining,promise.all-- promise is asyncronous call
  • diff let,var,const
  • what is closur function,nested function
  • basic ES6 features- let and var,promise,iterator
  • How to deploy React application
  • React Router types how it works,nested routes
  • What is Arrow function,uses
  • spread operator
  • what is generator
  • what is hooks- use memo,use context,use effect
  • How redux works
  • diff element and component
  • how to prevent rerendering-- using pure componentd or use memo
  • React application performence.
  • synthatic events.
  • what is controlled components
  • how to set initial state in Redux
  • Store in Redux
  • How many types are Reducers

  • what is Data binding
  • What is context API

Sunday, 3 October 2021

React JS questions

  1. Remove duplicate characters in array of elements
  2. Given word last letter should be capital.
  3. Closure function
  4. diff class component, functional component
  5. Error Handling in React.
  6. how to give generic exception and display the message
  7. error boundaris
  8. what is call back hell function
  9. what is non blocking io---asyncronous call
  10. what is stright mode
  11. Differenec Virtual dom and Real dom.
  12. react life cycle
  13. what is promise unchining,promise.all-- promise is asyncronous call
  14. diff let,var,const
  15. what is closur function,nested function
  16. basic ES6 features- let and var,promise,iterator
  17. How to deploy React application
  18. React Router types how it works,nested routes
  19. What is Arrow function,uses
  20. spread operator
  21. what is generator
  22. what is hooks- use memo,use context,use effect
  23. How redux works
  24. diff element and component
  25. how to prevent rerendering-- using pure componentd or use memo
  26. React application performence.
  27. synthatic events.
  28. what is controlled components
  29. how to set initial state in Redux
  30. Store in Redux
  31. How many types are Reducers
  32. Redux life cycle
  33. Diff State and props
  34. what is Data binding
  35. What is context API

Javascript:
  1. diff betewen Null and undefined
  2. typeof(null)
  3. Event bubling
  4. Define Json array
  5. how to detect object like mobile or tab-- using responsiveness media query
  6. purpose of encoding url
  7. what is decorater
  8. copy an object in javascript-- object

  1. Remove duplicate characters in array of elements
    • const uniqueNames = Array.from(new Set(names));
  1. Given word last letter should be capital.
  • const cap = str => str
                         .split(' ')
                         .map(x => (
                             x.length === 1 ? 
                                 x.toUpperCase() : 
                                `${x[0].toUpperCase()}${x.slice(1,-1)}${x[x.length -1].toUpperCase()}`)
                         )  
                         .join(' ')
    
    console.log(cap("a quick brown fox"))
    1. diff class component, functional component
  • There is no render method used in functional components.

    React lifecycle methods (for example, componentDidMount) cannot be used in functional components.
    It must have the render() method returning HTML
    React lifecycle methods can be used inside class components (for example, componentDidMount).

Tuesday, 28 September 2021

IQ

  1. What tecnics are using for generating tokens
  2. Which one is faster DBfirst or code first
  3. what is bundle config and CDN
  4. what is application object and session object and differenece
  5. abstarct class and interface
  6. IIS request processing
  7. status codes-403,200,500
  8. what render
  9. web api testing tecnincs
  10. difference web api,wcf.
  11. without using try block how to handle exceptions
  12. verbs in web api
  13. what are contracts
  14. diffbetween service contract and message contract
  15. solid principles
  16. How to Install certificates in IIS
  17. Passport authentication works
  18. Difference between Webservice/WCF
  19. Webapi Token types
  20. Code first/DB first approach Which one better
  21. Where configure endpoints in WCF
  22. Differenec between XML/JSON
  23. Bundle config/CDN which one is better

Monday, 20 September 2021

IQ

  1. What is Base class for Asp.net
  2. Authentication and Authorization config settings
  3. Forms Authentication config settings
  4. Difference between Datareader/Dataset, Handlers/Modules
  5. How to make web api calls asynchronously.
  6.  How many ways to pass data to View to controller
  7. Merge key word in sql.
  8. CTE main purpose
  9. Solid principles
  10. What type of code in Pre render
  11. CI/CD process.
1) Given number is even or odd in c# without using condition

using System;
class test 
{
  static void Main() 
   {
    string[] arr = {"Even", "Odd"};
      
    Console.Write("Enter the number: ");
     
    string val;

    val = Console.ReadLine();

    int no = Convert.ToInt32(val);
 
    Console.WriteLine(arr[no%2]);
  }
}

2) How can Select Only last Row of the Table Using Sql

   SELECT TOP 1 * FROM MyTable ORDER BY MyColumn ASC

3) scaling in sql server

  Horizontal and vertical scaling

   The following figure shows the horizontal and vertical dimensions of scaling, which are the basic ways the elastic databases can be scaled.

  Horizontal scaling refers to adding or removing databases in order to adjust capacity or overall performance, also called "scaling out". 



Sharding, in which data is partitioned across a collection of identically structured databases, is a common way to implement horizontal scaling.
Vertical scaling refers to increasing or decreasing the compute size of an individual database, also known as "scaling up."

Most cloud-scale database applications use a combination of these two strategies. For example, a Software as a Service application may use horizontal scaling to provision new end-customers and vertical scaling to allow each end-customer's database to grow or shrink resources as needed by the workload.

Horizontal scaling is managed using the Elastic Database client library.

Vertical scaling is accomplished using Azure PowerShell cmdlets to change the service tier, or by placing databases in an elastic pool.

Cons of JavaScript

1. Client-side Security

Since the JavaScript code is viewable to the user, others may use it for malicious purposes. These practices may include using the source code without authentication. Also, it is very easy to place some code into the site that compromises the security of data over the website.

2. Browser Support

The browser interprets JavaScript differently in different browsers. Thus, the code must be run on various platforms before publishing. The older browsers don’t support some new functions and we need to check them as well.

3. Lack of Debugging Facility

Though some HTML editors support debugging, it is not as efficient as other editors like C/C++ editors. Also, as the browser doesn’t show any error, it is difficult for the developer to detect the problem.

4. Single Inheritance

JavaScript only supports single inheritance and not multiple inheritance. Some programs may require this object-oriented language characteristic.

5. Rendering Stopped

A single code error can stop the rendering of the entire JavaScript code on the website. To the user, it looks as if JavaScript was not present. However, the browsers are extremely tolerant of these errors.

Difference between inline query and stored procedure

1.Stored procedures are strored in a pre complied form.That is once a Stored procedure is executed, the compiled code is used in subsequent calls. This is not possible with inline queries.

2.Stored procedures reduces network traffic. 
Since Stored procedures are stored in the server, only the name of Stored procedure is required to pass to the server. But in the case of inline queries , the complete query has to be passed to the server. So inline queries will increase network traffic when the queries are very large.

3.Stored procedures support Deferred Name Resolution.That is we can create stored procedures for objects(eg:- tables) which are not yet created ( and will be creating in the near future)

4.Stored procedures prevents SQL Injection Errors.

5.By using Stored procedures we can seperate all the queries from the Business logic code.
Therefore we can create a seperate layer.
But while writing inline queries , all the queries have to be written (mixed up ) with the business logic code. This create problem while debugging.

6.Developers can work simultaneously while using stored procedures.
While a programmer writes business logic, another one can create stored procedures at the same time.

Friday, 19 March 2021

Monday, 15 March 2021

React JS QS

 

What is React?

React is an open-source frontend JavaScript library which is used for building user interfaces especially for single page applications. It is used for handling view layer for web and mobile apps. React was created by Jordan Walke, a software engineer working for Facebook. React was first deployed on Facebook's News Feed in 2011 and on Instagram in 2012.

What are the major features of React?

The major features of React are:

  • It uses VirtualDOM instead of RealDOM considering that RealDOM manipulations are expensive.
  • Supports server-side rendering.
  • Follows Unidirectional data flow or data binding.
  • Uses reusable/composable UI components to develop the view.

What is JSX?

JSX is a XML-like syntax extension to ECMAScript (the acronym stands for JavaScript XML). Basically it just provides syntactic sugar for the React.createElement() function, giving us expressiveness of JavaScript along with HTML like template syntax.

In the example below text inside <h1> tag is returned as JavaScript function to the render function.

class App extends React.Component {
  render() {
    return(
      <div>
        <h1>{'Welcome to React world!'}</h1>
      </div>
    )
  }
}

How to create components in React?

There are two possible ways to create a component.

  1. Function Components: This is the simplest way to create a component. Those are pure JavaScript functions that accept props object as first parameter and return React elements:

    function Greeting({ message }) {
      return <h1>{`Hello, ${message}`}</h1>
    
    }
  2. Class Components: You can also use ES6 class to define a component. The above function component can be written as:

    class Greeting extends React.Component {
      render() {
        return <h1>{`Hello, ${this.props.message}`}</h1>
      }
    }

When to use a Class Component over a Function Component?

If the component needs state or lifecycle methods then use class component otherwise use function component.However, from React 16.8 with the addition of Hooks, you could use state , lifecycle methods and other features that were only available in class component right in your function component.


What is state in React?

State of a component is an object that holds some information that may change over the lifetime of the component. We should always try to make our state as simple as possible and minimize the number of stateful components.

Let's create an user component with message state,

class User extends React.Component {
  constructor(props) {
    super(props)

    this.state = {
      message: 'Welcome to React world'
    }
  }

  render() {
    return (
      <div>
        <h1>{this.state.message}</h1>
      </div>
    )
  }
}

state

State is similar to props, but it is private and fully controlled by the component. i.e, It is not accessible to any component other than the one that owns and sets it.

Wednesday, 10 February 2021

ReactJS Interview Questions

1. What are the features of React?

JSX:  JSX is a syntax extension to JavaScript. It is used with React to describe what the user interface should look like. By using JSX, we can write HTML structures in the same file that contains JavaScript code.

Components: Components are the building blocks of any React application, and a single app usually consists of multiple components. It splits the user interface into independent, reusable parts that can be processed separately.

  


Virtual DOM: React keeps a lightweight representation of the real DOM in the memory, and that is known as the virtual DOM. When the state of an object changes, virtual DOM changes only that object in the real DOM, rather than updating all the objects.




One-way data-binding: React’s one-way data binding keeps everything modular and fast. A unidirectional data flow means that when designing a React app, you often nest child components within parent components.




High performance: React updates only those components that have changed, rather than updating all the components at once. This results in much faster web applications.





2. What is JSX?

JSX is a syntax extension of JavaScript. It is used with React to describe what the user interface should look like. By using JSX, we can write HTML structures in the same file that contains JavaScript code.

what-is-jsx

3. Can web browsers read JSX directly? 

  • Web browsers cannot read JSX directly. This is because they are built to only read regular JS objects and JSX is not a regular JavaScript object 
  • For a web browser to read a JSX file, the file needs to be transformed into a regular JavaScript object. For this, we use Babel

babel

4. What is the virtual DOM?

DOM stands for Document Object Model. The DOM represents an HTML document with a logical tree structure. Each branch of the tree ends in a node, and each node contains objects.

virtualdom

React keeps a lightweight representation of the real DOM in the memory, and that is known as the virtual DOM. When the state of an object changes, the virtual DOM changes only that object in the real DOM, rather than updating all the objects.

real-dom



5. Why use React instead of other frameworks, like Angular?

Easy creation of dynamic applications: React makes it easier to create dynamic web applications because it provides less coding and provides more functionality, whereas, with JavaScript applications, code tends to get complex very quickly.




Improved performance: React uses virtual DOM, which makes web applications perform faster. Virtual DOM compares its previous state and updates only those components in the real DOM, whose states have changed, rather than updating all the components — like conventional web applications.




Reusable components: Components are the building blocks of any React application, and a single app usually consists of multiple components. These components have their own logic and controls, and they can be reused through the application, which, in turn, dramatically reduces the development time of an application.




Unidirectional data flow: React follows a unidirectional data flow. This means that when designing a React app, we often nest child components within parent components. And since the data flows in a single direction, it becomes easier to debug errors and know where the problem occurs in an application at the moment.



Dedicated tools for easy debugging: Facebook has released a chrome extension that we can use to debug React applications. This makes the process of debugging React to web applications faster and easier.




6. What is the difference between the ES6 and ES5 standards?

These are the few instances where ES6 syntax has changed from ES5 syntax:

  • Components and Function

es5

  • exports vs export

exports.

  • require vs import

require

7. How do you create a React app?

These are the steps for creating a React app:

  • Install NodeJS on the computer because we need npm to install the React library. Npm is the node package manager that contains many JavaScript libraries, including React.

node-js.

  • Install the create-react-app package using the command prompt or terminal.

create

  • Install a text editor of your choice, like VS Code or Sublime Text.

atom

8. What is an event in React?

An event is an action that a user or system may trigger, such as pressing a key, a mouse click, etc.

  • React events are named using camelCase, rather than lowercase in HTML.
  • With JSX, you pass a function as the event handler, rather than a string in HTML.
  • <Button onPress={lightItUp} />

9. How do you create an event in React?

A React event can be created by doing the following:

Question 9

10. What are synthetic events in React?

  • Synthetic events combine the response of different browser's native events into one API, ensuring that the events are consistent across different browsers.
  • The application is consistent regardless of the browser it is running in. Here, preventDefault is a synthetic event.

11. Explain how lists work in React

  • We create lists in React as we do in regular JavaScript. Lists display data in an ordered format
  • The traversal of lists is done using the map() function

const

12. Why is there a need for using keys in Lists?

Keys are very important in lists for the following reasons:

  • A key is a unique identifier and it is used to identify which items have changed, been updated or deleted from the lists
  • It also helps to determine which components need to be re-rendered instead of re-rendering all the components every time. Therefore, it increases performance, as only the updated components are re-rendered

13. What are forms in React?

React employs forms to enable users to interact with web applications.

  • Using forms, users can interact with the application and enter the required information whenever needed. Form contain certain elements, such as text fields, buttons, checkboxes, radio buttons, etc
  • Forms are used for many different tasks such as user authentication, searching, filtering, indexing, etc

14. How do you create forms in React?

We create forms in React by doing the following: 

/class-name

The above code will yield an input field with the label Name and a submit button. It will also alert the user when the submit button is pressed. 

simple 

15. How do you write comments in React?

There are basically two ways in which we can write comments:

  • Single-line comments

return

  • Multi-line comments

multi-line

16. What is an arrow function and how is it used in React?

  • An arrow function is a short way of writing a function to React.
  • It is unnecessary to bind ‘this’ inside the constructor when using an arrow function. This prevents bugs caused by the use of ‘this’ in React callbacks.

arrow

17. How is React different from React Native?

React

React Native

Release

2013

2015

Platform

Web

Mobile – Android, iOS

HTML

Yes

No

CSS

Yes

No

Prerequisites

JavaScript, HTML, CSS

React.js


18. How is React different from Angular?

Angular

React

Author

Google

Facebook

Architecture

Complete MVC

View layer of MVC

DOM

Real DOM

Virtual DOM

Data-Binding

Bi-directional

Uni-directional

Rendering

Client-Side

Server-Side

Performance

Comparatively slow

Faster due to Virtual DOM

ReactJS Component Questions

19. What are the components in React?

Components are the building blocks of any React application, and a single app usually consists of multiple components. A component is essentially a piece of the user interface. It splits the user interface into independent, reusable parts that can be processed separately.

There are two types of components in React:

react-component

  • Functional Components: These types of components have no state of their own and only contain render methods, and therefore are also called stateless components. They may derive data from other components as props (properties).

function Greeting(props) {

  return <h1>Welcome to {props.name}</h1>;

}

  • Class Components: These types of components can hold and manage their own state and have a separate render method to return JSX on the screen. They are also called Stateful components as they can have a state.

class Greeting extends React.Component {

  render() {

    return <h1>Welcome to {this.props.name}</h1>;

  }

}

20. What is the use of render() in React?

  • It is required for each component to have a render() function. This function returns the HTML, which is to be displayed in the component.
  • If you need to render more than one element, all of the elements must be inside one parent tag like <div>, <form>.

default-app

21. What is a state in React?

  • The state is a built-in React object that is used to contain data or information about the component. The state in a component can change over time, and whenever it changes, the component re-renders.
  • The change in state can happen as a response to user action or system-generated events. It determines the behavior of the component and how it will render.

22. How do you implement state in React?

state-holds

23. How do you update the state of a component?

We can update the state of a component by using the built-in ‘setState()’ method:

class-app

24. What are props in React?

  • Props are short for Properties. It is a React built-in object that stores the value of attributes of a tag and works similarly to HTML attributes.
  • Props provide a way to pass data from one component to another component. Props are passed to the component in the same way as arguments are passed in a function.

25. How do you pass props between components?

26. What are the differences between state and props?

State

Props

Use

Holds information about the components

Allows to pass data from one component to other components as an argument

Mutability

Is mutable

Are immutable

Read-Only

Can be changed

Are read-only

Child components

Child components cannot access 

Child component can access 

Stateless components

Cannot have state

Can have props

27. What is a higher-order component in React?

A higher-order component acts as a container for other components. This helps to keep components simple and enables re-usability. They are generally used when multiple components have to use a common logic. 

28. How can you embed two or more components into one?

We can embed two or more components into one using this method:

classapp-extends

29. What are the differences between class and functional components?

Class Components

Functional Components

State

Can hold or manage state

Cannot hold or manage state

Simplicity

Complex as compared to the stateless component

Simple and easy to understand

Lifecycle methods

Can work with all lifecycle methods

Does not work with any lifecycle method

Reusability

Can be reused

Cannot be reused

  • Class components example:

class-components.

  • Functional components example:

functional-components

30. Explain the lifecycle methods of components.

  • getInitialState(): This is executed before the creation of the component.
  • componentDidMount(): Is executed when the component gets rendered and placed on the DOM.
  • shouldComponentUpdate(): Is invoked when a component determines changes to the DOM and returns a “true” or “false” value based on certain conditions.
  • componentDidUpdate(): Is invoked immediately after rendering takes place.
  • componentWillUnmount(): Is invoked immediately before a component is destroyed and unmounted permanently.

ReactJS Redux Interview Questions

31. What is Redux?

Redux is an open-source, JavaScript library used to manage application state. React uses Redux to build the user interface. It is a predictable state container for JavaScript applications and is used for the entire application’s state management.

32. What are the components of Redux?

  • Store: Holds the state of the application.
  • Action: The source information for the store.
  • Reducer: Specifies how the application's state changes in response to actions sent to the store.

action

33. What is the Flux?

  • Flux is the application architecture that Facebook uses for building web applications. It is a method of handling complex data inside a client-side application and manages how data flows in a React application.

  • There is a single source of data (the store) and triggering certain actions is the only way way to update them.The actions call the dispatcher, and then the store is triggered and updated with their own data accordingly.

  • When a dispatch has been triggered, and the store updates, it will emit a change event that the views can rerender accordingly.

action

34. How is Redux different from Flux?

SN

Redux

Flux

1.

Redux is an open-source JavaScript library used to manage application State

Flux is an architecture and not a framework or library

2.

Store’s state is immutable

Store’s state is mutable

3.

Can only have a single-store

Can have multiple stores

4.

Uses the concept of reducer

Uses the concept of the dispatcher

ReactJS Router Questions

35. What is React Router?

React Router is a routing library built on top of React, which is used to create routes in a React application. 

36. Why do we need to React Router?

  • It maintains consistent structure and behavior and is used to develop single-page web applications. 
  • Enables multiple views in a single application by defining multiple routes in the React application.

37. How is React routing different from conventional routing?

SN

React Routing

Conventional routing

1.

Single HTML page

Each view is a new HTML file

2.

The user navigates multiple views in the same file

The user navigates multiple files for each view

3.

The page does not refresh since it is a single file

The page refreshes every time user navigates

4.

Improved performance

Slower performance

38. How do you implement React routing?

We can implement routing in our React application using this method:

Considering we have the components AppAbout, and Contact in our application:

routing.

ReactJS Styling Questions

39. How do you style React components?

There are several ways in which we can style React components:

  • Inline Styling

class-simple

  • JavaScript Object

hello-simple

  • CSS Stylesheet

stylesheet

40. Explain the use of CSS modules in React.

  • The CSS module file is created with the .module.css extension
  • The CSS inside a module file is available only for the component that imported it, so there are no naming conflicts while styling the components.

button