Infosys questions Flashcards
(112 cards)
What is a candidate key?
Minimal set of columns in a table that every other column depends on
How do you send information from the controller to the view in MVC?
by passing an object of the model class to the View.
What is the difference between a function and stored procedure?
Basic Differences between Stored Procedure and Function in SQL Server. The function must return a value but in Stored Procedure it is optional. Even a procedure can return zero or n values. Functions can have only input parameters for it whereas Procedures can have input or output parameters.
What is a primary key and foreign key and how are they used?
Primary key: Unique identifier for a row in a table
Foreign key: A set of columns which hold the values of some primary key to establish a relationship to another row
In MVC, how would you add another record in your database?
from the controller (which pulls from your dbrepo), to your models, to the database
What is the difference between Union and Union All?
The only difference between Union and Union All is that Union extracts the rows that are being specified in the query while Union All extracts all the rows including the duplicates (repeated values) from both the queries.
What is a join?
combines columns from one or more tables into a new table.
Difference Between Delete and Truncate
DELETE: It removes rows one at a time.
TRUNCATE: It removes all rows in a table by deallocating the pages that are used to store the table data
What are temporary tables?
A temporary table is a base table that is not stored in the database but instead exists only while the database session in which it was created is active
What are temporary tables used for?
lets you store and process intermediate results by using the same selection, update, and join capabilities that you can use with typical SQL Server tables.
how do you create a temporary table?
SELECT INTO statement
What are global variables and table variables
A global variable is a named memory variable that you access through SQL statements.
The table variable is a special type of the local variable that helps to store data temporarily
How to find the highest salary of a given table, then the 2nd highest salary, then the 100th.
To find the highest:
select * from employee where salary=(select Max(salary) from employee);
2nd highest:
SELECT name, MAX(salary) AS salary
FROM employee
WHERE salary ID = 2
100 highest:
SELECT name, MAX(salary) AS salary
FROM employee
WHERE salary ID = 100
Too much white space in front of my string, how to remove it? (SQL)
use trim() , ltrim() or rtrim() to remove it.
How to do angular validation, client or server?
AngularJS offers client-side form validation.
AngularJS monitors the state of the form and input fields (input, textarea, select), and lets you notify the user about the current state.
What is the difference between an inner and outer join?
The major difference between inner and outer joins is that inner joins result in the intersection of two tables, whereas outer joins result in the union of two tables.
What header you use to send data to api
HTTP POST
What header you use to get data from api
HTTP GET
What is MVC workflow
HTTP request comes to the controller then controller categorized an action, then send request to the Model to get data for the categorized action, then finally send the action to the view and process the view to send as a HTTP response. so the workflow is Controller-Model-View.
What frontend libraries have you used in your recent project
JS, TS, Bootstrap
Can you use two Action Methods in a controller to get the data from same table
yes
What are filters
a custom class where you can write custom logic to execute before or after an action method executes. Filters can be applied to an action method or controller in a declarative or programmatic way.
What type of databases have you worked in
azure, elephant sql
How do you pass values between controller and view in your Application
ViewBag and ViewData serves the same purpose in allowing developers to pass data from controllers to views.