1001 (actually more than ~1500) Full Stack Interview Questions And Answers sourced from all around the Internet to help you to prepare to an interview, conduct one, mock your lead dev or completely ignore. Answers provided for Junior and Middle-Level questions. All answers available on FullStack.Cafe.
- ASP.NET
- AWS
- Agile
- Angular
- AngularJS
- Azure
- Behavioral
- Bootstrap
- CSS
- Code Problems
- Data Structures
- Design Patterns
- DevOps
- Git
- Golang
- GraphQL
- HTML 5
- Java
- JavaScript
- Laravel
- MongoDB
- Node.js
- Performance Testing
- Questions to Ask
- REST API
- React
- Ruby
- Sass
- Scrum
- Software Architecture
- TypeScript
- UX Design
- Vue.js
- Web Security
- Webpack
Answer: The .NET Core platform is a new .NET stack that is optimized for open source development and agile delivery on NuGet.
.NET Core has two major components. It includes a small runtime that is built from the same codebase as the .NET Framework CLR. The .NET Core runtime includes the same GC and JIT (RyuJIT), but doesn’t include features like Application Domains or Code Access Security. The runtime is delivered via NuGet, as part of the ASP.NET Core package.
.NET Core also includes the base class libraries. These libraries are largely the same code as the .NET Framework class libraries, but have been factored (removal of dependencies) to enable to ship a smaller set of libraries. These libraries are shipped as System.*
NuGet packages on NuGet.org.
Source: stackoverflow.com
Answer: ASP.NET Core is a brand new cross-platform web framework built with .NET Core framework. It is not an update to existing ASP.NET framework. It is a complete rewrite of the ASP.NET framework. It works with both .NET Core and .NET Framework.
Main characterestics of ASP.NET Core:
- DI Container which is quite simple and built-in. You can extend it with other popular DI containers
- Built-in and extensible structured logging. You can redirect output to as many sources as you want (file, Azure, AWS, console)
- Extensible strongly typed configuration, which can also be used to reload at run-time
- Kestrel – new, cross-platform and super fast web server which can stand alone without IIS, Nginx or Apache
- New, fully async pipeline. It is easily configured via middleware
- ASP.NET All meta package which improves development speed, and enables you to reference all Microsoft packages for ASP.NET Core and it will deploy only those that are being used by your code
- There is no web.config. We now use appsettings.json file in combination with other sources of configuration (command line args, environment variables, etc.)
- There is no _Global._asax – We have Startup.cs which is used to set up Middleware and services for DI Container.
Source: talkingdotnet.com
Answer: Yes. This might surprise many, but ASP.NET Core works with .NET framework and this is officially supported by Microsoft.
ASP.NET Core works with:
- .NET Core framework
- .NET framework
Source: talkingdotnet.com
Answer: Another crucial part of ASP.NET Core Framework is Configuration. Also, it is part of Dependency Injection. Use it anywhere in your code with an option to reload on changes of configuration values from sources (appsettings.json, environment variables, command line arguments, etc.). It is also easy to override, extend and customize the Configuration. No more extensive configurations in web.config, the preferred way now is appsettings.json in combination with a mix of Environment variables and cmd-line args.
Source: talkingdotnet.com
Answer: Logging is built-in and you get access to structured logs from the ASP.NET Core host itself to your application. With tools like Serilog, you can extend your logging easily and save your logs to file, Azure, Amazon or any other output provider. You can configure verbosity and log levels via configuration (appsettings.json by default), and you can configure log levels by different categories.
Source: talkingdotnet.com
Answer: Everything starts from Program.cs
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
CreateDefaultBuilder extension method will create a default configuration which will look first into appsettings.json
files then will look for Environment variables and at the end, it will use command line arguments.
This part will also set up default logger sources (debug and console) and load the settings for logging from appsettings.json.
After the CreateDefaultBuilder
finishes, then Startup
class is executed. First, the constructor code is executed. After that, services are added to DI container via AddServices
method that lives in Startup class. After that, an order of middleware that will handle every incoming request is set up.
Source: codingblast.com
Answer: To be simple:
- Mono is third party implementation of .Net Framework for Linux/Android/iOs
- .Net Core is Microsoft's own implementation for same.
Source: stackoverflow.com
Answer: Razor Pages is a new feature of ASP.NET Core that makes coding page-focused scenarios easier and more productive.
With Razor Pages, you have this one Razor file (.cshtml), and the code for a single page lives inside of that file, and that file also represents the URL structure of the app. Therefore, you got everything inside of one file, and it just works.
However, you can separate your code to the code behind file with .cshtml.cs extension. You would usually have your view model and handlers (like action methods in MVC) in that file and handle the logic there. Of course, you could also have your view model moved to separate place.
Since Razor Pages is part of the MVC stack, you can use anything that comes with MVC inside of our Razor Pages.
Source: codingblast.com
Answer:
-
Flexible deployment: Can be included in your app or installed side-by-side user- or machine-wide.
-
Cross-platform: Runs on Windows, macOS and Linux; can be ported to other OSes. The supported Operating Systems (OS), CPUs and application scenarios will grow over time, provided by Microsoft, other companies, and individuals.
-
Command-line tools: All product scenarios can be exercised at the command-line.
-
Compatible: .NET Core is compatible with .NET Framework, Xamarin and Mono, via the .NET Standard Library.
-
Open source: The .NET Core platform is open source, using MIT and Apache 2 licenses. Documentation is licensed under CC-BY. .NET Core is a .NET Foundation project.
-
Supported by Microsoft: .NET Core is supported by Microsoft, per .NET Core Support
Source: stackoverflow.com
Answer:
-
The SDK is all of the stuff that is needed/makes developing a .NET Core application easier, such as the CLI and a compiler.
-
The runtime is the "virtual machine" that hosts/runs the application and abstracts all the interaction with the base operating system.
Source: stackoverflow.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q22: What is the difference between .NET Framework/Core and .NET Standard Class Library project types? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Answer: AWS stands for Amazon Web Services and is a platform that provides database storage, secure cloud services, offering to compute power, content delivery, and many other services to develop business levels.
Source: onlineinterviewquestions.com
Answer:
- Simple Storage Service (S3): S3 is most widely used AWS storage web service.
- Simple E-mail Service (SES): SES is a hosted transactional email service and allows one to fluently send deliverable emails using a RESTFUL API call or through a regular SMTP.
- Identity and Access Management (IAM): IAM provides improved identity and security management for AWS account.
- Elastic Compute Cloud (EC2): EC2 is an AWS ecosystem central piece. It is responsible for providing on-demand and flexible computing resources with a “pay as you go” pricing model.
- Elastic Block Store (EBS): EBS offers continuous storage solution that can be seen in instances as a regular hard drive.
- CloudWatch: CloudWatch allows the controller to outlook and gather key metrics and also set a series of alarms to be notified if there is any trouble.
Source: whizlabs.com
Answer: An Amazon S3 bucket is a public cloud storage resource available in Amazon Web Services' (AWS) Simple Storage Service (S3), an object storage offering. Amazon S3 buckets, which are similar to file folders, store objects, which consist of data and its descriptive metadata.
By default, you can create up to 100 buckets in each of your AWS accounts. If you need more buckets, you can increase your bucket limit by submitting a service limit increase.
Source: whizlabs.com
Answer: Amazon CloudFront is a content delivery network (CDN) offered by Amazon Web Services. Content delivery networks provide a globally-distributed network of proxy servers which cache content, such as web videos or other bulky media, more locally to consumers, thus improving access speed for downloading the content.
Source: en.wikipedia.org
Answer: AMI stands for the term Amazon Machine Image. It’s an AWS template which provides the information (an application server, and operating system, and applications) required to perform the launch of an instance. This AMI is the copy of the AMI that is running in the cloud as a virtual server. You can launch instances from as many different AMIs as you need. AMI consists of the followings:
- A root volume template for an existing instance
- Launch permissions to determine which AWS accounts will get the AMI in order to launch the instances
- Mapping for block device to calculate the total volume that will be attached to the instance at the time of launch
Source: whizlabs.com
Answer: Use scp:
scp -i ec2key.pem username@ec2ip:/path/to/file .
Source: stackoverflow.com
Answer: You can make an AMI of an existing instance, and then launch other instances using that AMI.
Source: stackoverflow.com
Answer: AWS Data Pipeline is a web service that you can use to automate the movement and transformation of data. With AWS Data Pipeline, you can define data-driven workflows, so that tasks can be dependent on the successful completion of previous tasks.
Source: docs.aws.amazon.com
Answer: Amazon EC2 services have following features:
- Virtual Computing Environments
- Proffers Persistent storage volumes
- Firewall validating you to specify the protocol
- Pre-configured templates
- Static IP address for dynamic Cloud Computing
Source: whizlabs.com
Answer: Many different types of instances can be launched from one AMI. The type of an instance generally regulates the hardware components of the host computer that is used for the instance. Each type of instance has distinct computing and memory efficacy.
Once an instance is launched, it casts as host and the user interaction with it is same as with any other computer but we have a completely controlled access to our instances. AWS developer interview questions may contain one or more AMI based questions, so prepare yourself for the AMI topic very well.
Source: whizlabs.com
Answer: Yes, buckets exist in a specific region and you need to specify that region when you create a bucket. Amazon S3 creates bucket in a region you specify. You can choose any AWS region that is geographically close to you to optimize latency, minimize costs, or address regulatory requirements.
Source: stackoverflow.com
Answer: AWS Direct Connect bypasses the public Internet and establishes a secure, dedicated connection from your infrastructure into AWS. With established connectivity via AWS Direct Connect, you can access your Amazon VPC and all AWS services.
Source: coresite.com
Answer: Amazon Elastic Block Store (Amazon EBS) provides persistent block storage volumes for use with Amazon EC2 instances in the AWS Cloud. Each Amazon EBS volume is automatically replicated within its Availability Zone to protect you from component failure, offering high availability and durability.
Source: aws.amazon.com
Answer: AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. You can use AWS Lambda to extend other AWS services with custom logic, or create your own back-end services that operate at AWS scale, performance, and security.
Source: aws.amazon.com
Answer: Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. With DynamoDB, you can create database tables that can store and retrieve any amount of data, and serve any level of request traffic.
Source: docs.aws.amazon.com
Answer: Amazon Elastic MapReduce (EMR) is an Amazon Web Services (AWS) tool for big data processing and analysis. Amazon EMR offers the expandable low-configuration service as an easier alternative to running in-house cluster computing.
Amazon EMR is based on Apache Hadoop, a Java-based programming framework that supports the processing of large data sets in a distributed computing environment. MapReduce is a software framework that allows developers to write programs that process massive amounts of unstructured data in parallel across a distributed cluster of processors or stand-alone computers.
Source: searchaws.techtarget.com
Answer: By default data on S3 is not encrypted, but all you could enable server-side encryption in your object metadata when you upload your data to Amazon S3. As soon as your data reaches S3, it is encrypted and stored.
Source: aws.amazon.com
Answer: No. After you create a volume, you can attach it to any EC2 instance in the same Availability Zone. An EBS volume can be attached to only one EC2 instance at a time, but multiple volumes can be attached to a single instance.
Source: docs.aws.amazon.com
Answer: Amazon API Gateway is an AWS service that enables developers to create, publish, maintain, monitor, and secure APIs at any scale. You can create APIs that access AWS or other web services, as well as data stored in the AWS Cloud.
Source: aws.amazon.com
Answer: Using AWS Direct Connect, you can establish private connectivity between AWS and your datacenter, office, or colocation environment, which in many cases can reduce your network costs, increase bandwidth throughput, and provide a more consistent network experience than Internet-based connections.
Source: aws.amazon.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q39: When should one use the following: Amazon EC2, Google App Engine, Microsoft Azure and Salesforce.com? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q41: Our EC2 micro instance occasionally runs out of memory. Other than using a larger instance size, what else can be done? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: To improve the performance, the existing code is modified; this is re-factoring. During re-factoring the code functionality remains same.
Source: career.guru99.com
Answer: User stories are features customers might want to see in their software. They are written on index cards to encourage face-to-face communication. Typically no more than a couple days work, they form the basis of our Agile plans.
Answer: An Agile iteration is a short one to two week period where a team takes most important user stories, builds them completely and deliver as running-tested-software to the customer. Analysis, design, coding, testing happen during an iteration.
Answer: Test driven development (TDD) is also known as test-driven design. In this method, developer first writes an automated test case which describes new function or improvement and then creates small codes to pass that test, and later re-factors the new code to meet the acceptable standards.
Source: career.guru99.com
Answer: Velocity is a metric that is calculated by addition of all efforts estimates related with user stories completed in an iteration. It figures out how much work Agile can complete in a sprint and how much time will it need to finish a project.
Source: career.guru99.com
Answer: A product roadmap is referred for the holistic view of product features that create the product vision.
Source: career.guru99.com
Answer: Agile is a time boxed, iterative approach (framework) to software delivery that builds software incrementally from the start of the project, instead of trying to deliver it all at once near the end.
It works by breaking projects down into little bits of user functionality called user stories, prioritizing them, and then continuously delivering them in short two week cycles called iterations.
Agile refers to any process that aligns with the concepts of the Agile Manifesto.
Source: agilemanifesto.org
Answer:
- Analysis, design, coding, and testing are continuous activities
- Development is iterative
- Planning is adaptive
- Roles blur
- Scope can vary
- Requirements can change
- Working software is the primary measure of success
Answer: The burn-down chart shows the remaining work to complete before the timebox (iteration) ends.
Source: career.guru99.com
Answer: If a timebox plan needs to be reprioritized it should include whole team, product owner, and developers.
Source: career.guru99.com
Answer: It is used to discuss the difficulty of the story without assigning actual hours. The most common scale used is a Fibonacci sequence (1, 2, 3, 5, 8,1 3,….100) although some teams use linear scale (1, 2, 3, 4….), Powers of 2 (1, 2, 4, 8……) and cloth size (XS, S ,M, L, XL)
Source: career.guru99.com
Answer: To track the project progress burnup and burn down, charts are used
- Burnup Chart: It shows the progress of stories done over time
- Burndown Chart: It shows how much work was left to do overtime
Source: career.guru99.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q17: Mention what are the advantages of maintaining consistent iteration length throughout the project? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q25: In Agile mention what is the difference between the Incremental and Iterative development? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Angular’s route guards are interfaces which can tell the router whether or not it should allow navigation to a requested route. They make this decision by looking for a true or false return value from a class which implements the given guard interface.
Source: medium.com
Answer: An Angular module is set of Angular basic building blocks like component, directives, services etc. An app can have more than one module.
A module can be created using @NgModule
decorator.
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Source: stackoverflow.com
Answer:
A pipe takes in data as input and transforms it to a desired output. You can chain pipes together in potentially useful combinations. You can write your own custom pipes. Angular comes with a stock of pipes such as DatePipe
, UpperCasePipe
, LowerCasePipe
, CurrencyPipe
, and PercentPipe
.
Consider:
<p>The hero's birthday is {{ birthday | date }}</p>
In this page, you'll use pipes to transform a component's birthday property into a human-friendly date.
Source: angular.io
Answer: Components control views (html). They also communicate with other components and services to bring functionality to your app.
Modules consist of one or more components. They do not control any html. Your modules declare which components can be used by components belonging to other modules, which classes will be injected by the dependency injector and which component gets bootstrapped. Modules allow you to manage your components to bring modularity to your app.
Source: stackoverflow.com
Q5: What are the differences between AngularJS (angular 1.x) and Angular (Angular 2.x and beyond)? ⭐⭐
Answer: Angular and AngularJS is basically a different framework with the same name.
Angular is more ready for the current state of web standards and the future state of the web (ES6\7, immutiablity, components, shadow DOM, service workers, mobile compatibilty, modules, typescript and so on and so on... )
Angular killed many main features in AngularJS like - controllers, $scope, directives (replaced with @component
annotations), the module definition, and much more, even simple things like ng-repeat has not left the same as it was.
Also:
- They added an angular
cli
. - Your angular code is written in ES6 Typescript and it compiles at runtime to Javascript in the browser.
- You bind to your HTML similarly like how you would if in an Angular 1 directive. So variable like $scope and $rootScope have been deprecated.
Source: stackoverflow.com
Answer: Angular services are singleton objects which get instantiated only once during the lifetime of an application. They contain methods that maintain data throughout the life of an application, i.e. data does not get refreshed and is available all the time. The main objective of a service is to organize and share business logic, models, or data and functions with different components of an Angular application.
The separation of concerns is the main reason why Angular services came into existence. An Angular service is a stateless object and provides some very useful functions.
Source: dzone.com
Answer:
Just bind to the hidden
property
Source: stackoverflow.com
Answer:
The absolute minimal configuration for a @Component
in Angular is a template. Both template properties are set to optional because you have to define either template
or templateUrl
.
When you don't define them, you will get an exception like this:
No template specified for component 'ComponentName'
A selector property is not required, as you can also use your components in a route.
Source: stackoverflow.com
Answer: The correct syntax is the following:
<div [innerHTML]="theHtmlString"></div>
Working in 5.2.6
Source: medium.com
Answer: Components are the most basic building block of an UI in an Angular application. An Angular application is a tree of Angular components. Angular components are a subset of directives. Unlike directives, components always have a template and only one component can be instantiated per an element in a template.
A component must belong to an NgModule in order for it to be usable by another component or application. To specify that a component is a member of an NgModule, you should list it in the declarations
field of that NgModule.
@Component({selector: 'greet', template: 'Hello {{name}}!'})
class Greet {
name: string = 'World';
}
Source: angular.io
Answer: You can get a handle to the DOM element via ElementRef by injecting it into your component's constructor:
constructor(myElement: ElementRef) { ... }
Source: medium.com
Answer: Just bind to the hidden property:
[hidden]="!myVar"
Source: medium.com
Q13: What is the difference between *ngIf vs [hidden]? ⭐⭐
Answer:
*ngIf
effectively removes its content from the DOM while [hidden]
modifies the display
property and only instructs the browser to not show the content but the DOM still contains it.
Source: medium.com
Answer:
- Directives add behaviour to an existing DOM element or an existing component instance.
- A component, rather than adding/modifying behaviour, actually creates its own view (hierarchy of DOM elements) with attached behaviour.
Write a component when you want to create a reusable set of DOM elements of UI with custom behaviour. Write a directive when you want to write reusable behaviour to supplement existing DOM elements.
Source: medium.com
Answer: Just to name a few:
- Improvements in AOT,
- allowing the "else" clause in ngIf,
- support for TypeScript 2.1
- breaking out the animations package
Source: github.com/WebPredict
Answer: The Angular router ships with a feature called guards. These provide us with ways to control the flow of our application. We can stop a user from visitng certain routes, stop a user from leaving routes, and more. The overall process for protecting Angular routes:
- Create a guard service:
ng g guard auth
- Create
canActivate()
orcanActivateChild()
methods - Use the guard when defining routes
// import the newly created AuthGuard
const routes: Routes = [
{
path: 'account',
canActivate: [AuthGuard]
}
];
Some other available guards:
CanActivate
: Check if a user has accessCanActivateChild
: Check if a user has access to any of the child routesCanDeactivate
: Can a user leave a page? For example, they haven't finished editing a postResolve
: Grab data before the route is instantiatedCanLoad
: Check to see if we can load the routes assets
Source: scotch.io
Details:
@HostBinding('[class.valid]') isValid;
Answer:
@HostBinding
lets you set properties on the element or component that hosts the directive.
The code applies the css class valid
to whatever is using this directive conditionally based on the value of isValid.
Source: alligator.io
Answer: The Angular CLI downloads and install everything you need to test an Angular application with the Jasmine test framework.
The project you create with the CLI is immediately ready to test. Just run this one CLI command:
ng test
Source: angular.io
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q23: Can you explain the difference between Promise
and Observable
in Angular? In what scenario can we use each case? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q40: Are there any pros/cons (especially performance-wise) in using local storage to replace cookie functionality? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q53: When should I store the "Subscription" instances and invoke unsubscribe()
during the NgOnDestroy life cycle and when can I simply ignore them? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: There are following reasons to choose AngularJS as a web development framework:
- It is based on MVC pattern which helps you to organize your web apps or web application properly.
- It extends HTML by attaching directives to your HTML markup with new attributes or tags and expressions in order to define very powerful templates.
- It also allows you to create your own directives, making reusable components that fill your needs and abstract your DOM manipulation logic.
- It supports two-way data binding i.e. connects your HTML (views) to your JavaScript objects (models) seamlessly. In this way any change in model will update the view and vice versa without any DOM manipulation or event handling.
- It encapsulates the behavior of your application in controllers which are instantiated with the help of dependency injection.
- It supports services that can be injected into your controllers to use some utility code to fullfil your need. For example, it provides $http service to communicate with REST service.
- It supports dependency injection which helps you to test your angular app code very easily.
- Also, AngularJS is mature community to help you. It has widely support over the internet.
Source: github.com/krosti
Answer:
ng-show
/ng-hide
will always insert the DOM element, but will display/hide it based on the condition. ng-if
will not insert the DOM element until the condition is not fulfilled.
ng-if
is better when we needed the DOM to be loaded conditionally, as it will help load page bit faster compared to ng-show
/ng-hide
.
We only need to keep in mind what the difference between these directives is, so deciding which one to use totally depends on the task requirements.
Source: codementor.io
Answer: AngularJS has no dependency on jQuery library. But it can be used with jQuery library.
Source: _ github.com/krosti_
Answer:
This can be done by using the ng-hide
directive in conjunction with a controller to hide an HTML element on button click.
<div ng-controller="MyCtrl">
<button ng-click="hide()">Hide element</button>
<p ng-hide="isHide">Hello World!</p>
</div>
function MyCtrl($scope) {
$scope.isHide = false;
$scope.hide = function () {
$scope.isHide = true;
};
}
Source: codementor.io
Answer: Is a great pattern that restricts the use of a class more than once. We can find singleton pattern in angular in dependency injection and in the services.
In a sense, if the you do 2 times new Object()
without this pattern, the you will be alocating 2 pieces of memory for the same object. With singleton pattern, if the object exists, it'll be reused.
Source: codementor.io
Answer: The features of AngularJS are listed below:
- Modules
- Directives
- Templates
- Scope
- Expressions
- Data Binding
- MVC (Model, View & Controller)
- Validations
- Filters
- Services
- Routing
- Dependency Injection
- Testing
Source: github.com/krosti
Answer: A module might have dependencies on other modules. The dependent modules are loaded by angular before the requiring module is loaded.
In other words the configuration blocks of the dependent modules execute before the configuration blocks of the requiring module. The same is true for the run blocks. Each module can only be loaded once, even if multiple other modules require it.
Source: github.com/krosti
Answer:
To prevent accidental name collisions with your code, Angular prefixes names of public objects with $ and names of private objects with $$
. So, do not use the $
or $$
prefix in your code.
Source: github.com/krosti
Answer:
Filters are used to format data before displaying it to the user. They can be used in view templates, controllers, services and directives. There are some built-in filters provided by AngularJS like as Currency
, Date
, Number
, OrderBy
, Lowercase
, Uppercase
etc. You can also create your own filters.
Filter Syntax:
{{ expression | filter}}
Source: github.com/krosti
Answer: AngularJS directives are a combination of AngularJS template markups (HTML attributes or elements, or CSS classes) and supporting JavaScript code. The JavaScript directive code defines the template data and behaviors of the HTML elements.
AngularJS directives are used to extend the HTML vocabulary i.e. they decorate html elements with new behaviors and help to manipulate html elements attributes in interesting way.
There are some built-in directives provided by AngularJS like as ng-app, ng-controller, ng-repeat, ng-model etc.
Source: github.com/krosti
Answer: Directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS’s HTML compiler ($compile) to attach a specified behavior to that DOM element (e.g. via event listeners), or even to transform the DOM element and its children.
Angular comes with a set of these directives built-in, like ngBind
, ngModel
, and ngClass
. Much like you create controllers and services, you can create your own directives for Angular to use. When Angular bootstraps your application, the HTML compiler traverses the DOM matching directives against the DOM elements.
Source: codementor.io
Answer: Scope is an object that refers to the application model. It is an execution context for expressions. Scopes are arranged in hierarchical structure which mimic the DOM structure of the application. Scopes can watch expressions and propagate events. Scopes are objects that refer to the model. They act as glue between controller and view.
Source: codementor.io
Q13: What directive would you use to hide elements from the HTML DOM by removing them from that DOM not changing their styling? ⭐⭐
Answer:
The ngIf
Directive, when applied to an element, will remove that element from the DOM if it’s condition is false.
Source: codementor.io
Answer:
- One way binding implies that the scope variable in the html will be set to the first value its model is bound to (i.e. assigned to)
- Two way binding implies that the scope variable will change it’s value everytime its model is assigned to a different value
Source: codementor.io
Answer:
Angular initializes automatically upon DOMContentLoaded
event or when the angular.js script is downloaded to the browser and the document.readyState
is set to complete
. At this point AngularJS looks for the ng-app
directive which is the root of angular app compilation and tells about AngularJS part within DOM. When the ng-app
directive is found then Angular will:
- Load the module associated with the directive.
- Create the application injector.
- Compile the DOM starting from the ng-app root element. This process is called auto-bootstrapping.
<html>
<body ng-app="myApp">
<div ng-controller="Ctrl"> Hello {{msg}}!
</div>
<script src="lib/angular.js"></script>
<script>
var app = angular.module('myApp', []); app.controller('Ctrl', function ($scope) {
$scope.msg = 'World';
});
</script>
</body>
</html>
Source: github.com/krosti
Answer:
By using “::
” in front of it.
Source: codementor.io
Answer: Scope is a JavaScript object that refers to the application model. It acts as a context for evaluating angular expressions. Basically, it acts as glue between controller and view.
Scopes are hierarchical in nature and follow the DOM structure of your AngularJS app. AngularJS has two scope objects: $rootScope and $scope.
Source: github.com/krosti
Answer:
We can use the ng-disabled
directive and bind its condition to the checkbox’s state.
<body ng-app>
<label>
<input type="checkbox" ng-model="checked" />Disable Button
</label>
<button ng-disabled="checked">Select me</button>
</body>
Source: codementor.io
Answer: The $scope object used by views in AngularJS are organized into a hierarchy. There is a root scope, and the $rootScope can has one or more child scopes. Each controller has its own $scope (which is a child of the $rootScope), so whatever variables you create on $scope within controller, these variables are accessible by the view based on this controller.
For example, suppose you have two controllers: ParentController and ChildController as given below:
<html>
<head>
<script src="lib/angular.js"></script>
<script>
var app = angular.module('ScopeChain', []); app.controller("parentController", function ($scope) {
$scope.managerName = 'Shailendra Chauhan';
$scope.$parent.companyName = 'Dot Net Tricks'; //attached to $rootScope
});
app.controller("childController", function ($scope, $controller) {
$scope.teamLeadName = 'Deepak Chauhan';
});
</script>
</head>
<body ng-app="ScopeChain">
<div ng-controller="parentController ">
<table style="border:2px solid #e37112">
<caption>Parent Controller</caption>
<tr>
<td>Manager Name</td>
<td>{{managerName}}</td>
</tr>
<tr>
<td>Company Name</td>
<td>{{companyName}}</td>
</tr>
<tr>
<td>
<table ng-controller="childController" style="border:2px solid #428bca">
<caption>Child Controller</caption>
<tr>
<td>Team Lead Name</td>
<td>{{ teamLeadName }}</td>
</tr>
<tr>
<td>Reporting To</td>
<td>{{managerName}}</td>
</tr>
<tr>
<td>Company Name</td>
<td>{{companyName}}</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
Source: github.com/krosti
Answer: Create an AngularJS service that will hold the data and inject it inside of the controllers.
Using a service is the cleanest, fastest and easiest way to test. However, there are couple of other ways to implement data sharing between controllers, like:
– Using events
– Using $parent
, nextSibling
, controllerAs
, etc. to directly access the controllers
– Using the $rootScope
to add the data on (not a good practice)
The methods above are all correct, but are not the most efficient and easy to test.
Source: codementor.io
Answer:
- Inject the module that contains the filter.
- Provide any mocks that the filter relies on.
- Get an instance of the filter using
$filter('yourFilterName')
. - Assert your expectations.
Source: codementor.io
Answer:
- Inject the module that contains the filter.
- Provide any mocks that the filter relies on.
- Get an instance of the filter using
$filter('yourFilterName')
. - Assert your expectations.
Source: codementor.io
Answer: There are following advantages of AngularJS:
- Data Binding - AngularJS provides a powerful data binding mechanism to bind data to HTML elements by using scope.
- Customize & Extensible - AngularJS is customized and extensible as per you requirement. You can create your own custom components like directives, services etc.
- Code Reusability - AngularJS allows you to write code which can be reused. For example custom directive which you can reuse.
- Support – AngularJS is mature community to help you. It has widely support over the internet. Also, AngularJS is supported by Google which gives it an advantage.
- Compatibility - AngularJS is based on JavaScript which makes it easier to integrate with any other JavaScript library and runnable on browsers like IE, Opera, FF, Safari, Chrome etc.
- Testing - AngularJS is designed to be testable so that you can test your AngularJS app components as easy as possible. It has dependency injection at its core, which makes it easy to test.
Source: github.com/krosti
Answer: In AngularJS services are the singleton objects or functions that are used for carrying out specific tasks. It holds some business logic and these function can be called as controllers, directive, filters and so on.
Source: github.com/krosti
Answer: During compilation process when specific HTML constructs are encountered a behaviour or function is triggered, this function is referred as directive. It is executed when the compiler encounters it in the DOM.
Different types of directives are:
- Element directives
- Attribute directives
- CSS class directives
- Comment directives
Source: guru99.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q34: If you were to migrate from Angular 1.4 to Angular 1.5, what is the main thing that would need refactoring? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q36: Explain what is Angular Expression? Explain what is key difference between angular expressions and JavaScript expressions? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q49: When creating a directive, it can be used in several different ways in the view. Which ways for using a directive do you know? How do you define the way your directive will be used? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q51: Explain what is DI (Dependency Injection ) and how an object or function can get a hold of its dependencies? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q59: How would you programatically change or adapt the template of a directive before it is executed and transformed? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer:
- Avoid managing servers
- Flexible scaling by demand
- Pay for time and resources it takes to execute your code
Answer: By creating a cloud service, you can deploy a multi-tier web application in Azure, defining multiple roles to distribute processing and allow flexible scaling of your application. A cloud service consists of one or more web roles and/or worker roles, each with its own application files and configuration. Azure Websites and Virtual Machines also enable web applications on Azure. The main advantage of cloud services is the ability to support more complex multi-tier architectures
Source: mindmajix.com
Answer: A web role provides a dedicated Internet Information Services (IIS) web-server used for hosting front-end web applications.
Source: mindmajix.com
Answer: Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. We can write just the code we need for the problem at hand, without worrying about a whole application or the infrastructure to run it and use language of our choice such as C#, F#, Node.js, Java, or PHP. Azure Functions lets us develop serverless applications on Microsoft Azure.
Answer: Serverless computing is the abstraction of servers, infrastructure, and operating systems. When you build serverless apps you don’t need to provision and manage any servers, so you can take your mind off infrastructure concerns. Serverless computing is driven by the reaction to events and triggers happening in near-real-time—in the cloud.
As a fully managed service, server management and capacity planning are invisible to the developer and billing is based just on resources consumed or the actual time your code is running.
Answer: Resource groups (RG) in Azure is an approach to group a collection of assets in logical groups for easy or even automatic provisioning, monitoring, and access control, and for more effective management of their costs. The underlying technology that powers resource groups is the Azure Resource Manager (ARM).
Source: onlinetech.com
Answer: Every Azure App Service web application includes a "hidden" service site called Kudu.
Kudu Console for example is a debugging service for Azure platform which allows you to explore your web app and surf the bugs present on it, like deployment logs, memory dump, and uploading files to your web app, and adding JSON endpoints to your web apps, etc.
Answer: A role instance is a virtual machine on which the application code and role configuration run. A role can have multiple instances, defined in the service configuration file.
Source: mindmajix.com
Answer: The guest operating system for a cloud service is the operating system installed on the role instances (virtual machines) on which your application code runs.
Source: mindmajix.com
Answer: Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data, such as text or binary data. Azure Storage offers three types of blobs:
- Block blobs store text and binary data, up to about 4.7 TB. Block blobs are made up of blocks of data that can be managed individually.
- Append blobs are made up of blocks like block blobs, but are optimized for append operations. Append blobs are ideal for scenarios such as logging data from virtual machines.
- Page blobs store random access files up to 8 TB in size. Page blobs store the VHD files that back VMs.
Source: docs.microsoft.com
Answer:
- Add the assembly to the BIN directory using KUDU
- Include the assembly and code the Azure Function to use it
- Add the using declaration so that the methods within the DLL can be accessed.
#r "D:\home\site\wwwroot\GreetingsAssemblyReference\bin\benjamin.dll"
using benjamin;
Answer: Azure Table storage is a service that stores structured NoSQL data in the cloud, providing a key/attribute store with a schemaless design.
Source: docs.microsoft.com
Answer: A Windows Azure subscription grants you access to Windows Azure services and to the Windows Azure Platform Management Portal. A Windows Azure subscription has two aspects:
- The Windows Azure account, through which resource usage is reported
- Services are billed.
Source: blogs.msdn.microsoft.com
Answer: The Azure Resource Manager (ARM) is the service used to provision resources in your Azure subscription. It was first announced at Build 2014 when the new Azure portal ( portal.azure.com) was announced and provides a new set of API's that are used to provision resources. The ARM is:
- Template-driven – Using templates to deploy all resources.
- Declarative – You declare the resources you want to have instead of imperative where you need to make rules.
- Idempotent – You can deploy the template over and over again without affecting the current state of resources.
- Multi-service – All services can be deployed using Azure Resource Manager, Website, Storage, VMs etc.
- Multi region - You can choose in which region you would like to deploy the resources.
- Extensible – Azure Resource Manager is extensible with more resource providers and thus resources.
Source: azurestack.blog
Answer: An Azure Resource Template is a JSON file used to deploy resources with Azure Resource Manager. It defines:
- Parameters
- Variables
- Resources - the actual resources that you are going to deploy or update
- Outputs
Source: onlinetech.com
Answer: A cloud service role is comprised of application files and a configuration. A cloud service can have two types of roles:
- web role
- worker role
Source: mindmajix.com
Answer: Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. Azure Redis Cache is based on the popular open-source Redis cache. It gives you access to a secure, dedicated Redis cache, managed by Microsoft, and accessible from any application within Azure. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.
Source: quora.com
Answer: Azure Service Fabric is a distributed systems platform that makes it easy to package, deploy, and manage scalable and reliable micro-services. Service Fabric also addresses the significant challenges in developing and managing cloud applications. Developers and administrators can avoid complex infrastructure problems and focus on implementing mission-critical, demanding workloads that are scalable, reliable, and manageable. Service Fabric represents the next-generation middleware platform for building and managing these enterprise-class, tier-1, cloud-scale applications.
Source: quora.com
Answer: Azure AD gives you an easy and secure way to connect to the web applications you choose. You can access these applications in the same way you access your SaaS apps in Azure AD, no need for a VPN to change your network infrastructure.
Source: quora.com
Answer: Key Vault help you safeguard cryptographic keys and other secrets used by your applications whenever they are On-Premise or in the cloud. More and more services on Azure are now integrating Azure Key Vault as their secret/key source for things like deployments, data or even disk encryption.
Source: codeisahighway.com
Answer: A container organizes a set of blobs, similar to a folder in a file system. All blobs reside within a container. A storage account can contain an unlimited number of containers, and a container can store an unlimited number of blobs.
Source: docs.microsoft.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q49: Is it possible to create a Virtual Machine using Azure Resource Manager in a Virtual Network that was created using classic deployment? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q53: What is the difference between “price,” “software price,” and “total price” in the cost structure for Virtual Machine offers in the Azure Marketplace? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
[⬆] Behavioral Interview Questions
Answer:
Answer:
Answer: The interviewer is looking for similar things whether asking about company or position. The hiring manager wants to:
- Learn about your career goals and how this position fits into your plan
- Make sure that you are sincerely interested in the job and will be motivated to perform if hired
- Find out what you know about the company, industry, position (and if you took the time to research)
- Understand your priorities and preferences — which aspects of the company and/or job are appealing to you and why?
Source: github.com/yangshun/tech-interview-handbook
Answer: Here are some things your interviewer is likely looking for:
- Did you leave for a good reason?
- Did you leave voluntarily?
- Did you leave on good terms?
- What are your work values?
Source: biginterview.com
Q5: A hammer and a nail cost $1.10 together, and the hammer costs one dollar more than the nail. How much does the nail cost? ⭐
Answer:
Source: startups.co
Answer:
Source: github.com/yangshun/tech-interview-handbook
Answer:
Answer:
Answer:
Answer:
Q11: State an experience about how you solved a technical problem. Be specific about the diagnosis and process. ⭐⭐
Answer:
Answer:
Answer:
Answer:
Answer:
Q16: Do prefer to work at a single company for a long time or would you rather take a job that suits you at the time? ⭐⭐
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Source: github.com
Answer:
Q23: How do you deal with difficult coworkers? Think about specific instances where you resolved conflicts. ⭐⭐
Answer:
Q24: Are you more interested in a career that offers great compensation, flexibility or the chance to do something meaningful? ⭐⭐
Answer:
Q25: If someone has a different viewpoint to do a project like different programming language, how would handle this situation? ⭐⭐
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Q37: Tell me a situation where you would have done something differently from what you actually did. ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Q38: If you were to open your own business in the future, what kind of business will you open and why? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q42: Tell me about a time your work responsibilities got a little overwhelming. What did you do? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Q43: Tell me about a challenge you faced recently in your role. How did you tackle it? What was the outcome? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q64: In my professional experience have you worked on something without getting approval from your manager? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q69: Tell me about a time you needed information from someone who wasn't responsive. What did you do? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q78: If you had an unlimited budget and you could buy one gift for one person, what would you buy and who would you buy it for? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q81: Imagine it is your first day here at the company. What do you want to work on? What features would you improve on? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Q82: How do you tackle challenges? Name a difficult challenge you faced while working on a project, how you overcame it, and what you learned. ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q94: What are the most interesting projects you have worked on and how might they be relevant to this company's environment? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q97: Imagine there's a perfect clone of yourself. Imagine that that clone is your boss. Would you like to work for him/her? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q100: Let's play a game: defend Cobol against modern languages, and try to find as many reasonable arguments as you can. ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q103: I want to refactor a legacy system. You want to rewrite it from scratch. Argument. Then, switch our roles. ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q107: As a software engineer you want both to innovate and to be predictable. How those 2 goals can coexist in the same strategy? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Q108: Is developing software an art, a craftsmanship or an engineering endeavour? Your opinion. ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Q109: If you were given $1 million dollars every year for the rest of your life, what would you do? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Bootstrap is a platform for web development that is based on front-end framework and creates exceptional responsive designs. It is fast, easy and has multiple templates designed using HTML, and CSS. These templates are used for forms, tables, buttons, typography, modals, tables, navigation, carousels and images. Bootstrap also has Javascript plugins, which are optional. Bootstrap is preferred for developing mobile web applications.
Source: medium.com/@onlineinerview
Answer: Bootstrap is CSS/Javascript framework for building the rich web applications with minimal effort. This framework emphasis more on building mobile web applications.
Source: medium.com/@alisonbenhar
Answer: There are two simple ways to display a code in Bootstrap:
<code>
tag: In case you wish to display an inline code<pre>
tag: In case you have a code with several lines or even a block element
Source: medium.com/@onlineinerview
Answer: In Bootstrap there are two types of Layout available
- Fluid Layout: Fluid layout is used when you want to create a app that is 100% wide and use up all the width of the screen
- Fixed Layout: For a standard screen you will use fixed layout (940 px) option
Source: medium.com/@alisonbenhar
Answer: Consider:
<ul class="list-unstyled">
<li>Item 1</li>
<li>Item 2</li>
<ul>
<li>Nested item 2.1</li>
<li>Nested item 2.2</li>
<li>Nested item 2.3</li>
</ul>
<li>Item 3</li>
</ul>
What will be the output of the following HTML code?
Answer:
If we apply .list-unstyled
to a list, it will remove the default list-style and left margin on the list items. But only for the immediate children. Main list items will be without any style, and nested list items will still have default unordered nested list-style.
Source: toptal.com
Answer: Bootstrap has features that are way better than other web development platforms. It provides an extensive browser support for almost every known browser such as Opera, Chrome, Firefox, Safari etc. With adequate knowledge of CSS and HTML, web development becomes easy on Bootstrap. Also, it supports mobile applications with the help of responsive design. It can adjust CSS as per the device, screen size etc. Instead of creating multiple files, it creates only a single file, which reduces any extra effort by the developer.
Source: medium.com/@onlineinerview
Answer: In total, there are five key components of Bootstrap i.e. CSS (multiple CSS files), **Scaffolding (**essential for the basic system that consist of Grid system, background and link styles), Layout Components: (shares a list of all layouts), JavaScript Plugins (includes jQuery and JavaScript plugins) and **Customization **(Allows customization of all components for a desired framework)
Source: medium.com/@onlineinerview
Answer: There are two major layouts for Bootstrap i.e. Fluid Layout and Fixed Layout. Fluid layout is necessary for creating an app that is 100 % wider and covers all the screen width. Fixed Layout is used only for a standard screen (940px). Both layouts can be used for creating a responsive design.
Source: medium.com/@onlineinerview
Answer: Jumbotron has a very basic function in bootstrap i.e. highlighting a content. It could either be a slogan/uvp (unique value proposition) or probably a headline. It increases the heading size and gives a margin for content of the landing page. In order to implement Jumbotron in a Bootstrap use:
<div class=”jumbotron”>
Jumbotron can have any valid HTML along with other functions and classes.
Source: medium.com/@onlineinerview
Answer: Bootstrap is a sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development. It uses HTML, CSS and Javascript.
Source: medium.com/@alisonbenhar
Answer: There are few reason why we choose Bootstrap for building websites
- Mobile Support: For mobile devices it provides full support in one single file rather than in separate file. It supports the responsive design including adjusting the CSS based on the different types of device, size of the screen etc. It reduces extra effort for developers.
- Easy to learn: Writing application in bootstrap is easy if you know CSS and HTML
- Browser Support: It supports all the popular browsers like Firefox, Opera, Safari, IE etc.
Source: medium.com/@alisonbenhar
Answer:
Bootstrap sets the global default font-size to 14px
, with a line-height of 1.428
. The default font is changed to Helvetica
and Arial
with sans serif
fallback.
All these styles are applied to the <body>
and all paragraphs, with the addition that <p>
(paragraphs) receive a bottom margin of half their computed line-height, which is 10px
by default.
Source: toptal.com
Answer:
There are several styling navigation elements available on bootstrap and every
style uses the same function i.e. class .nav
. In order to create tabs or a
tabular navigation, you can begin with a simple or rather basic unordered list
using the function class .nav
. To add the tabs the function class .nav-tabs
can
be used.
Source: medium.com/@onlineinerview
Answer: Glyphicons are icon fonts which you can use in your web projects. Glyphicons Halflings are not free and require licensing, however their creator has made them available for Bootstrap projects free of cost.
To use the icons, simply use the following code just about anywhere in your code. Leave a space between the icon and text for proper padding.
<span class="glyphicon glyphicon-search"></span>
Source: medium.com/@alisonbenhar
Answer:
To add some emphasis to a paragraph, add class .lead
. This will give you
larger font size, lighter weight, and a taller line height.
Source: medium.com/@alisonbenhar
Answer: Bootstrap sets a basic global display (background), typography, and link styles:
- Basic Global display − sets background-color: #fff; on the
- Typography − uses the @font-family-base, @font-size-base, and @line-height-base attributes as the typographic base
- Link styles − sets the global link color via attribute @link-color and apply link underlines only on :hover.
Source: medium.com/@alisonbenhar
Answer:
Bootstrap 3 allows to make the images responsive by adding a class
.img-responsive
to the <img>
tag. This class applies max-width: 100%;
and
height: auto;
to the image so that it scales nicely to the parent element.
Source: medium.com/@alisonbenhar
Answer: Consider:
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Example tooltip">Hover over me</button>
What is missing for a tooltip to show properly?
Answer
Bootstrap’s Tooltip plugin is not CSS-only, like other plugins are. For performance reasons, the Tooltip plugin is opt-in, and to use it you must initialize it using JavaScript with the following example code:
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
Source: medium.com/@alisonbenhar
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Using the inline style attribute on an element
<div>
<p style="color: maroon;"></p>
</div>
Using a <style>
block in the <head>
section of your HTML
<head>
<title>CSS Refresher</title>
<style>
body {
font-family: sans-serif;
font-size: 1.2em;
}
</style>
</head>
Loading an external CSS file using the <link>
tag
<head>
<title>CSS Refresher</title>
<link rel="stylesheet" href="/css/styles.css" />
</head>
Source: goskills.com
Answer: CSS stands for Cascading Style Sheets. CSS is used to define styles for your web pages, including the design, layout and variations in display for different devices and screen sizes.
CSS was intended to allow web professionals to separate the content and structure of a website's code from the visual design.
Source: w3schools.com
Answer: The Document Object Model (DOM) is a cross-platform and language-independent application programming interface that treats an HTML, XHTML, or XML document as a tree structure wherein each node is an object representing a part of the document.
With the Document Object Model, programmers can create and build documents, navigate their structure, and add, modify, or delete elements and content. The DOM specifies interfaces which may be used to manage XML or HTML documents.
When a browser displays a document, it must combine the document's content with its style information. The browser converts HTML and CSS into the DOM (Document Object Model). The DOM represents the document in the computer's memory. It combines the document's content with its style.
Source: en.wikipedia.org
Answer: The CSS box model is a rectangular layout paradigm for HTML elements that consists of the following:
- Content - The content of the box, where text and images appear
- Padding - A transparent area surrounding the content (i.e., the amount of space between the border and the content)
- Border - A border surrounding the padding (if any) and content
- Margin - A transparent area surrounding the border (i.e., the amount of space between the border and any neighboring elements)
Source: toptal.com
Answer: Web browsers apply CSS rules to a document to affect how they are displayed. A CSS rule is formed from:
- A set of properties, which have values set to update how the HTML content is displayed,
- A selector, which selects the element(s) you want to apply the updated property values to.
A set of CSS rules contained within a stylesheet determines how a webpage should look.
Source: developer.mozilla.org
Q6: What existing CSS frameworks have you used locally, or in production? How would you change/improve them? ⭐⭐
Answer:
- Bootstrap - Slow release cycle. Bootstrap 4 has been in alpha for almost 2 years. Add a spinner button component, as it is widely used.
- Semantic UI - Source code structure makes theme customization extremely hard to understand. Its unconventional theming system is a pain to customize. Hardcoded config path within the vendor library. Not well-designed for overriding variables unlike in Bootstrap.
- Bulma - A lot of non-semantic and superfluous classes and markup required. Not backward compatible. Upgrading versions breaks the app in subtle manners.
Source: codeburst.io
Answer: Yes. Flexbox is mainly meant for 1-dimensional layouts while Grid is meant for 2-dimensional layouts.
Flexbox solves many common problems in CSS, such as vertical centering of elements within a container, sticky footer, etc. Bootstrap and Bulma are based on Flexbox, and it is probably the recommended way to create layouts these days. Have tried Flexbox before but ran into some browser incompatibility issues (Safari) in using flex-grow
, and I had to rewrite my code using inline-blocks
and math to calculate the widths in percentages, it wasn't a nice experience.
Grid is by far the most intuitive approach for creating grid-based layouts (it better be!) but browser support is not wide at the moment.
Source: codeburst.io
Answer:
-
IDs — Meant to be unique within the document. Can be used to identify an element when linking using a fragment identifier. Elements can only have one id attribute.
-
Classes — Can be reused on multiple elements within the document. Mainly for styling and targeting elements.
Source: codeburst.io
Answer: Float is a CSS positioning property. Floated elements remain a part of the flow of the web page. This is distinctly different than page elements that use absolute positioning. Absolutely positioned page elements are removed from the flow of the webpage.
#sidebar {
float: right; // left right none inherit
}
The CSS clear property can be used to be positioned below left
/right
/both
floated elements.
Source: css-tricks.com
Answer: CSS sprites combine multiple images into one single larger image. It is commonly used technique for icons (Gmail uses it).
- Use a sprite generator that packs multiple images into one and generate the appropriate CSS for it.
- Each image would have a corresponding CSS class with
background-image
,background-position
andbackground-size
properties defined. - To use that image, add the corresponding class to your element.
Advantages:
- Reduce the number of HTTP requests for multiple images (only one single request is required per spritesheet). But with HTTP2, loading multiple images is no longer much of an issue.
- Advance downloading of assets that won’t be downloaded until needed, such as images that only appear upon
:hover
pseudo-states. Blinking wouldn't be seen.
Source: codeburst.io
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q16: What’s the difference between “resetting” and “normalizing” CSS? Which would you choose, and why? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q18: Explain your understanding of the box model and how you would tell the browser in CSS to render your layout in different box models. ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q25: What's the difference between a relative
, fixed
, absolute
and static
ally positioned element? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q29: What are the different ways to visually hide content (and make it available only for screen readers)? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q32: Can you explain the difference between coding a website to be responsive versus using a mobile-first strategy? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q34: Is there any reason you'd want to use translate()
instead of absolute
positioning, or vice-versa? And why? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
[⬆] Code Problems Interview Questions
Details: You will be given 2 parameters: a low and high number. Your goal is to print all numbers between low and high, and for each of these numbers print whether or not the number is divisible by 3. If the number is divisible by 3, print the word "div3" directly after the number.
Answer: We'll solve this problem by first creating a loop that will print each number from low to high. Once we have the code for that written, we'll add a conditional that will check if the number is evenly divisible by 3 by using the mod operator.
function test_divisors(low, high) {
// we'll store all numbers and strings within an array
// instead of printing directly to the console
var output = [];
for (var i = low; i <= high; i++) {
// simply store the current number in the output array
output.push(i);
// check if the current number is evenly divisible by 3
if (i % 3 === 0) { output.push('div3'); }
}
// return all numbers and strings
return output;
}
test_divisors(2, 10);
Source: coderbyte.com
Details: Write a function that takes an array of integers and returns the sum of the integers after adding 1 to each.
Answer:
// ES5 method is nice and clean
exports.es5 = function (array) {
return array.reduce(function (memo, num) {
return memo + num;
}, array.length);
};
// Without array.reduce method isn't much different
exports.iterative = function (array) {
var result = array.length;
for (var i = 0; i < array.length; i++) {
result += array[i];
}
return result;
};
Source: github.com/blakeembrey
Details:
Find out if a string is a rotation of another string. E.g. ABCD
is a rotation of BCDA
but not ACBD
.
Answer:
First make sure a
and b
are of the same length. Then check to see if b
is a substring of a
concatenated with a
:
module.exports = function (a, b) {
return a.length === b.length && (a + a).indexOf(b) > -1;
};
Source: github.com/blakeembrey
Details:
Write a function called oddball_sum
which takes in a list of numbers and returns the sum of all the odd elements. Try to solve with and without reduce
function.
Answer: To solve this challenge we'll simply loop through the array while maintaining a final count, and every time an odd number is encountered we'll add it to the count.
Without reduce
:
function oddball_sum(nums) {
// final count of all odd numbers added up
var final_count = 0;
// loop through entire list
for (var i = 0; i < nums.length; i++) {
// we divide by 2, and if there is a remainder then
// the number must be odd so we add it to final_count
if (nums[i] % 2 === 1) {
final_count += nums[i]
}
}
return final_count;
}
oddball_sum([1, 2, 3, 4, 5]);
With reduce
:
function oddball_sum(nums) {
return nums.reduce(function(total, item){
if (item % 2 === 1) {
return total += item;
}
return total;
});
}
Source: prepwork.appacademy.io
Details:
You will be given a number N
that represents where the minute hand currently is on a clock. Your program should return the angle that is formed by the minute hand and the 12
o'clock mark on the clock.
Answer:
If the input is 15
then your program should return 90
because a 90
-degree angle is formed by the minute hand and the 12
o'clock mark on the clock. We'll solve this challenge by first calculating what angle is created by each minute passing on a clock. Once we calculate this number, we multiply it by the input to determine the final angle.
A method to solve such problems is to consider the rate of change of the angle in degrees per minute. The hour hand of a normal 12-hour
analogue clock turns 360°
in 12
hours (720
minutes) or 0.5°
per minute. The minute hand rotates through 360°
in 60
minutes or 6°
per minute.
function simpleClockAngle(num) {
// we got 6 because 360/60 = 6
// 360 represents the full number of a degrees in a circle and
// 60 is the number of minutes on a clock, so dividing these two numbers
// gives us the number of degrees for one minute
return 6 * num;
}
simpleClockAngle(15);
Source: coderbyte.com
Details:
You will be given an array of several arrays that each contain integers and your goal is to write a function that will sum up all the numbers in all the arrays. For example, if the input is [[3, 2], [1], [4, 12]]
then your program should output 22
because 3 + 2 + 1 + 4 + 12 = 22
. Solve without and with reduce
.
Answer: We will solve this challenge by looping through the entire array, and then looping through each inner array adding up all the numbers.
function sum_array(arr) {
// store our final answer
var sum = 0;
// loop through entire array
for (var i = 0; i < arr.length; i++) {
// loop through each inner array
for (var j = 0; j < arr[i].length; j++) {
// add this number to the current final sum
sum += arr[i][j];
}
}
return sum;
}
sum_array([[3, 2], [1], [4, 12]]);
With reduce
:
function sumArray(arr) {
return arr.reduce((t, e) => t.concat(e)).reduce((t, e) => t + e)
}
Source: coderbyte.com
Details:
Write a function called lucky_sevens
which takes an array of integers and returns true if any three consecutive elements sum to 7.
Answer:
To solve this challenge we'll simply loop through the array starting at the 3rd position, and checking if the number at this index plus the two previous elements sums to 7. We continue doing this as we loop through the entire array. Once we find three elements that sum to 7, we simply return true
. If we reach the end of the array without finding elements that sum to 7, we return false
.
function lucky_sevens(arr) {
// if less than 3 elements then this challenge is not possible
if (arr.length < 3) {
return "not possible";
}
// because we know there are at least 3 elements we can
// start the loop at the 3rd element in the array (i=2)
// and check it along with the two previous elements (i-1) and (i-2)
for (var i = 2; i < arr.length; i++) {
if (arr[i] + arr[i-1] + arr[i-2] === 7) {
return true;
}
}
// if loop is finished and no elements summed to 7
return false;
}
lucky_sevens([2, 1, 5, 1, 0]);
Source: coderbyte.com
Details:
Given an integer x
and a sorted array a of N
distinct integers, design a linear-time algorithm to determine if there exists two distinct indices i
and j
such that a[i] + a[j] == x
For example, if the array is [3, 5, 2, -4, 8, 11]
and the sum is 7
,
your program should return [[11, -4], [2, 5]]
because 11 + -4 = 7
and 2 + 5 = 7
.
Answer:
The algorithm below makes use of hash tables which have a constant lookup time. As we pass through each element in the array, we check to see if S minus the current element exists in the hash table. We only need to loop through the array once, resulting in a running time of O(n)
since each lookup and insertion in a hash table is O(1)
.
// our two sum function which will return
// all pairs in the array that sum up to S
function twoSum(arr, S) {
var sums = [];
var hashTable = {};
// check each element in array
for (var i = 0; i < arr.length; i++) {
// calculate S - current element
var sumMinusElement = S - arr[i];
// check if this number exists in hash table
// if so then we found a pair of numbers that sum to S
if (hashTable[sumMinusElement.toString()] !== undefined) {
sums.push([arr[i], sumMinusElement]);
}
// add the current number to the hash table
hashTable[arr[i].toString()] = arr[i];
}
// return all pairs of integers that sum to S
return sums;
}
twoSum([3, 5, 2, -4, 8, 11], 7);
Source: coderbyte.com
Answer:
We will store a reference to the front and back of the queue in order to make enqueuing and dequeuing run in O(1)
constant time. Every time we want to insert into the queue, we add the new element to the end of the linked list and update the back pointer. When we want to dequeue we return the first node in the linked list and update the front pointer.
// queue is initially empty
var Queue = {front: null, back: null};
// we will use a node to keep track of the elements
// in the queue which is represented by a linked list
function Node(data, next) {
this.data = data;
this.next = next;
}
// add elements to queue in O(1) time
function Enqueue(element) {
var N = new Node(element, null);
if (Queue.back === null) {
Queue.front = N;
Queue.back = N;
} else {
Queue.back.next = N;
Queue.back = Queue.back.next;
}
}
// remove first element from queue in O(1) time
function Dequeue() {
if (Queue.front !== null) {
var first = Queue.front;
Queue.front = Queue.front.next;
return first.data;
} else {
if (Queue.back !== null) { Queue.back = null; }
return 'Cannot dequeue because queue is empty';
}
}
Enqueue('a');
Enqueue('b');
Enqueue('c');
Dequeue();
Source: codeisahighway.com
Details: Given a binary tree of integers, print it in level order. The output will contain space between the numbers in the same level, and new line between different levels.
Answer:
module.exports = function (root) {
// Doing a breadth first search using recursion.
(function walkLevel (children) {
// Create a new queue for the next level.
var queue = [],
output;
// Use the map function to easily join all the nodes together while pushing
// it's children into the next level queue.
output = children.map(function (node) {
// Assuming the node has children stored in an array.
queue = queue.concat(node.children || []);
return node.value;
}).join(' ');
// Log the output at each level.
console.log(output);
// If the queue has values in it, recurse to the next level and walk
// along it.
queue.length && walkLevel(queue);
})([root]);
};
Source: ardendertat.com
Details: You will be given a list of stock prices for a given day and your goal is to return the maximum profit that could have been made by buying a stock at the given price and then selling the stock later on.
For example if the input is:
[45, 24, 35, 31, 40, 38, 11]
then your program should return 16 because if you bought the stock at $24 and sold it at $40, a profit of $16 was made and this is the largest profit that could be made. If no profit could have been made, return -1.
Answer: We'll solve the challenge the following way:
- Iterate through each number in the list.
- At the ith index, get the
i+1
index price and check if it is larger than the ith index price. - If so, set
buy_price = i
andsell_price = i+1
. Then calculate the profit:sell_price - buy_price
. - If a stock price is found that is cheaper than the current
buy_price
, set this to be the new buying price and continue from step 2. - Otherwise, continue changing only the
sell_price
and keepbuy_price
set.
This algorithm runs in linear time, making only one pass through the array, so the running time in the worst case is O(n)
.
function StockPicker(arr) {
var max_profit = -1;
var buy_price = 0;
var sell_price = 0;
// this allows our loop to keep iterating the buying
// price until a cheap stock price is found
var change_buy_index = true;
// loop through list of stock prices once
for (var i = 0; i < arr.length-1; i++) {
// selling price is the next element in list
sell_price = arr[i+1];
// if we have not found a suitable cheap buying price yet
// we set the buying price equal to the current element
if (change_buy_index) { buy_price = arr[i]; }
// if the selling price is less than the buying price
// we know we cannot make a profit so we continue to the
// next element in the list which will be the new buying price
if (sell_price < buy_price) {
change_buy_index = true;
continue;
}
// if the selling price is greater than the buying price
// we check to see if these two indices give us a better
// profit then what we currently have
else {
var temp_profit = sell_price - buy_price;
if (temp_profit > max_profit) { max_profit = temp_profit; }
change_buy_index = false;
}
}
return max_profit;
}
StockPicker([44, 30, 24, 32, 35, 30, 40, 38, 15]);
Source: coderbyte.com
Details: Given a text file and a word, find the positions that the word occurs in the file. We’ll be asked to find the positions of many words in the same file.
Answer: Since we’ll have to answer multiple queries, precomputation would be useful. We’ll build a data structure that stores the positions of all the words in the text file. This is known as inverted index.
module.exports = function (text) {
var trie = {},
pos = 0,
active = trie; // Start the active structure as the root trie structure
// Suffix a space after the text to make life easier
text += ' ';
// Loop through the input text adding it to the trie structure
for (var i = 0; i < text.length; i++) {
// When the character is a space, restart
if (text[i] === ' ') {
// If the current active doesn't equal the root, set the position
if (active !== trie) {
(active.positions = active.positions || []).push(pos);
}
// Reset the positions and the active part of the data structure
pos = i;
active = trie;
continue;
}
// Set the next character in the structure up
active[text[i]] = (active[text[i]] || {});
active = active[text[i]];
}
// Return a function that accepts a word and looks it up in the trie structure
return function (word) {
var i = -1,
active = trie;
while (word[++i]) {
if (!active[word[i]]) { return []; }
active = active[word[i]];
}
return active.positions;
};
};
Source: github.com/blakeembrey
Details:
You will be given an array with 5
numbers. The first 2 numbers represent a range, and the next two numbers represent another range. The final number in the array is X
. The goal of your program is to determine if both ranges overlap by at least X
numbers. For example, in the array [4, 10, 2, 6, 3]
the ranges 4
to 10
and 2
to 6
overlap by at least 3
numbers (4, 5, 6)
, so your program should return true
. Solve with and without looping.
If the array is [10, 20, 4, 14, 4]
then the ranges are:
10 11 12 13 14 15 16 17 18 19 20
4 5 6 7 8 9 10 11 12 13 14
These ranges overlap by at least 4
numbers, namely: 10, 11, 12, 13, 14
so your program should return true
.
Answer: With loop:
function OverlappingRanges(arr) {
// keep a count of how many numbers overlap
var counter = 0;
// loop through one of the ranges
for (var i = arr[0]; i < arr[1]; i++) {
// check if a number within the first range exists
// in the second range
if (i >= arr[2] && i <= arr[3]) {
counter += 1;
}
}
// check if the numbers that overlap is equal to or greater
// than the last number in the array
return (counter >= arr[4]) ? true : false;
}
OverlappingRanges([4, 10, 2, 6, 3]);
Without loop:
function overlapping(input){
var nums1 = listOfNums(input[0], input[1]);
var nums2 = listOfNums(input[2], input[3]);
var overlappingNum = 0;
if(nums1[0] >= nums2[0] && nums1[0] <= nums2[1]){
overlappingNum = nums2[1] - nums1[0] + 1;
} else {
overlappingNum = nums1[1] - nums2[0] + 1;
}
if(overlappingNum >= input[4]){
return true;
}
}
function listOfNums(a, b){
var start = a;
var end = b;
if(a > b){
start = b;
end = a;
}
return [a, b];
}
var a = [4, 10, 2, 6, 3];
overlapping(a)
Source: coderbyte.com
Details:
Write a function that accepts a function and timeout, x
, in number of milliseconds. It returns a function that can only be executed once per x
milliseconds. This can be useful for limiting the number of time and computation heavy function that are run. For example, making AJAX requests to an autocompletion API.
Once written, add a third parameter that will allow the function to be executed immediately if set to true. Otherwise the function will run at the end of the timeout period.
Answer:
module.exports = function (fn, delay, execAsap) {
var timeout; // Keeps a reference to the timeout inside the returned function
return function () {
// Continue to pass through the function execution context and arguments
var that = this,
args = arguments;
// If there is no timeout variable set, proceed to create a new timeout
if (!timeout) {
execAsap && fn.apply(that, args);
timeout = setTimeout(function () {
execAsap || fn.apply(that, args);
// Remove the old timeout variable so the function can run again
timeout = null;
}, delay || 100);
}
};
};
Source: github.com/blakeembrey
Details:
For this problem, your goal is to sort an array of 0
, 1
, 2
but you must do this in place, in linear time and without any extra space (such as creating an extra array). This is called the Dutch national flag sorting problem. For example, if the input array is [2,0,0,1,2,1]
then your program should output [0,0,1,1,2,2]
and the algorithm should run in O(n)
time.
Answer: The solution to this algorithm will require 3 pointers to iterate throughout the array, swapping the necessary elements.
- Create a low pointer at the beginning of the array and a high pointer at the end of the array.
- Create a mid pointer that starts at the beginning of the array and iterates through each element.
- If the element at
arr[mid]
is a2
, then swaparr[mid]
andarr[high]
and decrease the high pointer by1
. - If the element at
arr[mid]
is a0
, then swaparr[mid]
andarr[low]
and increase the low and mid pointers by1
. - If the element at
arr[mid]
is a1
, don't swap anything and just increase the mid pointer by1
.
function swap(arr, i1, i2) {
var temp = arr[i1];
arr[i1] = arr[i2];
arr[i2] = temp;
}
function dutchNatFlag(arr) {
var low = 0;
var mid = 0;
var high = arr.length - 1;
// one pass through the array swapping
// the necessary elements in place
while (mid <= high) {
if (arr[mid] === 0) { swap(arr, low++, mid++); }
else if (arr[mid] === 2) { swap(arr, mid, high--); }
else if (arr[mid] === 1) { mid++; }
}
return arr;
}
dutchNatFlag([2,2,2,0,0,0,1,1]);
Source: coderbyte.com
Details:
Suppose you want climb a staircase of N steps, and on each step you can take either 1 or 2 steps. How many distinct ways are there to climb the staircase? For example, if you wanted to climb 4 steps, you can take the following distinct number of steps:
1) 1, 1, 1, 1
2) 1, 1, 2
3) 1, 2, 1
4) 2, 1, 1
5) 2, 2
So there are 5 distinct ways to climb 4 steps. We want to write a function, using recursion, that will produce the answer for any number of steps.
Answer:
The solution to this problem requires recursion, which means to solve for a particular N
, we need the solutions for previous N's. The solution for N steps is equal to the solutions for N - 1
steps plus N - 2
steps.
function countSteps(N) {
// just as in our solution explanation above, we know that to climb 1 step
// there is only 1 solution, and for 2 steps there are 2 solutions
if (N === 1) { return 1; }
if (N === 2) { return 2; }
// for all N > 2, we add the previous (N - 1) + (N - 2) steps to get
// an answer recursively
return countSteps(N - 1) + countSteps(N - 2);
}
// the solution for N = 6 will recursively be solved by calculating
// the solution for N = 5, N = 4, N = 3, and N = 2 which we know is 2
countSteps(6);
Source: coderbyte.com
Answer: The steps in the bubble sort algorithm are:
- Loop through the whole array starting from index
1
- If the number in the array at index
i-1
is greater than i, swap the numbers and continue - Once the end of the array is reached, start looping again from the beginning
- Once no more elements can be swapped, the sorting is complete
function swap(arr, i1, i2) {
var temp = arr[i1];
arr[i1] = arr[i2];
arr[i2] = temp;
}
function bubblesort(arr) {
var swapped = true;
// keep going unless no elements can be swapped anymore
while (swapped) {
// set swapped to false so that the loop stops
// unless two element are actually swapped
swapped = false;
// loop through the whole array swapping adjacent elements
for (var i = 1; i < arr.length; i++) {
if (arr[i-1] > arr[i]) {
swap(arr, i-1, i);
swapped = true;
}
}
}
return arr;
}
bubblesort([103, 45, 2, 1, 97, -4, 67]);
Source: coderbyte.com
Answer:
Suppose we push a
, b
, c
to a stack. If we are trying to implement a queue and we call the dequeue method 3 times, we actually want the elements to come out in the order: a
, b
, c
, which is in the opposite order they would come out if we popped from the stack. So, basically, we need to access the elements in the reverse order that they exist in the stack.
Algorithm for queue using two stacks:
- When calling the enqueue method, simply push the elements into the stack 1.
- If the dequeue method is called, push all the elements from stack 1 into stack 2, which reverses the order of the elements. Now pop from stack 2.
The worst case running time for implementing these operations using stacks is O(n)
because you need to transfer n elements from stack 1 to stack 2 when a dequeue method is called. Pushing to stack 1 is simply O(1)
.
// implement stacks using plain arrays with push and pop functions
var Stack1 = [];
var Stack2 = [];
// implement enqueue method by using only stacks
// and the push and pop functions
function Enqueue(element) {
Stack1.push(element);
}
// implement dequeue method by pushing all elements
// from stack 1 into stack 2, which reverses the order
// and then popping from stack 2
function Dequeue() {
if (Stack2.length === 0) {
if (Stack1.length === 0) { return 'Cannot dequeue because queue is empty'; }
while (Stack1.length > 0) {
var p = Stack1.pop();
Stack2.push(p);
}
}
return Stack2.pop();
}
Enqueue('a');
Enqueue('b');
Enqueue('c');
Dequeue();
Source: coderbyte.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
[⬆] Data Structures Interview Questions
Answer: Data structure availability may vary by programming languages. Commonly available data structures are:
- list,
- arrays,
- stack,
- queues,
- graph,
- tree etc.
Source: tutorialspoint.com
Answer: Algorithm is a step by step procedure, which defines a set of instructions to be executed in certain order to get the desired output.
Source: tutorialspoint.com
Answer:
Linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Linear search runs in at worst linear time and makes at most n
comparisons, where n
is the length of the list.
- Worst-case performance
O(n)
- Best-case performance
O(1)
- Average performance
O(n)
- Worst-case space complexity
O(1)
iterative
In theory other search algorithms may be faster than linear search (for instance binary search), in practice even on medium-sized arrays (around 100 items or less) it might be infeasible to use anything else.
Source: wikipedia.org
Answer: Asymptotic analysis of an algorithm, refers to defining the mathematical boundation/framing of its run-time performance. Using asymptotic analysis, we can very well conclude the best case, average case and worst case scenario of an algorithm.
Asymptotic analysis can provide three levels of mathematical binding of execution time of an algorithm:
- Best case is represented by Ω(n) notation.
- Worst case is represented by Ο(n) notation.
- Average case is represented by Θ(n) notation.
Source: tutorialspoint.com
Answer: A linear data-structure has sequentially arranged data items. The next item can be located in the next memory address. It is stored and accessed in a sequential manner. Array and list are example of linear data structure.
The following operations are commonly performed on any data-structure:
- Insertion − adding a data item
- Deletion − removing a data item
- Traversal − accessing and/or printing all data items
- Searching − finding a particular data item
- Sorting − arranging data items in a pre-defined sequence
Source: tutorialspoint.com
Answer: Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.
Bubble sort has a worst-case and average complexity of О(n2)
, where n
is the number of items being sorted. Most practical sorting algorithms have substantially better worst-case or average complexity, often O(n log n)
. Therefore, bubble sort is not a practical sorting algorithm.
Source: wikipedia.org
Answer: The below given problems find their solution using greedy algorithm approach:
- Travelling Salesman Problem
- Prim's Minimal Spanning Tree Algorithm
- Kruskal's Minimal Spanning Tree Algorithm
- Dijkstra's Minimal Spanning Tree Algorithm
- Graph - Map Coloring
- Graph - Vertex Cover
- Knapsack Problem
- Job Scheduling Problem
Source: tutorialspoint.com
Answer: The below given problems find their solution using divide and conquer algorithm approach:
- Merge Sort
- Quick Sort
- Binary Search
- Strassen's Matrix Multiplication
- Closest pair (points)
Source: tutorialspoint.com
Answer: The below given problems find their solution using divide and conquer algorithm approach:
- Fibonacci number series
- Knapsack problem
- Tower of Hanoi
- All pair shortest path by Floyd-Warshall
- Shortest path by Dijkstra
- Project scheduling
Source: tutorialspoint.com
Answer: In data-structure, stack is an Abstract Data Type (ADT) used to store and retrieve values in Last In First Out (LIFO) method.
Stacks follows LIFO method and addition and retrieval of a data item takes only Ο(n)
time. Stacks are used where we need to access data in the reverse order or their arrival. Stacks are used commonly in recursive function calls, expression parsing, depth first traversal of graphs etc.
The below operations can be performed on a stack:
- push() − adds an item to stack
- pop() − removes the top stack item
- peek() − gives value of top item without removing it
- isempty() − checks if stack is empty
- isfull() − checks if stack is full
Source: tutorialspoint.com
Answer: Queue is an abstract data structure (ADS), somewhat similar to stack. In contrast to stack, queue is opened at both end. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). Queue follows First-In-First-Out (FIFO) methodology, i.e., the data item stored first will be accessed first.
As queues follows FIFO method, they are used when we need to work on data-items in exact sequence of their arrival. Every operating system maintains queues of various processes. Priority queues and breadth first traversal of graphs are some examples of queues.
The below operations can be performed on a queue:
- enqueue() − adds an item to rear of the queue
- dequeue() − removes the item from front of the queue
- peek() − gives value of front item without removing it
- isempty() − checks if stack is empty
- isfull() − checks if stack is full
Source: tutorialspoint.com
Answer:
-
A linear search looks down a list, one item at a time, without jumping. In complexity terms this is an
O(n)
search - the time taken to search the list gets bigger at the same rate as the list does. -
A binary search is when you start with the middle of a sorted list, and see whether that's greater than or less than the value you're looking for, which determines whether the value is in the first or second half of the list. Jump to the half way through the sublist, and compare again etc. In complexity terms this is an
O(log n)
search - the number of search operations grows more slowly than the list does, because you're halving the "search space" with each operation.
Comparing the two:
- Binary search requires the input data to be sorted; linear search doesn't
- Binary search requires an ordering comparison; linear search only requires equality comparisons
- Binary search has complexity
O(log n)
; linear search has complexity O(n) - Binary search requires random access to the data; linear search only requires sequential access (this can be very important - it means a linear search can stream data of arbitrary size)
Source: wikipedia.org
Answer: A problem can be solved in more than one ways. So, many solution algorithms can be derived for a given problem. We analyze available algorithms to find and implement the best suitable algorithm.
An algorithm are generally analyzed on two factors − time and space. That is, how much execution time and how much extra space required by the algorithm.
Source: tutorialspoint.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
[⬆] Design Patterns Interview Questions
Answer: The Design patterns can be classified into three main categories:
- Creational Patterns
- Behavioral Patterns
- Functional Patterns
Source: www.educba.com
Answer: Patterns in programming are like recipes in cooking. They are not ready dishes, but instructions for slicing and dicing products, cooking them, serving them and so forth.
Pattern content As a rule, a pattern description consists of the following:
- a problem that the pattern solves;
- motivation for solving the the problem using the method suggested by the pattern;
- structures of classes comprising the solution;
- an example in one of the programming languages;
- a description of the nuances of pattern implementation in various contexts; relations with other patterns.
Source: refactoring.guru
Answer: Singleton pattern comes under creational patterns category and introduces a single class which is responsible to create an object while making sure that only single object gets created. This class provides a way to access its only object which can be accessed directly without need to instantiate the object of the class.
Source: refactoring.guru
Answer: Design patterns are a well-described solution to the most commonly encountered problems which occur during software development.
Design pattern represents the best practices evolved over a period of time by experienced software developers. They promote reusability which leads to a more robust and maintainable code.
Source: www.educba.com
Answer: Factory pattern is one of most used design pattern and comes under creational patterns category.
In Factory pattern, we create object without exposing the creation logic to the client and refer to newly created object using a common interface.
**Pro's**:
- Allows you to hide implementation of an application seam (the core interfaces that make up your application)
- Allows you to easily test the seam of an application (that is to mock/stub) certain parts of your application so you can build and test the other parts
- Allows you to change the design of your application more readily, this is known as loose coupling
Con's
- Makes code more difficult to read as all of your code is behind an abstraction that may in turn hide abstractions.
- Can be classed as an anti-pattern when it is incorrectly used, for example some people use it to wire up a whole application when using an IOC container, instead use Dependency Injection.
Source: tutorialspoint.com
Answer: Iterator pattern is very commonly used design pattern in Java and .Net programming environment. This pattern is used to get a way to access the elements of a collection object in sequential manner without any need to know its underlying representation. Iterator pattern falls under behavioral pattern category.
Source: tutorialspoint.com
Answer:
Inversion of control is a broad term but for a software developer it's most commonly described as a pattern used for decoupling components and layers in the system.
For example, say your application has a text editor component and you want to provide spell checking. Your standard code would look something like this:
public class TextEditor {
private SpellChecker checker;
public TextEditor() {
this.checker = new SpellChecker();
}
}
What we've done here creates a dependency between the TextEditor and the SpellChecker. In an IoC scenario we would instead do something like this:
public class TextEditor {
private IocSpellChecker checker;
public TextEditor(IocSpellChecker checker) {
this.checker = checker;
}
}
You have inverted control by handing the responsibility of instantiating the spell checker from the TextEditor class to the caller.
SpellChecker sc = new SpellChecker; // dependency
TextEditor textEditor = new TextEditor(sc);
Source: stackoverflow.com
Answer: Yesl, we can but the purpose of Singleton Object creation is to have single instance serving all requests.
Source: tutorialspoint.com
Answer: Design patterns can be classified in three categories: Creational, Structural and Behavioral patterns.
-
Creational Patterns - These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new opreator. This gives program more flexibility in deciding which objects need to be created for a given use case.
-
Structural Patterns - These design patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.
-
Behavioral Patterns - These design patterns are specifically concerned with communication between objects.
Source: tutorialspoint.com
Answer: In Template pattern, an abstract class exposes defined way(s)/template(s) to execute its methods. Its subclasses can override the method implementation as per need but the invocation is to be in the same way as defined by an abstract class. This pattern comes under behavior pattern category.
Source: tutorialspoint.com
Answer: Filter pattern or Criteria pattern is a design pattern that enables developers to filter a set of objects using different criteria and chaining them in a decoupled way through logical operations. This type of design pattern comes under structural pattern as this pattern combines multiple criteria to obtain single criteria.
Filter design pattern is useful where you want to add filters dynamically or you are implementing multiple functionalities and most of them require different filter criteria to filter something. In that case instead of hard coding the filters inside the functionalities, you can create filter criteria and re-use it wherever required.
List<Laptop> laptops = LaptopFactory.manufactureInBulk();
AndCriteria searchCriteria = new AndCriteria(
new HardDisk250GBFilter(),
new MacintoshFilter(),
new I5ProcessorFilter());
List<Laptop> filteredLaptops = searchCriteria.meets(laptops);
Source: tutorialspoint.com
Answer: In Strategy pattern, a class behavior or its algorithm can be changed at run time. This type of design pattern comes under behavior pattern.
In Strategy pattern, we create objects which represent various strategies and a context object whose behavior varies as per its strategy object. The strategy object changes the executing algorithm of the context object.
Source: tutorialspoint.com
Answer: Dependency injection makes it easy to create loosely coupled components, which typically means that components consume functionality defined by interfaces without having any first-hand knowledge of which implementation classes are being used.
Dependency injection makes it easier to change the behavior of an application by changing the components that implement the interfaces that define application features. It also results in components that are easier to isolate for unit testing.
Source: Pro ASP.NET Core MVC 2
Answer: In Null Object pattern, a null object replaces check of NULL object instance. Instead of putting if check for a null value, Null Object reflects a do nothing relationship. Such Null object can also be used to provide default behaviour in case data is not available.
In Null Object pattern, we create an abstract class specifying various operations to be done, concrete classes extending this class and a null object class providing do nothing implementation of this class and will be used seamlessly where we need to check null value.
Source: tutorialspoint.com
Answer: In State pattern a class behavior changes based on its state. This type of design pattern comes under behavior pattern. In State pattern, we create objects which represent various states and a context object whose behavior varies as its state object changes.
Source: tutorialspoint.com
Answer: In proxy pattern, a class represents functionality of another class. This type of design pattern comes under structural pattern.
In proxy pattern, we create object having original object to interface its functionality to outer world.
Source: tutorialspoint.com
Answer: Builder pattern builds a complex object using simple objects and using a step by step approach. This builder is independent of other objects.
The Director class is optional and is used to make sure that the building steps are executed in the right order with the right data by the right builder. It's about validation and delegation.
Builder/Director pattern's steps invocations could be semantically presented by method chaining or so called Fluent Interface syntax.
Pizza pizza = new Pizza.Builder()
.cheese(true)
.pepperoni(true)
.bacon(true)
.build();
Source: tutorialspoint.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: The most important thing that DevOps helps us achieve is to get the changes into production as quickly as possible while minimising risks in software quality assurance and compliance. This is the primary objective of DevOps.
Source: edureka.co
Answer: Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.
Source: edureka.co
Answer: DevOps is a newly emerging term in IT field, which is nothing but a practice that emphasizes the collaboration and communication of both software developers and other information-technology (IT) professionals. It focuses on delivering software product faster and lowering the failure rate of releases.
Source: quora.com
Answer: Nowadays instead of releasing big sets of features, companies are trying to see if small features can be transported to their customers through a series of release trains. This has many advantages like quick feedback from customers, better quality of software etc. which in turn leads to high customer satisfaction. To achieve this, companies are required to:
- Increase deployment frequency
- Lower failure rate of new releases
- Shortened lead time between fixes
- Faster mean time to recovery in the event of new release crashing
DevOps fulfills all these requirements and helps in achieving seamless software delivery.
Source: edureka.co
Answer: What the interview means is do you do more sysadmin work, or do you spend a lot of time working with developers on coding?
Source: vminstall.com
Answer: The key aspects or principle behind DevOps are:
- Infrastructure as code
- Continuous deployment
- Automation
- Monitoring
- Security
Source: quora.com
Answer:
- Maintain a code repository
- Automate the build
- Make the build self-testing
- Everyone commits to the baseline every day
- Every commit (to baseline) should be built
- Keep the build fast
- Test in a clone of the production environment
- Make it easy to get the latest deliverables
- Everyone can see the results of the latest build
- Automate deployment
Source: edureka.co
Answer:
Source: logz.io
Answer: Continuous Monitoring allows timely identification of problems or weaknesses and quick corrective action that helps reduce expenses of an organization. Continuous monitoring provides solution that addresses three operational disciplines known as:
- continuous audit
- continuous controls monitoring
- continuous transaction inspection
Source: quora.com
Answer: Technical benefits:
- Continuous software delivery
- Less complex problems to fix
- Faster resolution of problems
Business benefits:
- Faster delivery of features
- More stable operating environments
- More time available to add value (rather than fix/maintain)
Source: edureka.co
Answer:
- Agile software development methodology focuses on the development of software.
- DevOps on the other hand is responsible for development as well as deployment of the software in the safest and most reliable way possible.
Source: edureka.co
Answer: Post mortem meeting is a meeting where we discuss what went wrong and what steps should be taken so that failure doesn't happen again. Post mortem meetings are not about finding the one to be blamed, they are for preventing outages from reoccurring and planing redesign of the infrastructure so that downtime can be minimised. It is about learning from mistakes.
Source: linoxide.com
Answer:
Source: github.com
Answer: DevOps is a movement to reconcile and synchronize development and production start through a set of good practices . Its emergence is motivated by a deep changing demands of business, who want to speed up the changes to stick closer to the requirements of business and the customer.
Source: linoxide.com
Answer: DevOps engineer work very closely with Agile development teams to ensure they have an environment necessary to support functions such as automated testing, continuous Integration and continuous Delivery. DevOps engineer must be in constant contact with the developers and make all required parts of environment work seamlessly.
Source: linoxide.com
Answer: Containerisation is a type of virtualization strategy that emerged as an alternative to traditional hypervisor-based virtualization.
In containerization, the operating system is shared by the different containers rather than cloned for each virtual machine. For example Docker provides a container virtualization platform that serves as a good alternative to hypervisor-based arrangements.
Source: linoxide.com
Answer: CI server function is to continuously integrate all changes being made and committed to repository by different developers and check for compile errors. It needs to build code several times a day, preferably after every commit so it can detect which commit made the breakage if the breakage happens.
Source: linoxide.com
Answer: The most popular DevOps tools are:
- Git: Version Control System tool
- Jenkins: Continuous Integration tool
- Selenium: Continuous Testing tool
- Puppet, Chef, Ansible: Configuration Management and Deployment tools
- Nagios: Continuous Monitoring tool
- Docker: Containerization tool
Source: edureka.co
Answer: Configuration Management tools' purpose is to automatize deployment and configuration of software on big number of servers. Most CM tools usually use agent architecture which means that every machine being manged needs to have agent installed.
One tool that uses agentless architecture is Ansible. It only requires SSH and Python. And if raw module is being used, not even Python is required because it can run raw bash commands. Other available and popular CM tools are Puppet, Chef, SaltStack.
Source: linoxide.com
Q20: Tell me about the worst-run/best-run outage you’ve been a part of. What made it bad/well-run? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q24: What are the differences between continuous integration, continuous delivery, and continuous deployment? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q36: How would you introduce Continuous Delivery in a successful, huge company for which the change from Waterfall to Continuous Delivery would be not trivial, because of the size and complexity of the business? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Answer: Use:
git commit -a
-a on the command line instructs git to commit the new content of all tracked files that have been modified. You can use
git add <file>
or
git add -A
before git commit -a if new files need to be committed for the first time.
Source: edureka.co
Answer: The main point in Git vs SVN debate boils down to this: Git is a distributed version control system (DVCS), whereas SVN is a centralized version control system.
Source: medium.com
Answer: Git is a Distributed Version Control system (DVCS). It can track changes to a file and allows you to revert back to any particular change.
Its distributed architecture provides many advantages over other Version Control Systems (VCS) like SVN one major advantage is that it does not rely on a central server to store all the versions of a project’s files.
Source: edureka.co
Details: You accidentally committed wrong files to Git, but haven't pushed the commit to the server yet. How can you undo those commits from the local repository?
Answer:
$ git commit -m "Something terribly misguided"
$ git reset HEAD~ # copied the old head to .git/ORIG_HEAD
# edit files as necessary
$ git add ...
$ git commit -c ORIG_HEAD # will open an editor, which initially contains the log message from the old commit and allows you to edit it
Source: stackoverflow.com
Answer:
- A fork is a remote, server-side copy of a repository, distinct from the original. A fork isn't a Git concept really, it's more a political/social idea.
- A clone is not a fork; a clone is a local copy of some remote repository. When you clone, you are actually copying the entire source repository, including all the history and branches.
- A branch is a mechanism to handle the changes within a single repository in order to eventually merge them with the rest of code. A branch is something that is within a repository. Conceptually, it represents a thread of development.
Source: stackoverflow.com
Answer:
In the simplest terms, git pull
does a git fetch
followed by a git merge
.
-
When you use
pull
, Git tries to automatically do your work for you. It is context sensitive, so Git will merge any pulled commits into the branch you are currently working in.pull
automatically merges the commits without letting you review them first. If you don’t closely manage your branches, you may run into frequent conflicts. -
When you
fetch
, Git gathers any commits from the target branch that do not exist in your current branch and stores them in your local repository. However, it does not merge them with your current branch. This is particularly useful if you need to keep your repository up to date, but are working on something that might break if you update your files. To integrate the commits into your master branch, you usemerge
.
Source: stackoverflow.com
Answer:
-
A branch is just a separate version of the code.
-
A pull request is when someone take the repository, makes their own branch, does some changes, then tries to merge that branch in (put their changes in the other person's code repository).
Source: stackoverflow.com
Answer: The Centralized Workflow uses a central repository to serve as the single point-of-entry for all changes to the project. The default development branch is called master and all changes are committed into this branch.
Developers start by cloning the central repository. In their own local copies of the project, they edit files and commit changes. These new commits are stored locally.
To publish changes to the official project, developers push their local master branch to the central repository. Before the developer can publish their feature, they need to fetch the updated central commits and rebase their changes on top of them.
Compared to other workflows, the Centralized Workflow has no defined pull request or forking patterns.
Source: atlassian.com
Answer: It’s a two steps process. First you fetch the changes from a remote named origin:
git fetch origin
Then you merge a branch master to local:
git merge origin/master
Or simply:
git pull origin master
If origin is a default remote and ‘master’ is default branch, you can drop it eg. git pull
.
Source: samwize.com
Q10: You need to rollback to a previous commit and don't care about recent changes. What commands should you use? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q24: What git command do you need to use to know who changed certain lines in a specific file? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Go is a general-purpose language designed with systems programming in mind. It was initially developed at Google in year 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It is strongly and statically typed, provides inbuilt support for garbage collection and supports concurrent programming. Programs are constructed using packages, for efficient management of dependencies. Go programming implementations use a traditional compile and link model to generate executable binaries.
Source: tutorialspoint.com
Answer: Go isn't a library and not a framework, it's a new language.
Go is mostly in the C family (basic syntax), with significant input from the Pascal/Modula/Oberon family (declarations, packages). Go does have an extensive library, called the runtime, that is part of every Go program. Although it is more central to the language, Go's runtime is analogous to libc, the C library. It is important to understand, however, that Go's runtime does not include a virtual machine, such as is provided by the Java runtime. Go programs are compiled ahead of time to native machine code.
Source: golang.org
Answer: Static type variable declaration provides assurance to the compiler that there is one variable existing with the given type and name so that compiler proceed for further compilation without needing complete detail about the variable. A variable declaration has its meaning at the time of compilation only, compiler needs actual variable declaration at the time of linking of the program.
Source: tutorialspoint.com
Answer: A dynamic type variable declaration requires compiler to interpret the type of variable based on value passed to it. Compiler don't need a variable to have type statically as a necessary requirement.
Source: tutorialspoint.com
Answer: Yes. Variables of different types can be declared in one go using type inference.
var a, b, c = 3, 4, "foo"
Source: tutorialspoint.com
Answer: A pointer variable can hold the address of a variable.
Consider:
var x = 5 var p *int p = &x
fmt.Printf("x = %d", *p)
Here x
can be accessed by *p
.
Source: tutorialspoint.com
Answer: A Go function can return multiple values.
Consider:
package main
import "fmt"
func swap(x, y string) (string, string) {
return y, x
}
func main() {
a, b := swap("Mahesh", "Kumar")
fmt.Println(a, b)
}
Source: tutorialspoint.com
Answer: Go is an attempt to introduce a new, concurrent, garbage-collected language with fast compilation and the following benefits:
- It is possible to compile a large Go program in a few seconds on a single computer.
- Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
- Go's type system has no hierarchy, so no time is spent defining the relationships between types. Also, although Go has static types, the language attempts to make types feel lighter weight than in typical OO languages.
- Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
- By its design, Go proposes an approach for the construction of system software on multicore machines.
Source: golang.org
Answer: Go is very strict about explicit typing. There is no automatic type promotion or conversion. Explicit type conversion is required to assign a variable of one type to another.
Consider:
i := 55 //int
j := 67.8 //float64
sum := i + int(j) //j is converted to int
Source: golangbot.com
Answer: Following are the benefits of using Go programming:
- Support for environment adopting patterns similar to dynamic languages. For example type inference (
x := 0
is valid declaration of a variablex
of typeint
). - Compilation time is fast.
- In built concurrency support: light-weight processes (via goroutines), channels, select statement.
- Conciseness, Simplicity, and Safety.
- Support for Interfaces and Type embedding.
- The go compiler supports static linking. All the go code can be statically linked into one big fat binary and it can be deployed in cloud servers easily without worrying about dependencies.
Source: tutorialspoint.com
Answer: Go was born out of frustration with existing languages and environments for systems programming.
Go is an attempt to have:
- an interpreted, dynamically typed language with
- the efficiency and safety of a statically typed, compiled language
- support for networked and multicore computing
- be fast in compilation
To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools so a new language was born.
Source: golang.org
Answer: No, Go takes a different approach. For plain error handling, Go's multi-value returns make it easy to report an error without overloading the return value. Go code uses error values to indicate an abnormal state.
Consider:
func Open(name string) (file *File, err error)
f, err := os.Open("filename.ext")
if err != nil {
log.Fatal(err)
}
// do something with the open *File f
Source: golang.org
Answer: Goroutines are functions or methods that run concurrently with other functions or methods. Goroutines can be thought of as light weight threads. The cost of creating a Goroutine is tiny when compared to a thread. Its common for Go applications to have thousands of Goroutines running concurrently.
Source: golangbot.com
Answer: Variable is the name given to a memory location to store a value of a specific type. There are various syntaxes to declare variables in go.
// 1 - variable declaration, then assignment
var age int
age = 29
// 2 - variable declaration with initial value
var age2 int = 29
// 3 - Type inference
var age3 = 29
// 4 - declaring multiple variables
var width, height int = 100, 50
// 5 - declare variables belonging to different types in a single statement
var (
name1 = initialvalue1,
name2 = initialvalue2
)
// 6 - short hand declaration
name, age4 := "naveen", 29 //short hand declaration
If a variable is not assigned any value, go automatically initialises it with the zero value of the variable's type. Go is strongly typed, so variables declared as belonging to one type cannot be assigned a value of another type.
Source: golangbot.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: GraphQL is a query language created by Facebook in 2012 which provides a common interface between the client and the server for data fetching and manipulations.
The client asks for various data from the GraphQL server via queries. The response format is described in the query and defined by the client instead of the server: they are called client‐specified queries.
The structure of the data is not hardcoded as in traditional REST APIs - this makes retrieving data from the server more efficient for the client.
Source: howtographql.com
Answer: No. GraphQL is often confused with being a database technology. This is a misconception, GraphQL is a query language for APIs - not databases. In that sense it’s database agnostic and can be used with any kind of database or even no database at all.
Source: howtographql.com
Answer: No. GraphQL is an API technology so it can be used in any context where an API is required.
On the backend, a GraphQL server can be implemented in any programming language that can be used to build a web server. Next to Javascript, there are popular reference implementations for Ruby, Python, Scala, Java, Clojure, Go and .NET.
Since a GraphQL API is usually operated over HTTP, any client that can speak HTTP is able to query data from a GraphQL server.
Note: GraphQL is actually transport layer agnostic, so you could choose other protocols than HTTP to implement your server.
Source: howtographql.com
Answer:
A successful GraphQL query is supposed to return a JSON object with a root field called "data"
. If the request fails or partially fails (e.g. because the user requesting the data doesn’t have the right access permissions), a second root field called "errors"
is added to the response:
{
"data": { ... },
"errors": [ ... ]
}
Source: howtographql.com
Answer: GraphQL helps where your client needs a flexible response format to avoid extra queries and/or massive data transformation with the overhead of keeping them in sync.
Using a GraphQL server makes it very easy for a client side developer to change the response format without any change on the backend.
With GraphQL, you can describe the required data in a more natural way. It can speed up development, because in application structures like top-down rendering in React, the required data is more similar to your component structure.
Source: blog.risingstack.com
Answer: Every GraphQL server has two core parts that determine how it works: a schema and resolve functions.
The schema is a model of the data that can be fetched through the GraphQL server. It defines what queries clients are allowed to make, what types of data can be fetched from the server, and what the relationships between these types are.
Consider:
type Author {
id: Int
name: String
posts: [Post]
}
type Post {
id: Int
title: String
text: String
author: Author
}
type Query {
getAuthor(id: Int): Author
getPostsByTitle(titleContains: String): [Post]
}
schema {
query: Query
}
Source: dev-blog.apollodata.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Write a HTML table tag sequence that outputs the following:
50 pcs 100 500
10 pcs 5 50
Answer:
<table>
<tr>
<td>50 pcs</td>
<td>100</td>
<td>500</td>
</tr>
<tr>
<td>10 pcs</td>
<td>5</td>
<td>50</td>
</tr>
</table>
Source: toptal.com
Answer: An iframe is an HTML document which can be embedded inside another HTML page.
Example:
<iframe src="https://github.com" height="300px" width="300px"></iframe>
Source: github.com/FuelFrontend
Answer:
- Meta tags always go inside head tag of the HTML page
- Meta tags is always passed as name/value pairs
- Meta tags are not displayed on the page but intended for the browser
- Meta tags can contain information about character encoding, description, title of the document etc,
Example:
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="I am a web page with description">
<title>Home Page</title>
</head>
<body>
</body>
</html>
Source: github.com/FuelFrontend
Answer:
The alt
attribute provides alternative information for an image if a user cannot view it. The alt
attribute should be used to describe any images except those which only serve a decorative purposes, in which case it should be left empty.
Source: developer.mozilla.org
Answer: In HTML5 it is not strictly necessary to close certain HTML tags. The tags that aren’t required to have specific closing tags are called “self closing” tags.
An example of a self closing tag is something like a line break (<br />
) or the meta tag (<meta>
). This means that the following are both acceptable:
<meta charset="UTF-8">
...
<meta charset="UTF-8" />
Source: blog.teamtreehouse.com
Answer:
div
is a block elementspan
is inline element
For bonus points, you could point out that it’s illegal to place a block element inside an inline element, and that while div
can have a p
tag, and a p
tag can have a span
, it is not possible for span
to have a div
or p
tag inside.
Source: thatjsdude.com
Answer:
It is possible to get indexed better by placing the following two statements in the <HEAD>
part of your documents:
<META NAME="keywords" CONTENT="keyword keyword keyword keyword">
<META NAME="description" CONTENT="description of your site">
Both may contain up to 1022 characters. If a keyword is used more than 7 times, the keywords tag will be ignored altogether. Also, you cannot put markup (other than entities) in the description or keywords list.
Source: freejavaguide.com
Answer:
If you are working with an HTML5 page, the <mark>
tag can be a quick and easy way of highlighting or marking text on a page:
<mark>highlighted text</mark>
To highlight text with just HTML code and support for all browsers, set the background-color style, as shown in the example below, using the HTML tag.
<span style="background-color: #FFFF00">Yellow text.</span>
Source: computerhope.com
Answer:
-
<header>
is used to contain introductory and navigational information about a section of the page. This can include the section heading, the author’s name, time and date of publication, table of contents, or other navigational information. -
<article>
is meant to house a self-contained composition that can logically be independently recreated outside of the page without losing it’s meaining. Individual blog posts or news stories are good examples. -
<section>
is a flexible container for holding content that shares a common informational theme or purpose. -
<footer>
is used to hold information that should appear at the end of a section of content and contain additional information about the section. Author’s name, copyright information, and related links are typical examples of such content.
Source: w3schools.com
Answer: To display an HTML page correctly, a web browser must know which character set (character encoding) to use. This is specified in the tag:
HTML4:
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
HTML5:
<meta charset="UTF-8">
Source: w3schools.com
Answer: HTML5 was designed to replace HTML 4, XHTML, and the HTML DOM Level 2. The key goals and motivations behind the HTML5 specification were to:
- Deliver rich content (graphics, movies, etc.) without the need for additional plugins, such as Flash.
- Provide better semantic support for web page structure through new structural element tags.
- Provide a stricter parsing standard to simplify error handling, ensure more consistent cross-browser behaviour, and simplify compatibility with documents written to older standards.
- Provide better cross-platform support whether running on a PC, Tablet, or Smartphone.
Source: toptal.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q26: Discuss the differences between an HTML specification and a browser’s implementation thereof. ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q40: Why you would use a srcset
attribute in an image tag? Explain the process the browser uses when evaluating the content of this attribute. ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q45: What kind of things must you be wary of when designing or developing for multilingual sites? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q53: Why is it generally a good idea to position CSS s between and JS <script>s just before ? Do you know any exceptions? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: A Java virtual machine (JVM) is a process virtual machine that can execute Java bytecode. Each Java source file is compiled into a bytecode file, which is executed by the JVM. Java was designed to allow application programs to be built that could be run on any platform, without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible, because it is aware of the specific instruction lengths and other particularities of the underlying hardware platform.
Source: github.com/snowdream
Answer: The servlet is a Java programming language class used to process client requests and generate dynamic web content. Servlets are mostly used to process or store data submitted by an HTML form, provide dynamic content and manage state information that does not exist in the stateless HTTP protocol.
Source: github.com/snowdream
Answer: A Java Server Page (JSP) is a text document that contains two types of text: static data and JSP elements. Static data can be expressed in any text-based format, such as HTML or XML. JSP is a technology that mixes static content with dynamically-generated content.
Source: github.com/snowdream
Answer: A Choice is displayed in a compact form that must be pulled down, in order for a user to be able to see the list of all available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.
Source: github.com/snowdream
Answer: Applets are executed within a java enabled browser, but a Java application is a standalone Java program that can be executed outside of a browser. However, they both require the existence of a Java Virtual Machine (JVM). Furthermore, a Java application requires a main method with a specific signature, in order to start its execution. Java applets don’t need such a method to start their execution. Finally, Java applets typically use a restrictive security policy, while Java applications usually use more relaxed security policies.
Source: github.com/snowdream
Answer: The Java Runtime Environment (JRE) is basically the Java Virtual Machine (JVM) where your Java programs are being executed. It also includes browser plugins for applet execution. The Java Development Kit (JDK) is the full featured Software Development Kit for Java, including the JRE, the compilers and tools (like JavaDoc, and Java Debugger), in order for a user to develop, compile and execute Java applications.
Source: github.com/snowdream
Answer: Java has two types of exceptions: checked exceptions and unchecked exceptions. Unchecked exceptions do not need to be declared in a method or a constructor’s throws clause, if they can be thrown by the execution of the method or the constructor, and propagate outside the method or constructor boundary. On the other hand, checked exceptions must be declared in a method or a constructor’s throws clause. See here for tips on Java exception handling.
Source: github.com/snowdream
Answer: The core abstraction that must be implemented by all servlets is the javax.servlet.Servlet interface. Each servlet must implement it either directly or indirectly, either by extending javax.servlet.GenericServlet or javax.servlet.http.HTTPServlet. Finally, each servlet is able to serve multiple requests in parallel using multithreading.
Source: github.com/snowdream
Answer: Java provides and supports the creation both of abstract classes and interfaces. Both implementations share some common characteristics, but they differ in the following features:
- All methods in an interface are implicitly abstract. On the other hand, an abstract class may contain both abstract and non-abstract methods.
- A class may implement a number of Interfaces, but can extend only one abstract class.
- In order for a class to implement an interface, it must implement all its declared methods. However, a class may not implement all declared methods of an abstract class. Though, in this case, the sub-class must also be declared as abstract.
- Abstract classes can implement interfaces without even providing the implementation of interface methods.
- Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.
- Members of a Java interface are public by default. A member of an abstract class can either be private, protected or public.
- An interface is absolutely abstract and cannot be instantiated. An abstract class also cannot be instantiated, but can be invoked if it contains a main method.
Also check out the Abstract class and Interface differences for JDK 8.
Source: github.com/snowdream
Answer: When an object is passed by value, this means that a copy of the object is passed. Thus, even if changes are made to that object, it doesn’t affect the original value. When an object is passed by reference, this means that the actual object is not passed, rather a reference of the object is passed. Thus, any changes made by the external method, are also reflected in all places.
Source: github.com/snowdream
Answer: A process is an execution of a program, while a Thread is a single execution sequence within a process. A process can contain multiple threads. A Thread is sometimes called a lightweight process.
Source: github.com/snowdream
Answer: Java provides a mechanism, called object serialization where an object can be represented as a sequence of bytes and includes the object’s data, as well as information about the object’s type, and the types of data stored in the object. Thus, serialization can be seen as a way of flattening objects, in order to be stored on disk, and later, read back and reconstituted. Deserialisation is the reverse process of converting an object from its flattened state to a live object.
Source: github.com/snowdream
Answer: A JSP expression is used to insert the value of a scripting language expression, converted into a string, into the data stream returned to the client, by the web server. Expressions are defined between <% = and %> tags.
Source: github.com/snowdream
Answer: Declarations are similar to variable declarations in Java. Declarations are used to declare variables for subsequent use in expressions or scriptlets. To add a declaration, you must use the sequences to enclose your declarations.
Source: github.com/snowdream
Answer: JSP actions use constructs in XML syntax to control the behavior of the servlet engine. JSP actions are executed when a JSP page is requested. They can be dynamically inserted into a file, re-use JavaBeans components, forward the user to another page, or generate HTML for the Java plugin.Some of the available actions are listed below:
- jsp:include – includes a file, when the JSP page is requested.
- jsp:useBean – finds or instantiates a JavaBean.
- jsp:setProperty – sets the property of a JavaBean.
- jsp:getProperty – gets the property of a JavaBean.
- jsp:forward – forwards the requester to a new page.
- jsp:plugin – generates browser-specific code.
Source: github.com/snowdream
Answer: What are the different types of Directives available in JSP ? Directives are instructions that are processed by the JSP engine, when the page is compiled to a servlet. Directives are used to set page-level instructions, insert data from external files, and specify custom tag libraries. Directives are defined between < %@ and % >.The different types of directives are shown below:
- Include directive: it is used to include a file and merges the content of the file with the current page.
- Page directive: it is used to define specific attributes in the JSP page, like error page and buffer.
- Taglib: it is used to declare a custom tag library which is used in the page.
Source: github.com/snowdream
Answer: On the arrival of a JSP request, the browser first requests a page with a .jsp extension. Then, the Web server reads the request and using the JSP compiler, the Web server converts the JSP page into a servlet class. Notice that the JSP file is compiled only on the first request of the page, or if the JSP file has changed.The generated servlet class is invoked, in order to handle the browser’s request. Once the execution of the request is over, the servlet sends a response back to the client. See how to get Request parameters in a JSP.
Source: github.com/snowdream
Answer: Java Collections Framework provides a well designed set of interfaces and classes that support operations on a collections of objects. The most basic interfaces that reside in the Java Collections Framework are:
- Collection, which represents a group of objects known as its elements.
- Set, which is a collection that cannot contain duplicate elements.
- List, which is an ordered collection and can contain duplicate elements.
- Map, which is an object that maps keys to values and cannot contain duplicate keys.
Source: github.com/snowdream
Answer: The static keyword denotes that a member variable or method can be accessed, without requiring an instantiation of the class to which it belongs. A user cannot override static methods in Java, because method overriding is based upon dynamic binding at runtime and static methods are statically binded at compile time. A static method is not associated with any instance of a class so the concept is not applicable.
Source: github.com/snowdream
Answer: The Iterator interface provides a number of methods that are able to iterate over any Collection. Each Java Collection contains the Iterator method that returns an Iterator instance. Iterators are capable of removing elements from the underlying collection during the iteration.
Source: github.com/snowdream
Answer: This method is used to method is used to load the driver that will establish a connection to the database.
Source: github.com/snowdream
Answer: JDBC is an abstraction layer that allows users to choose between databases. JDBC enables developers to write database applications in Java, without having to concern themselves with the underlying details of a particular database.
Source: github.com/snowdream
Answer: A HashMap in Java stores key-value pairs. The HashMap requires a hash function and uses hashCode and equals methods, in order to put and retrieve elements to and from the collection respectively. When the put method is invoked, the HashMap calculates the hash value of the key and stores the pair in the appropriate index inside the collection. If the key exists, its value is updated with the new value. Some important characteristics of a HashMap are its capacity, its load factor and the threshold resizing.
Source: github.com/snowdream
Answer: The design pattern used by Java for all Swing components is the Model View Controller (MVC) pattern.
Source: github.com/snowdream
Answer: Both the HashMap and Hashtable classes implement the Map interface and thus, have very similar characteristics. However, they differ in the following features:
- A HashMap allows the existence of null keys and values, while a Hashtable doesn’t allow neither null keys, nor null values.
- A Hashtable is synchronized, while a HashMap is not. Thus, HashMap is preferred in single-threaded environments, while a Hashtable is suitable for multi-threaded environments.
- A HashMap provides its set of keys and a Java application can iterate over them. Thus, a HashMap is fail-fast. On the other hand, a Hashtable provides an Enumeration of its keys.
- The Hashtable class is considered to be a legacy class.
Source: github.com/snowdream
Answer: Java uses layout managers to lay out components in a consistent manner, across all windowing platforms. Since layout managers aren’t tied to absolute sizing and positioning, they are able to accomodate platform-specific differences among windowing systems
Source: github.com/snowdream
Answer: A GUI component can handle its own events, by implementing the corresponding event-listener interface and adding itself as its own event listener.
Source: github.com/snowdream
Answer: A layout manager is the used to organize the components in a container.
Source: github.com/snowdream
Answer: The sendRedirect method creates a new request, while the forward method just forwards a request to a new target. The previous request scope objects are not available after a redirect, because it results in a new request. On the other hand, the previous request scope objects are available after forwarding. FInally, in general, the sendRedirect method is considered to be slower compare to the forward method.
Source: github.com/snowdream
Q30: What do you know about the big-O notation and can you give some examples with respect to different data structures? ⭐⭐
Answer: The Big-O notation simply describes how well an algorithm scales or performs in the worst case scenario as the number of elements in a data structure increases. The Big-O notation can also be used to describe other behavior such as memory consumption. Since the collection classes are actually data structures, we usually use the Big-O notation to chose the best implementation to use, based on time, memory and performance. Big-O notation can give a good indication about performance for large amounts of data.
Source: github.com/snowdream
Answer: The eight primitive data types supported by the Java programming language are:
- byte
- short
- int
- long
- float
- double
- boolean
- char
Autoboxing is the automatic conversion made by the Java compiler between the primitive types and their corresponding object wrapper classes. For example, the compiler converts an int to an Integer, a double to a Double, and so on. If the conversion goes the other way, this operation is called unboxing.
Source: github.com/snowdream
Answer: Method overloading in Java occurs when two or more methods in the same class have the exact same name, but different parameters. On the other hand, method overriding is defined as the case when a child class redefines the same method as a parent class. Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides.
Source: github.com/snowdream
Answer: A Java Applet is program that can be included in a HTML page and be executed in a java enabled client browser. Applets are used for creating dynamic and interactive web applications.
Source: github.com/snowdream
Answer: The Exception object will be garbage collected in the next garbage collection.
Source: github.com/snowdream
Answer: The purpose of garbage collection is to identify and discard those objects that are no longer needed by the application, in order for the resources to be reclaimed and reused.
Source: github.com/snowdream
Answer: These methods can be used as a hint to the JVM, in order to start a garbage collection. However, this it is up to the Java Virtual Machine (JVM) to start the garbage collection immediately or later in time.
Source: github.com/snowdream
Answer: A finally block will always be executed, whether or not an exception is actually thrown. Even in the case where the catch statement is missing and an exception is thrown, the finally block will still be executed. Last thing to mention is that the finally block is used to release resources like I/O buffers, database connections, etc.
Source: github.com/snowdream
Answer: Exception and Error classes are both subclasses of the Throwable class. The Exception class is used for exceptional conditions that a user’s program should catch. The Error class defines exceptions that are not excepted to be caught by the user program.
Source: github.com/snowdream
Answer: A Web application is a dynamic extension of a Web or application server. There are two types of web applications: presentation-oriented and service-oriented. A presentation-oriented Web application generates interactive web pages, which contain various types of markup language and dynamic content in response to requests. On the other hand, a service-oriented web application implements the endpoint of a web service. In general, a Web application can be seen as a collection of servlets installed under a specific subset of the server’s URL namespace.
Source: github.com/snowdream
Answer: A Java object is subject to garbage collection when it becomes unreachable to the program in which it is currently used.
Source: github.com/snowdream
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q45: If an object reference is set to null, will the Garbage Collector immediately free the memory held by that object? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q70: What is the use of CallableStatement? Name the method, which is used to prepare a CallableStatement. ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q88: What is the difference between applets loaded over the internet and applets loaded via the file system? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q103: How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
[⬆] JavaScript Interview Questions
Answer:
In JavaScript conversion between different two build-in types called coercion
. Coercion comes in two forms in JavaScript: explicit and implicit.
Here's an example of explicit coercion:
var a = "42";
var b = Number( a );
a; // "42"
b; // 42 -- the number!
And here's an example of implicit coercion:
var a = "42";
var b = a * 1; // "42" implicitly coerced to 42 here
a; // "42"
b; // 42 -- the number!
Answer:
JavaScript provides a typeof
operator that can examine a value and tell you what type it is:
var a;
typeof a; // "undefined"
a = "hello world";
typeof a; // "string"
a = 42;
typeof a; // "number"
a = true;
typeof a; // "boolean"
a = null;
typeof a; // "object" -- weird, bug
a = undefined;
typeof a; // "undefined"
a = { b: "c" };
typeof a; // "object"
Answer: The object type refers to a compound value where you can set properties (named locations) that each hold their own values of any type.
var obj = {
a: "hello world", // property
b: 42,
c: true
};
obj.a; // "hello world", accessed with doted notation
obj.b; // 42
obj.c; // true
obj["a"]; // "hello world", accessed with bracket notation
obj["b"]; // 42
obj["c"]; // true
Bracket notation is also useful if you want to access a property/key but the name is stored in another variable, such as:
var obj = {
a: "hello world",
b: 42
};
var b = "a";
obj[b]; // "hello world"
obj["b"]; // 42
Answer:
An array
is an object that holds values (of any type) not particularly in named properties/keys, but rather in numerically indexed positions:
var arr = [
"hello world",
42,
true
];
arr[0]; // "hello world"
arr[1]; // 42
arr[2]; // true
arr.length; // 3
typeof arr; // "object"
Answer: JavaScript has both strict and type–converting comparisons:
- Strict comparison (e.g., ===) checks for value equality without allowing coercion
- Abstract comparison (e.g. ==) checks for value equality with coercion allowed
var a = "42";
var b = 42;
a == b; // true
a === b; // false
Some simple equalityrules:
- If either value (aka side) in a comparison could be the
true
orfalse
value, avoid==
and use===
. - If either value in a comparison could be of these specific values (
0
,""
, or[]
-- empty array), avoid==
and use===
. - In all other cases, you're safe to use
==
. Not only is it safe, but in many cases it simplifies your code in a way that improves readability.
Answer: In JavaScript, each function gets its own scope. Scope is basically a collection of variables as well as the rules for how those variables are accessed by name. Only code inside that function can access that function's scoped variables.
A variable name has to be unique within the same scope. A scope can be nested inside another scope. If one scope is nested inside another, code inside the innermost scope can access variables from either scope.
Answer:
In addition to creating declarations for variables at the function level, ES6 lets you declare variables to belong to individual blocks (pairs of { .. }), using the let
keyword.
Source: https://github.com/getify/You-Dont-Know-JS/blob/master/up%20%26%20going/ch2.md
Answer:
A callback
function is a function that is passed to another function as an argument and is executed after some operation has been completed. Below is an example of a simple callback function that logs to the console after some operations have been completed.
function modifyArray(arr, callback) {
// do something to arr here
arr.push(100);
// then execute the callback function that was passed
callback();
}
var arr = [1, 2, 3, 4, 5];
modifyArray(arr, function() {
console.log("array has been modified", arr);
});
Source: coderbyte.com
Answer: Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a "strict" operating context. This strict context prevents certain actions from being taken and throws more exceptions.
// Non-strict code...
(function(){
"use strict";
// Define your library strictly...
})();
// Non-strict code...
Answer:
The use strict
literal is entered at the top of a JavaScript program or at the top of a function and it helps you write safer JavaScript code by throwing an error if a global variable is created by mistake. For example, the following program will throw an error:
function doSomething(val) {
"use strict";
x = val + 10;
}`
It will throw an error because x
was not defined and it is being set to some value in the global scope, which is not allowed with use strict
The small change below fixes the error being thrown:
function doSomething(val) {
"use strict";
var x = val + 10;
}
Source: coderbyte.com
Answer: A polyfill is essentially the specific code (or plugin) that would allow you to have some specific functionality that you expect in current or “modern” browsers to also work in other browsers that do not have the support for that functionality built in.
- Polyfills are not part of the HTML5 standard
- Polyfilling is not limited to Javascript
Source: programmerinterview.com
Answer: A very simply way to check if a number is a decimal or integer is to see if there is a remainder left when you divide by 1.
function isInt(num) {
return num % 1 === 0;
}
console.log(isInt(4)); // true
console.log(isInt(12.2)); // false
console.log(isInt(0.3)); // false
Source: coderbyte.com
Answer: JavaScript has typed values, not typed variables. The following built-in types are available:
string
number
boolean
null
andundefined
object
symbol
(new to ES6)
Q14: Being told that an unsorted array contains (n - 1) of n consecutive numbers (where the bounds are defined), find the missing number in O(n) time ⭐⭐
Answer:
// The output of the function should be 8
var arrayOfIntegers = [2, 5, 1, 4, 9, 6, 3, 7];
var upperBound = 9;
var lowerBound = 1;
findMissingNumber(arrayOfIntegers, upperBound, lowerBound); // 8
function findMissingNumber(arrayOfIntegers, upperBound, lowerBound) {
// Iterate through array to find the sum of the numbers
var sumOfIntegers = 0;
for (var i = 0; i < arrayOfIntegers.length; i++) {
sumOfIntegers += arrayOfIntegers[i];
}
// Find theoretical sum of the consecutive numbers using a variation of Gauss Sum.
// Formula: [(N * (N + 1)) / 2] - [(M * (M - 1)) / 2];
// N is the upper bound and M is the lower bound
upperLimitSum = (upperBound * (upperBound + 1)) / 2;
lowerLimitSum = (lowerBound * (lowerBound - 1)) / 2;
theoreticalSum = upperLimitSum - lowerLimitSum;
return theoreticalSum - sumOfIntegers;
}
Source: https://github.com/kennymkchan
Answer:
// ES6 Implementation
var array = [1, 2, 3, 5, 1, 5, 9, 1, 2, 8];
Array.from(new Set(array)); // [1, 2, 3, 5, 9, 8]
// ES5 Implementation
var array = [1, 2, 3, 5, 1, 5, 9, 1, 2, 8];
uniqueArray(array); // [1, 2, 3, 5, 9, 8]
function uniqueArray(array) {
var hashmap = {};
var unique = [];
for(var i = 0; i < array.length; i++) {
// If key returns undefined (unique), it is evaluated as false.
if(!hashmap.hasOwnProperty(array[i])) {
hashmap[array[i]] = 1;
unique.push(array[i]);
}
}
return unique;
}
Source: https://github.com/kennymkchan
Details:
For example Welcome to this Javascript Guide!
should be become emocleW ot siht tpircsavaJ !ediuG
Answer:
var string = "Welcome to this Javascript Guide!";
// Output becomes !ediuG tpircsavaJ siht ot emocleW
var reverseEntireSentence = reverseBySeparator(string, "");
// Output becomes emocleW ot siht tpircsavaJ !ediuG
var reverseEachWord = reverseBySeparator(reverseEntireSentence, " ");
function reverseBySeparator(string, separator) {
return string.split(separator).reverse().join(separator);
}
Source: https://github.com/kennymkchan
Details:
var addSix = createBase(6);
addSix(10); // returns 16
addSix(21); // returns 27
Answer:
You can create a closure to keep the value passed to the function createBase
even after the inner function is returned. The inner function that is being returned is created within an outer function, making it a closure, and it has access to the variables within the outer function, in this case the variable baseNumber
.
function createBase(baseNumber) {
return function(N) {
// we are referencing baseNumber here even though it was declared
// outside of this function. Closures allow us to do this in JavaScript
return baseNumber + N;
}
}
var addSix = createBase(6);
addSix(10);
addSix(21);
Source: coderbyte.com
Answer: Enqueue means to add an element, dequeue to remove an element.
var inputStack = []; // First stack
var outputStack = []; // Second stack
// For enqueue, just push the item into the first stack
function enqueue(stackInput, item) {
return stackInput.push(item);
}
function dequeue(stackInput, stackOutput) {
// Reverse the stack such that the first element of the output stack is the
// last element of the input stack. After that, pop the top of the output to
// get the first element that was ever pushed into the input stack
if (stackOutput.length <= 0) {
while(stackInput.length > 0) {
var elementToOutput = stackInput.pop();
stackOutput.push(elementToOutput);
}
}
return stackOutput.pop();
}
Source: https://github.com/kennymkchan
Answer:
JavaScript (and by extension TypeScript) has two bottom types: null
and undefined
. They are intended to mean different things:
- Something hasn't been initialized :
undefined
. - Something is currently unavailable:
null
.
Answer: You can create a function within an outer function (a closure) that allows you to update a private variable but the variable wouldn't be accessible from outside the function without the use of a helper function.
function counter() {
var _counter = 0;
// return an object with several functions that allow you
// to modify the private _counter variable
return {
add: function(increment) { _counter += increment; },
retrieve: function() { return 'The counter is currently at: ' + _counter; }
}
}
// error if we try to access the private variable like below
// _counter;
// usage of our counter function
var c = counter();
c.add(5);
c.add(9);
// now we can access the private variable in the following way
c.retrieve(); // => The counter is currently at: 14
Source: coderbyte.com
Answer: Event bubbling is the concept in which an event triggers at the deepest possible element, and triggers on parent elements in nesting order. As a result, when clicking on a child element one may exhibit the handler of the parent activating.
One way to prevent event bubbling is using event.stopPropagation()
or event.cancelBubble
on IE < 9.
Source: https://github.com/kennymkchan
Answer:
The best way to find whether an object is instance of a particular class or not using
toString
method fromObject.prototype
var arrayList = [1 , 2, 3];
One of the best use cases of type checking of an object is when we do method overloading in JavaScript. For understanding this let say we have a method called greet
which take one single string and also a list of string, so making our greet
method workable in both situation we need to know what kind of parameter is being passed, is it single value or list of value?
function greet(param) {
if() {
// here have to check whether param is array or not
}
else {
}
}
However, in above implementation it might not necessary to check type for array, we can check for single value string and put array logic code in else block, let see below code for the same.
function greet(param) {
if(typeof param === 'string') {
}
else {
// If param is of type array then this block of code would execute
}
}
Now it's fine we can go with above two implementations, but when we have a situation like a parameter can be single value
, array
, and object
type then we will be in trouble.
Coming back to checking type of object, As we mentioned that we can use Object.prototype.toString
if(Object.prototype.toString.call(arrayList) === '[object Array]') {
console.log('Array!');
}
If you are using jQuery
then you can also used jQuery isArray
method:
if($.isArray(arrayList)) {
console.log('Array');
} else {
console.log('Not an array');
}
FYI jQuery uses Object.prototype.toString.call
internally to check whether an object is an array or not.
In modern browser, you can also use:
Array.isArray(arrayList);
Array.isArray
is supported by Chrome 5, Firefox 4.0, IE 9, Opera 10.5 and Safari 5
Source: github.com/ganqqwerty
Details:
console.log(mul(2)(3)(4)); // output : 24
console.log(mul(4)(3)(4)); // output : 48
Answer:
function mul (x) {
return function (y) { // anonymous function
return function (z) { // anonymous function
return x * y * z;
};
};
}
Here mul
function accept the first argument and return anonymous function which take the second parameter and return anonymous function which take the third parameter and return multiplication of arguments which is being passed in successive
In JavaScript function defined inside has access to outer function variable and function is the first class object so it can be returned by function as well and passed as argument in another function.
- A function is an instance of the Object type
- A function can have properties and has a link back to its constructor method
- Function can be stored as variable
- Function can be pass as a parameter to another function
- Function can be returned from function
Source: github.com/ganqqwerty
Details:
var arrayList = ['a', 'b', 'c', 'd', 'e', 'f'];
How could we empty the array above?
Answer: Method 1
arrayList = [];
Above code will set the variable arrayList
to a new empty array. This is recommended if you don't have references to the original array arrayList
anywhere else because It will actually create a new empty array. You should be careful with this way of empty the array, because if you have referenced this array from another variable, then the original reference array will remain unchanged, Only use this way if you have only referenced the array by its original variable arrayList
.
For Instance:
var arrayList = ['a', 'b', 'c', 'd', 'e', 'f']; // Created array
var anotherArrayList = arrayList; // Referenced arrayList by another variable
arrayList = []; // Empty the array
console.log(anotherArrayList); // Output ['a', 'b', 'c', 'd', 'e', 'f']
Method 2
arrayList.length = 0;
Above code will clear the existing array by setting its length to 0. This way of empty the array also update all the reference variable which pointing to the original array. This way of empty the array is useful when you want to update all the another reference variable which pointing to arrayList
.
For Instance:
var arrayList = ['a', 'b', 'c', 'd', 'e', 'f']; // Created array
var anotherArrayList = arrayList; // Referenced arrayList by another variable
arrayList.length = 0; // Empty the array by setting length to 0
console.log(anotherArrayList); // Output []
Method 3
arrayList.splice(0, arrayList.length);
Above implementation will also work perfectly. This way of empty the array will also update all the references of the original array.
var arrayList = ['a', 'b', 'c', 'd', 'e', 'f']; // Created array
var anotherArrayList = arrayList; // Referenced arrayList by another variable
arrayList.splice(0, arrayList.length); // Empty the array by setting length to 0
console.log(anotherArrayList); // Output []
Method 4
while(arrayList.length) {
arrayList.pop();
}
Above implementation can also empty the array. But not recommended to use often.
Source: github.com/ganqqwerty
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q27: Given an array of integers, find the largest difference between two elements such that the element of lesser value must come before the greater element ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Q28: Find the intersection of two arrays. An intersection would be the common elements that exists within both arrays. In this case, these elements should be unique! ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q48: Given an integer, determine if it is a power of 2. If so, return that number, else return -1 ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q63: Create a function that will evaluate if a given expression has balanced parentheses using stacks ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.
Source: codingcompiler.com
Answer:
- Setup and customisation process is easy and fast as compared to others.
- Inbuilt Authentication System
- Supports multiple file systems
- Pre-loaded packages like Laravel Socialite, Laravel cashier, Laravel elixir, Passport, Laravel Scout
- Eloquent ORM (Object Relation Mapping) with PHP active record implementation
- Built in command line tool “Artisan” for creating a code skeleton ,database structure and build their migration
Source: mytectra.com
Answer: PHP artisan is the command line interface/tool included with Laravel. It provides a number of helpful commands that can help you while you build your application easily. Here are the list of some artisian commands:
- php artisan list
- php artisan help
- php artisan tinker
- php artisan make
- php artisan –versian
- php artisan make modal modal_name
- php artisan make controller controller_name
Source: mytectra.com
Answer: Laravel event provides a simple observer pattern implementation, that allow to subscribe and listen for events in the application.
Source: mytectra.com
Answer: Laravel Migrations are like version control for the database, allowing a team to easily modify and share the application’s database schema. Migrations are typically paired with Laravel’s schema builder to easily build the application’s database schema.
Source: laravelinterviewquestions.com
Answer: Facades provide a static interface to classes that are available in the application's service container. Laravel facades serve as static proxies to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.
All of Laravel's facades are defined in the Illuminate\Support\Facades
namespace.
Consider:
use Illuminate\Support\Facades\Cache;
Route::get('/cache', function () {
return Cache::get('key');
});
Source: laravel.com
Answer: Mongo-DB is a document database which provides high performance, high availability and easy scalability.
Source: medium.com/@hub4tech
Answer: By default, MongoDB created the _id collection for every collection.
Source: tutorialspoint.com
Answer: No. MongoDB does not support such relationships.
Source: interviewbubble.com
Answer:
- Flexible data model in form of documents
- Agile and highly scalable database
- Faster than traditional databases
- Expressive query language
Source: tutorialspoint.com
Answer: Indexes support the efficient execution of queries in MongoDB. Without indexes, MongoDB must perform a collection scan, i.e. scan every document in a collection, to select those documents that match the query statement. If an appropriate index exists for a query, MongoDB can use the index to limit the number of documents it must inspect.
Source: tutorialspoint.com
Answer: MongoDB uses a database profiler to perform characteristics of each operation against the database. You can use a profiler to find queries and write operations
Source: medium.com/@hub4tech
Answer: Yes, it be. Remove the attribute and then re-save () the object.
Source: medium.com/@hub4tech
Answer: No. MongoDB can be run on small free space of RAM.
Source: medium.com/@hub4tech
Answer: MongoDB stores BSON (Binary Interchange and Structure Object Notation) objects in the collection. The concatenation of the collection name and database name is called a namespace
Source: medium.com/@hub4tech
Q10: Mention the command to insert a document in a database called school and collection called persons. ⭐⭐
Answer:
use school;
db.persons.insert( { name: "kadhir", dept: "CSE" } )
Source: tutorialspoint.com
Answer: It is a group of mongo instances that maintain same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments.
Source: interviewbubble.com
Answer: You should consider embedding documents for:
- contains relationships between entities
- One-to-many relationships
- Performance reasons
Source: tutorialspoint.com
Answer: Data in MongoDB is stored in BSON documents – JSON-style data structures. Documents contain one or more fields, and each field contains a value of a specific data type, including arrays, binary data and sub-documents. Documents that tend to share a similar structure are organized as collections.
It may be helpful to think of documents as analogous to rows in a relational database, fields as similar to columns, and collections as similar to tables.
Source: mongodb.com
Answer: Replication is the process of synchronizing data across multiple servers. Replication provides redundancy and increases data availability. With multiple copies of data on different database servers, replication protects a database from the loss of a single server. Replication also allows you to recover from hardware failure and service interruptions.
Source: interviewbubble.com
Answer: The MongoDB store the data in documents with JSON format but SQL store the data in Table format.
The MongoDB provides high performance, high availability, easy scalability etc. rather than SQL Server.
In the MongoDB, we can change the structure simply by adding, removing column from the existing documents.
Source: interviewbubble.com
Answer: SQL databases store data in form of tables, rows, columns and records. This data is stored in a pre-defined data model which is not very much flexible for today's real-world highly growing applications. MongoDB in contrast uses a flexible structure which can be easily modified and extended.
Source: tutorialspoint.com
Answer: Yes. An array field can be indexed in MongoDB. In this case, MongoDB would index each value of the array.
Source: tutorialspoint.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q46: By default, MongoDB writes and reads data from both primary and secondary replica sets. True or False. ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q61: What's the advantage of the backup features in Ops Manager versus traditional backup strategies? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Node.js is a web application framework built on Google Chrome's JavaScript Engine (V8 Engine).
Node.js comes with runtime environment on which a Javascript based script can be interpreted and executed (It is analogus to JVM to JAVA byte code). This runtime allows to execute a JavaScript code on any machine outside a browser. Because of this runtime of Node.js, JavaScript is now can be executed on server as well.
Node.js = Runtime Environment + JavaScript Library
Source: tutorialspoint.com
Answer:
npm
stands for Node Package Manager. npm provides following two main functionalities:
- Online repositories for node.js packages/modules which are searchable on search.nodejs.org
- Command line utility to install packages, do version management and dependency management of Node.js packages.
Source: tutorialspoint.com
Answer: The two types of API functions in Node.js are: a) Asynchronous, non-blocking functions b) Synchronous, blocking functions
Source: lazyquestion.com
Answer: Event Listeners are similar to call back functions but are associated with some event. For example when a server listens to http request on a given port a event will be generated and to specify http server has received and will invoke corresponding event listener. Basically, Event listener's are also call backs for a corresponding event.
Node.js has built in event's and built in event listeners. Node.js also provides functionality to create Custom events and Custom Event listeners.
Source: lazyquestion.com
Answer: Globally installed packages/dependencies are stored in /npm directory. Such dependencies can be used in CLI (Command Line Interface) function of any node.js but can not be imported using require() in Node application directly. To install a Node project globally use -g flag.
Source: tutorialspoint.com
Answer:
- EventEmitter
- Stream
- FS
- Net
- Global Objects
Source: github.com/jimuyouyou
Answer: Error-first callbacks are used to pass errors and data. The first argument is always an error object that the programmer has to check if something went wrong. Additional arguments are used to pass data.
fs.readFile(filePath, function(err, data) {
if (err) {
//handle the error
}
// use the data object
});
Source: tutorialspoint.com
Answer:
We can take advantage of File System watch()
function which watches the changes of the file.
Source: codingdefined.com
Answer: Yes. Child process module enables us to access operating system functionaries or other apps. Scalability is baked into Node and child processes are the key factors to scale our application. You can use child process to run system commands, read large files without blocking event loop, decompose the application into various “nodes” (That’s why it’s called Node).
Child process module has following three major ways to create child processes –
- spawn - child_process.spawn launches a new process with a given command.
- exec - child_process.exec method runs a command in a shell/console and buffers the output.
- fork - The child_process.fork method is a special case of the spawn() to create child processes.
Source: codeforgeek.com
Answer: Operation errors are not bugs, but problems with the system, like request timeout or hardware failure. On the other hand programmer errors are actual bugs.
Source: blog.risingstack.com
Answer: Following are main benefits of using Node.js
-
Aynchronous and Event DrivenAll APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.
-
Very Fast Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code execution.
-
Single Threaded but highly Scalable - Node.js uses a single threaded model with event looping. Event mechanism helps server to respond in a non-bloking ways and makes server highly scalable as opposed to traditional servers which create limited threads to handle requests. Node.js uses a single threaded program and same program can services much larger number of requests than traditional server like Apache HTTP Server.
-
No Buffering - Node.js applications never buffer any data. These applications simply output the data in chunks.
Source: tutorialspoint.com
Answer: The one common trait between Node.js, AJAX, and jQuery is that all of them are the advanced implementation of JavaScript. However, they serve completely different purposes.
-
Node.js –It is a server-side platform for developing client-server applications. For example, if we’ve to build an online employee management system, then we won’t do it using client-side JS. But the Node.js can certainly do it as it runs on a server similar to Apache, Django not in a browser.
-
AJAX (aka Asynchronous Javascript and XML) –It is a client-side scripting technique, primarily designed for rendering the contents of a page without refreshing it. There are a no. of large companies utilizing AJAX such as Facebook and Stack Overflow to display dynamic content.
-
jQuery –It is a famous JavaScript module which complements AJAX, DOM traversal, looping and so on. This library provides many useful functions to help in JavaScript development. However, it’s not mandatory to use it but as it also manages cross-browser compatibility, so can help you produce highly maintainable web applications.
Source: techbeamers.com
Answer: Following code snippet can be used to make a Post Request in Node.js.
var request = require('request');
request.post('http://www.example.com/action', {
form: {
key: 'value'
}
}, function(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body)
}
});
Source: techbeamers.com
Answer: The asynchronous function requires callbacks as a return parameter. When multiple asynchronous functions are chained together then callback hell situation comes up.
Source: codeforgeek.com
Answer: Node provides a single thread to programmers so that code can be written easily and without bottleneck. Node internally uses multiple POSIX threads for various I/O operations such as File, DNS, Network calls etc.
When Node gets I/O request it creates or uses a thread to perform that I/O operation and once the operation is done, it pushes the result to the event queue. On each such event, event loop runs and checks the queue and if the execution stack of Node is empty then it adds the queue result to execution stack.
This is how Node manages concurrency.
Source: codeforgeek.com
Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.
Source: tutorialspoint.com
Answer: Let’s look at some of the key features of Node.js.
- Asynchronous event driven IO helps concurrent request handling – All APIs of Node.js are asynchronous. This feature means that if a Node receives a request for some Input/Output operation, it will execute that operation in the background and continue with the processing of other requests. Thus it will not wait for the response from the previous requests.
- Fast in Code execution – Node.js uses the V8 JavaScript Runtime engine, the one which is used by Google Chrome. Node has a wrapper over the JavaScript engine which makes the runtime engine much faster and hence processing of requests within Node.js also become faster.
- Single Threaded but Highly Scalable – Node.js uses a single thread model for event looping. The response from these events may or may not reach the server immediately. However, this does not block other operations. Thus making Node.js highly scalable. Traditional servers create limited threads to handle requests while Node.js creates a single thread that provides service to much larger numbers of such requests.
- Node.js library uses JavaScript – This is another important aspect of Node.js from the developer’s point of view. The majority of developers are already well-versed in JavaScript. Hence, development in Node.js becomes easier for a developer who knows JavaScript.
- There is an Active and vibrant community for the Node.js framework – The active community always keeps the framework updated with the latest trends in the web development.
- No Buffering – Node.js applications never buffer any data. They simply output the data in chunks.
Source: techbeamers.com
Answer: It is a generic piece of code which runs in between several asynchronous function calls is known as control flow function.
Source: lazyquestion.com
Answer: Yes! Node uses a single threaded model with event looping.
Source: tutorialspoint.com
Answer: AngularJS is a web application development framework. It’s a JavaScript and it is different from other web app frameworks written in JavaScript like jQuery. NodeJS is a runtime environment used for building server-side applications while AngularJS is a JavaScript framework mainly useful in building/developing client-side part of applications which run inside a web browser.
Source: a4academics.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q62: Explain some Error Handling approaches in Node.js you know about. Which one will you use? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
[⬆] Performance Testing Interview Questions
Answer: A load test is usually conducted to understand the behaviour of the system under a specific expected load. This load can be the expected concurrent number of users on the application performing a specific number of transactions within the set duration. This test will give out the response times of all the important business critical transactions.
A stress testing instead is performed to understand the upper limits of capacity within the system. This kind of test is done to determine the system's robustness in terms of extreme load and helps application administrators to determine if the system will perform sufficiently if the current load goes well above the expected maximum.
Source: en.wikipedia.org
Answer: Load testing measures system performance as the workload increases. That workload could mean concurrent users or transactions.The system is monitored to measure response time and system staying power as workload increases. That workload falls within the parameters of normal working conditions.
Source: stackify.com
Answer: Some of the performance testing steps are:
- Identify the testing environment
- Identify performance metrics
- Plan and design performance tests
- Configure the test environment
- Implement your test design
- Execute tests
- Analyze, report, retest
Source: stackify.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
[⬆] Questions to Ask Interview Questions
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Q7: Do you tend to roll your own solutions more often or rely on third party tools? What's the rationale in a specific case? ⭐
Answer:
Q8: What is the most fulfilling/exciting/technically complex project that you've worked on here so far? ⭐⭐
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Answer:
Q17: If you hire person, what do you have for him to study product you're working on and processes in general? Do you have specifications, requirements, documentation? ⭐⭐
Answer:
Answer:
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q22: How does the engineering team balance resources between feature requests and engineering maintenance? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q25: Is the team growing, and what sort of opportunities will there be in the next year/3 years? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q27: There's "C++" (or Python, Swift or any other tech) in the job description. How will you estimate my proficiency in this tech in 3 months? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q29: When was the last time you interacted with a founder? What was it regarding? Generally how involved are the founders in the day-to-day? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q31: What are your highest priorities right now? For example, new features, new products, solidifying existing code, reducing operations overhead? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Q32: What has been the worst technical blunder that has happened in the recent past? How did you guys deal with it? What changes were implemented afterwards to make sure it didn't happen again? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q34: What is the most costly technical decision made early on that the company is living with now? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q36: Does the company culture encourage entrepreneurship? Could you give me any specific examples? ⭐⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Web Services work on client-server model where client applications can access web services over the network. Web services provide endpoint URLs and expose methods that can be accessed over network through client programs written in java, shell script or any other different technologies. Web services are stateless and doesn’t maintain user session like web applications.
Source: What is a Web Service?
Answer: Caching refers to storing server response in client itself so that a client needs not to make server request for same resource again and again. A server response should have information about how a caching is to be done so that a client caches response for a period of time or never caches the server response.
Source: tutorialspoint.com
Answer: RESTful web services make use of HTTP protocol as a medium of communication between client and server.
Source: tutorialspoint.com
Answer: REST is the acronym for REpresentational State Transfer. REST is an architectural style for developing applications that can be accessed over the network. REST architectural style was brought in light by Roy Fielding in his doctoral thesis in 2000.
REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services. REST doesn’t specify any specific protocol to use, but in almost all cases it’s used over HTTP/HTTPS.
When compared to SOAP web services, these are lightweight and doesn’t follow any standard. We can use XML, JSON, text or any other type of data for request and response.
Source: journaldev.com
Answer: REST stands for REpresentational State Transfer. REST is web standards based architecture and uses HTTP Protocol for data communication. It revolves around resource where every component is a resource and a resource is accessed by a common interface using HTTP standard methods. REST was first introduced by Roy Fielding in 2000.
In REST architecture, a REST Server simply provides access to resources and REST client accesses and presents the resources. Here each resource is identified by URIs/ global IDs. REST uses various representations to represent a resource like text, JSON and XML. Now a days JSON is the most popular format being used in web services.
Source: tutorialspoint.com
Answer: URI stands for Uniform Resource Identifier. Each resource in REST architecture is identified by its URI. Purpose of an URI is to locate a resource(s) on the server hosting the web service.
A URI is of following format:
<protocol>://<service-name>/<ResourceType>/<ResourceID>
Source: tutorialspoint.com
Answer: WSDL stands for Web Service Description Language. WSDL is an XML based document that provides technical details about the web service. Some of the useful information in WSDL document are:
- method name,
- port types,
- service end point,
- binding,
- method parameters etc.
Source: journaldev.com
Answer: Some of the advantages of web services are:
- Interoperability: Web services are accessible over network and runs on HTTP/SOAP protocol and uses XML/JSON to transport data, hence it can be developed in any programming language. Web service can be written in java programming and client can be PHP and vice versa.
- Reusability: One web service can be used by many client applications at the same time.
- Loose Coupling: Web services client code is totally independent with server code, so we have achieved loose coupling in our application.
- Easy to deploy and integrate, just like web applications.
- Multiple service versions can be running at same time.
Source: journaldev.com
Answer: There are two types of web services:
- SOAP Web Services: Runs on SOAP protocol and uses XML technology for sending data.
- Restful Web Services: It’s an architectural style and runs on HTTP/HTTPS protocol almost all the time. REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services.
Source: journaldev.com
Answer: Some key characteristics of REST includes
- REST is stateless, therefore the SERVER has no state (or session data)
- With a well-applied REST API, the server could be restarted between two calls as every data is passed to the server
- Web service mostly uses POST method to make operations, whereas REST uses GET to access resources
Source: career.guru99.com
Answer: SOAP stands for Simple Object Access Protocol. SOAP is an XML based industry standard protocol for designing and developing web services. Since it’s XML based, it’s platform and language independent. So our server can be based on JAVA and client can be on .NET, PHP etc. and vice versa.
Source: journaldev.com
Answer: Some of the advantages of REST web services are:
- Learning curve is easy since it works on HTTP protocol
- Supports multiple technologies for data transfer such as text, xml, json, image etc.
- No contract defined between server and client, so loosely coupled implementation.
- REST is a lightweight protocol
- REST methods can be tested easily over browser.
Source: journaldev.com
Answer: Ajax
- In Ajax, the request are sent to the server by using
XMLHttpRequest
objects. The response is used by the JavaScript code to dynamically alter the current page - Ajax is a set of technology; it is a technique of dynamically updating parts of UI without having to reload the page
- Ajax eliminates the interaction between the customer and server asynchronously
REST
- REST requires the interaction between the customer and server
- REST have a URL structure and a request/response pattern the revolve around the use of resources
- REST is a type of software architecture and a method for users to request data or information from servers
- REST requires the interaction between the customer and server
Source: career.guru99.com
Answer: Resource is the fundamental concept of Restful architecture. A resource is an object with:
- a type,
- relationship with other resources and
- methods that operate on it.
Resources are identified with:
- their URI,
- HTTP methods they support and
- request/response data type and format of data.
Source: journaldev.com
Answer: Restful web services supported HTTP methods are:
- GET,
- POST,
- PUT,
- DELETE and
- HEAD.
Source: journaldev.com
Answer: Resources are identified by logical URLs; it is the key element of a RESTful design. Unlike, SOAP web services in REST, you view the product data as a resource and this resource should contain all the required information.
Source: career.guru99.com
Answer: No, you are not supposed to use POST or GET. GET operations should only have view rights
Source: career.guru99.com
Answer: The architectural style for creating web api are
- HTTP for client server communication
- XML/JSON as formatting language
- Simple URI as the address for the services
- Stateless communication
Source: career.guru99.com
Answer: A HTTP Request has five major parts −
- Verb − Indicate HTTP methods such as GET, POST, DELETE, PUT etc.
- URI − Uniform Resource Identifier (URI) to identify the resource on server.
- HTTP Version − Indicate HTTP version, for example HTTP v1.1 .
- Request Header − Contains metadata for the HTTP Request message as key-value pairs. For example, client ( or browser) type, format supported by client, format of message body, cache settings etc.
- Request Body − Message content or Resource representation.
Source: tutorialspoint.com
Answer: HTTP methods supported by REST are:
GET
: It requests a resource at the request URL. It should not contain a request body as it will be discarded. Maybe it can be cached locally or on the server.POST
: It submits information to the service for processing; it should typically return the modified or new resourcePUT
: At the request URL it update the resourceDELETE
: At the request URL it removes the resourceOPTIONS
: It indicates which techniques are supportedHEAD
: About the request URL it returns meta information
Source: career.guru99.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q27: Mention what is the difference between RPC or document style web services? How you determine to which one to choose? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: For example:
<div style={{ height: 10 }}>
Source: github.com/WebPredict
Answer: Props are properties that are passed into a child component from its parent, and are readonly.
Source: github.com/WebPredict
Answer: React creates a virtual DOM. When state changes in a component it firstly runs a "diffing" algorithm, which identifies what has changed in the virtual DOM. The second step is reconciliation, where it updates the DOM with the results of diff.
Source: github.com/Pau1fitz
Answer: React is an open-source JavaScript library created by Facebook for building complex, interactive UIs in web and mobile applications. React’s core purpose is to build UI components; it is often referred to as just the “V” (View) in an “MVC” architecture.
Source: codementor.io
Answer: The first thing React will do when setState is called is merge the object you passed into setState into the current state of the component. This will kick off a process called reconciliation. The end goal of reconciliation is to, in the most efficient way possible, update the UI based on this new state.
To do this, React will construct a new tree of React elements (which you can think of as an object representation of your UI). Once it has this tree, in order to figure out how the UI should change in response to the new state, React will diff this new tree against the previous element tree.
By doing this, React will then know the exact changes which occurred, and by knowing exactly what changes occurred, will able to minimize its footprint on the UI by only making updates where absolutely necessary.
Source: medium.freecodecamp.org/
Answer: The state is a data structure that starts with a default value when a Component mounts. It may be mutated across time, mostly as a result of user events.
Props (short for properties) are a Component's configuration. They are received from above and immutable as far as the Component receiving them is concerned. A Component cannot change its props, but it is responsible for putting together the props of its child Components. Props do not have to just be data - callback functions may be passed in as props.
Source: github.com/Pau1fitz
Answer: Application state management that is easy to reason about, maintain and manage in an asynchronous web application environment.
Source: github.com/WebPredict
Answer:
componentDidMount
is where an AJAX request should be made in a React component.
This method will be executed when the component “mounts” (is added to the DOM) for the first time. This method is only executed once during the component’s life. Importantly, you can’t guarantee the AJAX request will have resolved before the component mounts. If it doesn't, that would mean that you’d be trying to setState on an unmounted component, which would not work. Making your AJAX request in componentDidMount
will guarantee that there’s a component to update.
Source: github.com/Pau1fitz
Answer: In the store.
Source: github.com/WebPredict
Answer: The state property is updated in a React component with the object passed into setState, and this is done asynchronously. It tells React that this component and its children need to be re-rendered, but React may not do this immediately (it may batch these state update requests for better performance).
Source: github.com/WebPredict
Answer:
- A controlled component has its state completely driven by React,
- Uncontrolled components can maintain their own internal state. E.g., a textarea's value.
Source: github.com/WebPredict
Answer:
Return null
from the render method.
Source: github.com/WebPredict
Answer:
You call e.preventDefault();
on the event e passed into the callback.
Source: github.com/WebPredict
Answer: It has a corresponding element created in the DOM and is connected to that.
Source: github.com/WebPredict
Answer: JSX is JavaScript with extensions. Useful for creating React elements with the full power of JavaScript. Not required for a React app, but typically it's used.
Source: github.com/WebPredict
Answer: For example:
<ChildComponent someProp={props.someProperty} />
Source: github.com/WebPredict
Answer:
- It is easy to know how a component is rendered, you just need to look at the render function.
- JSX makes it easy to read the code of your components. It is also really easy to see the layout, or how components are plugged/combined with each other.
- You can render React on the server-side. This enables improves SEO and performance.
- It is easy to test.
- You can use React with any framework (Backbone.js, Angular.js) as it is only a view layer.
Source: github.com/Pau1fitz
Answer: In order to solve cross browser compatibility issues, your event handlers in React will be passed instances of SyntheticEvent, which is React’s cross-browser wrapper around the browser’s native event. These synthetic events have the same interface as native events you’re used to, except they work identically across all browsers.
What’s mildly interesting is that React doesn’t actually attach events to the child nodes themselves. React will listen to all events at the top level using a single event listener. This is good for performance and it also means that React doesn’t need to worry about keeping track of event listeners when updating the DOM.
Source: tylermcginnis.com
Answer: Simply put, a React element describes what you want to see on the screen. Not so simply put, a React element is an object representation of some UI.
A React component is a function or a class which optionally accepts input and returns a React element (typically via JSX which gets transpiled to a createElement invocation).
Source: medium.freecodecamp.org/
Answer: Keys help React identify which items have changed, are added, or are removed. Keys should be given to the elements inside the array to give the elements a stable identity. The best way to pick a key is to use a string that uniquely identifies a list item among its siblings.
render () {
return (
<ul>
{this.state.todoItems.map(({task, uid}) => {
return <li key={uid}>{task}</li>
})}
</ul>
)
}
Most often you would use IDs from your data as keys. When you don't have stable IDs for rendered items, you may use the item index as a key as a last resort. It is not recommend to use indexes for keys if the items can reorder, as that would be slow.
Source: github.com/Pau1fitz
Answer: Refs are an escape hatch which allow you to get direct access to a DOM element or an instance of a component. In order to use them you add a ref attribute to your component whose value is a callback function which will receive the underlying DOM element or the mounted instance of the component as its first argument.
class UnControlledForm extends Component {
handleSubmit = () => {
console.log("Input Value: ", this.input.value)
}
render () {
return (
<form onSubmit={this.handleSubmit}>
<input
type='text'
ref={(input) => this.input = input} />
<button type='submit'>Submit</button>
</form>
)
}
}
Above notice that our input field has a ref attribute whose value is a function. That function receives the actual DOM element of input which we then put on the instance in order to have access to it inside of the handleSubmit function.
It’s often misconstrued that you need to use a class component in order to use refs, but refs can also be used with functional components by leveraging closures in JavaScript.
function CustomForm ({handleSubmit}) {
let inputElement
return (
<form onSubmit={() => handleSubmit(inputElement.value)}>
<input
type='text'
ref={(input) => inputElement = input} />
<button type='submit'>Submit</button>
</form>
)
}
Source: github.com/Pau1fitz
Answer: Unidrectional application flow paradigm popular a few years back in React; mostly superceded by Redux these days.
Source: github.com/WebPredict
Answer:
Source: github.com/Pau1fitz
Answer: Presentational components are concerned with how things look. They generally receive data and callbacks exclusively via props. These components rarely have their own state, but when they do it generally concerns UI state, as opposed to data state.
Container components are more concerned with how things work. These components provide the data and behavior to presentational or other container components. They call Flux actions and provide these as callbacks to the presentational components. They are also often stateful as they serve as data sources.
Source: github.com/Pau1fitz
Answer:
-
Class components allows you to use additional features such as local state and lifecycle hooks. Also, to enable your component to have direct access to your store and thus holds state.
-
When your component just receives props and renders them to the page, this is a stateless component, for which a pure function can be used. These are also called dumb components or presentational components.
Source: github.com/Pau1fitz
Answer: For example, AngularJS (1.x) approaches building an application by extending HTML markup and injecting various constructs (e.g. Directives, Controllers, Services) at runtime. As a result, AngularJS is very opinionated about the greater architecture of your application — these abstractions are certainly useful in some cases, but they come at the cost of flexibility.
By contrast, React focuses exclusively on the creation of components, and has few (if any) opinions about an application’s architecture. This allows a developer an incredible amount of flexibility in choosing the architecture they deem “best” — though it also places the responsibility of choosing (or building) those parts on the developer.
Source: codementor.io
Answer: At the highest level, React components have lifecycle events that fall into three general categories:
- Initialization
- State/Property Updates
- Destruction
Source: codementor.io
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q64: What is the second argument that can optionally be passed to setState and what is its purpose? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q68: If you created a React element like Twitter below, what would the component definition of Twitter look like? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q76: If you need to access the underlying DOM node for a React component, what's the typical way to do this in React? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q80: Why would you use React.Children.map(props.children, () => ) instead of props.children.map(() => )? ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer:
BasicObject
Source: githubusercontent.com
Answer:
Object
Source: githubusercontent.com
Answer: It is a constant.
Source: githubusercontent.com
Answer:
Ruby is known as a language of flexibility because it facilitates its author to alter the programming elements. Some specific parts of the language can be removed or redefined. Ruby does not restrict the user. For example, to add two numbers, Ruby allows to use +
sign or the word plus
. This alteration can be done with Ruby's built-in class Numeric.
Source: javatpoint.com
Answer: An instance of a class. To some, it's also the root class in ruby (Object). Classes themselves descend from the Object root class.
Source: stackoverflow.com
Answer: Classes hold data, have methods that interact with that data, and are used to instantiate objects.
class WhatAreClasses
def initialize
@data = "I'm instance data of this object. Hello."
end
def method
puts @data.gsub("instance", "altered")
end
end
object = WhatAreClasses.new
object.method
#=> I'm altered data of this object. Hello.
Source: stackoverflow.com
Answer: rubygems is package manager software for ruby libraries (i.e. gems). The package manager has basic CRUD operations, dependency trees, and supports asynchronous communication between multiple gem servers.
Source: stackoverflow.com
Answer:
Yes, it's called next
.
for i in 0..5
if i < 2
next
end
puts "Value of local variable is #{i}"
end
Source: stackoverflow.com
Answer: Methods are not objects. Blocks are not objects. Keywords are not objects. However, there exist Method objects and Proc objects, and some keywords refer to objects.
Source: githubusercontent.com
Answer:
Ruby redo
statement is used to repeat the current iteration of the loop. The redo statement is executed without evaluating loop's condition.
Source: javatpoint.com
Answer:
Strings are mutable while symbols are immutable. Though Ruby internally makes an immutable copy of a string when used as a hash key, comparing two symbols is faster than comparing two String
objects. This is also a convention.
Source: githubusercontent.com
Answer:
Pass the default values as arguments to ::new
on initialization or change the default directly with the method Hash#default
. You may also provide a default at the time of query with Hash#fetch
.
Source: githubusercontent.com
Answer: nil:
- nil cannot be a value
- nil is returned where there is no predicate
- nil is not a boolean data type
- nil is an object of nilclass
false:
- false can be a value
- in case of a predicate, true or false is returned by a method
- false is a boolean data type
- false is an object of falseclass
Source: javatpoint.com
Answer:
Hash#fetch
provides options for handling the case where a key does not exist in the hash.
Source: githubusercontent.com
Answer: Similarities:
- High level language
- Support multiple platforms
- Use interactive prompt called irb
- Server side scripting language
Differences:
- Ruby is fully object oriented while Python is not.
- Ruby supports EclipseIDE while Python supports multiple IDEs.
- Ruby use Mixins while Python doesn't.
- Ruby supports blocks, procs and lambdas while Python doesn't.
Source: javatpoint.com
Answer:
- Explode or expand the elements of an array.
- Collect arguments of a parameter list into an array.
Source: githubusercontent.com
Answer:
A class variable is evaluated in reference to the class object created by the enclosing class definition while an instance variable is evaluated in reference to self
. Instance variables cannot be referenced outside of instance methods.
Source: githubusercontent.com
Details:
For the class ABC
the given as:
class ABC
def xyz
puts "xyz in ABC"
end
end
What is the return value for:
ABC::new::xyz
ABC::new.xyz
ABC.new::xyz
ABC.new.xyz
Answer: All the statements for the invocation of the xyz method through the object are valid.
When run through IRB
:
irb(main):001:0> ABC::new::xyz
xyz in ABC
=> nil
irb(main):002:0> ABC::new.xyz
xyz in ABC
=> nil
irb(main):003:0> ABC.new::xyz
xyz in ABC
=> nil
irb(main):004:0> ABC.new.xyz
xyz in ABC
=> nil
Source: toptal.com
Answer:
#==
performs the generic comparison while #===
performs case equality comparison and is useful for providing meaningful semantics in case statements.
Source: githubusercontent.com
Answer:
Array#compact
removes nil
values.
>> [nil,123,nil,"test"].compact
=> [123, "test"]
Source: toptal.com
Answer:
Yes, with the help of the send
method.
Given the class Test
:
class Test
private
def method
p "I am a private method"
end
end
We can execute the private method using send
:
>> Test.new.send(:method)
"I am a private method"
Source: toptal.com
Details: Consider the following code:
class A
def self.a(b)
if b > 0
b * b
end
end
end
What will be the values of:
var1 = A.a(0)
var2 = A.a(2)
Answer:
- var1 will be equal to
nil
- var2 will be equal to
4
A conditional statement in Ruby is an expression that returns nil
if the conditional is false
. Ruby methods return the last expression in the method body.
Source: toptal.com
Details:
==
===
eql?
equal?
Answer:
-
==
– Checks if the value of two operands are equal (often overridden to provide a class-specific definition of equality). -
===
– Specifically used to test equality within thewhen
clause of acase
statement (also often overridden to provide meaningful class-specific semantics in case statements). -
eql?
– Checks if the value and type of two operands are the same (as opposed to the==
operator which compares values but ignores types). For example,1 == 1.0
evaluates totrue
, whereas1.eql?(1.0)
evaluates tofalse
. -
equal?
– Compares theidentity
of two objects; i.e., returnstrue
iff both operands have the same object id (i.e., if they both refer to the same object). Note that this will returnfalse
when comparing two identical copies of the same object.
Source: toptal.com
Details: For instance, the hash:
{ abc: 'hello', 'another_key' => 123, 4567 => 'third' }
should result in:
["abc", "4567", "another_key"]
Answer: As is always true in programming, there are in fact multiple ways to accomplish this. The most straightforward answer would be of the form:
hsh.keys.map(&:to_s).sort_by(&:length)
or:
hsh.keys.collect(&:to_s).sort_by { |key| key.length }
Alternatively, Ruby’s Enumerable
mixin provides many methods to operate on collections. The key here is to turn the hash keys into a collection, convert them all to strings, then sort the array.
def key_sort hsh
hsh.keys.collect(&:to_s).sort { |a, b| a.length <=> b.length }
end
An equivalent call of the collect
method is done with the usual block syntax of:
collect { |x| x.to_s }
Source: toptal.com
Details:
true ? "true" : "false"
false ? "true" : "false"
nil ? "true" : "false"
1 ? "true" : "false"
0 ? "true" : "false"
"false" ? "true" : "false"
"" ? "true" : "false"
[] ? "true" : "false"
Answer:
In Ruby, the only values that evaluate to false are false
and nil
. Everything else – even zero (0) and an empty array ([]) – evaluates to true.
This comes as a real surprise to programmers who have previously been working in other languages like JavaScript.
Source: toptal.com
Answer:
It's the "Ruby way" - an example of how Ruby defines methods that mimic natural language concepts. Iterator methods such as #each
read more naturally. #each
is a block so it defines a new variable scope. for/in
depends on the existence of #each
which implies that #each
is a more fundamental aspect of the language.
Source: githubusercontent.com
Answer: We are looking for the dot operator (or period operator), the Object#send method, or method(:foo).call
object = Object.new
puts object.object_id
#=> 282660
puts object.send(:object_id)
#=> 282660
puts object.method(:object_id).call # (Kudos to Ezra)
#=> 282660
Source: gist.github.com
Answer: Modules serve as a mechanism for namespaces.
module ANamespace
class AClass
def initialize
puts "Another object, coming right up!"
end
end
end
ANamespace::AClass.new
#=> Another object, coming right up!
Also, modules provide as a mechanism for multiple inheritance via mix-ins and cannot be instantiated like classes can.
module AMixIn
def who_am_i?
puts "An existentialist, that's who."
end
end
# String is already the parent class
class DeepString < String
# extend adds instance methods from AMixIn as class methods
extend AMixIn
end
DeepString.who_am_i?
#=> An existentialist, that's who.
AMixIn.new
#=> NoMethodError: undefined method ‘new’ for AMixIn:Module
Source: gist.github.com
Answer: A Domain Specific Language is an API that allows a developer to solve a problem or represent data more naturally than they might otherwise. The flexible nature of Ruby's syntax and the ability to alias and alter existing methods and classes makes it conducive to creating rich DSL's.
Source: githubusercontent.com
Answer: That an object may be acted upon even if it isn't the expected type as long as it looks and behaves like the expected object. This is a characteristic of Ruby because the lack of type checking of parameters makes this an effective programming technique.
Source: githubusercontent.com
Answer: Dynamically typed since type checking is done at runtime.
Source: githubusercontent.com
Answer:
They are public by default. You can change their visibility using Module#private
, Module#protected
, or back again using Module#public
.
Source: githubusercontent.com
Answer: A method that answers a question posed by the method invocation or method name. Predicates typically return a boolean.
$ irb
> 5.odd?
=> true
> 5.even?
=> false
> 5.between?(1, 10)
=> true
> 5.between?(11, 20)
=> false
Source: githubusercontent.com
Answer: Strongly typed since an object's type is checked before an operation is performed on it.
Source: githubusercontent.com
Details:
I have a value Dog
and an array ['Cat', 'Dog', 'Bird']
.
How do I check if it exists in the array without looping through it? Is there a simple way of checking if the value exists, nothing more?
Answer: You're looking for include?:
>> ['Cat', 'Dog', 'Bird'].include? 'Dog'
=> true
Source: githubusercontent.com
Answer:
A private method can only be called by any instance methods of the defining class or any subclasses and must be invoked in a functional style and not explicitly on self
such as with self.my_method
. A protected method may be explicitly invoked by any instance of the defining class, and is not restricted to implicit invocation on self
.
Source: githubusercontent.com
Answer: No. The behavior is different than inheritance. Any alteration of a class variable by a subclass affects that class variable in the superclass and all other subclasses of the superclass.
Source: githubusercontent.com
Answer: Class instance variables are instance variables of a class. Class instance variables cannot be used within instance methods.
Source: githubusercontent.com
Answer: To coerce an object means to force it into an expected type. One might do this in order to try and force an unknown object type into the expected type or format required by the operation. This is a common practice involved in duck typing.
Source: githubusercontent.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q50: How is the invocation of a private method different than the invocation of a public method from within its defining class? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q56: Can you tell me the three levels of method access control for classes and modules? What do they imply about the method? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q77: Write a single line of Ruby code that prints the Fibonacci sequence of any length as an array. ⭐⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer:
Think of variables as a way to store information that you want to reuse throughout your stylesheet. You can store things like colors, font stacks, or any CSS value you think you'll want to reuse. Sass uses the $
symbol to make something a variable.
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
Source: sass-lang.com
Answer: Sass let you nest your CSS selectors in a way that follows the same visual hierarchy of your HTML. CSS, on the other hand, doesn't have any visual hierarchy.
Consider example (scss):
.parent {
color: red;
.child {
color: blue;
}
}
Result (css):
.parent {
color: red;
}
.parent .child {
color: blue;
}
Source: sass-lang.com
Answer: Key features for Sass include
- Full CSS3-compatible
- Language extensions such as nesting, variables, and mixins
- Many useful functions for manipulating colors and other values
- Advanced features like control directives for libraries
- Well-formatted, customizable output
Source: career.guru99.com
Answer:
If you want to use variables inside a string, you will have to use a process called variable interpolation. To use it you will have to wrap your variables in #{}
.
Consider:
$name: 'Gajendar';
$author: 'Author : $name'; // 'Author : $name'
$author: 'Author : #{$name}';
// 'Author : Gajendar'
The interpolation method could be useful in situations where the value of a variable is determined by some conditional statements.
Source: sitepoint.com
Answer: Sass supports seven main data types:
- Numbers - most of the time they are accompanied by a unit of some sort but they are still technically numbers. You can perform basic mathematical operations on these values.
$size: 18; // A number
$px-unit: $size * 1px; // A pixel measurement
$px-string: $size + px; // A string
$px-number: $px-unit / 1px; // A number
- Strings - just like CSS, accepts both quoted and unquoted strings, even if they contain spaces
$website: 'SitePoint'; // Stores SitePoint
$name: 'Gajendar' + ' Singh'; // 'Gajendar Singh'
$date: 'Month/Year : ' + 3/2016; // 'Month/Year : 3/2016'
$date: 'Month/Year : ' + (3/2016); // 'Month/Year : 0.00149'
// This is because 3/2016 is evaluated first.
$variable: 3/2016; // Evaluated to 0.00149
- Colors - CSS color expressions come under the
color
data type. You can refer to the colors in hexadecimal notation, asrgb
,rgba
,hsl
andhsla
values or use native keywords likepink
,blue
, etc.
$color: yellowgreen; // #9ACD32
color: lighten($color, 15%); // #b8dc70
color: darken($color, 15%); // #6c9023
color: saturate($color, 15%); // #a1e01f
color: desaturate($color, 15%); // #93ba45
color: (green + red); // #ff8000
- Booleans - has only two possible values:
true
andfalse
$i-am-true: true;
body {
@if not $i-am-true {
background: rgba(255, 0, 0, 0.6);
} @else {
background: rgba(0, 0, 255, 0.6); // expected
}
}
- Null - is commonly used to define an empty state, neither
true
orfalse
. This is typically the value you want to set when defining a variable without a value, only to prevent the parser from crashing.
.foo {
content: type-of(null); // null
content: type-of(NULL); // string
$bar: 'foo' + null; // invalid null operation: "foo plus null”.
}
- Lists - are just the Sass version of arrays. You can store multiple types of values in a list.
$font-list: 'Raleway','Dosis','Lato'; // Three comma separated elements
$pad-list: 10px 8px 12px; // Three space separated elements
$multi-list: 'Roboto',15px 1.3em; // This multi-list has two lists.
- Maps - Sass maps are like associative arrays. A map stores both keys and values associated with those keys.
$styling: (
'font-family': 'Lato',
'font-size': 1.5em,
'color': tomato,
'background': black
);
h1 {
color: map-get($styling, 'color');
background: map-get($styling, 'background');
}
Source: career.guru99.com
Answer: Sass or Syntactically Awesome StyleSheets is a CSS preprocessor that adds power and elegance to the basic language. It allows you to use variables, nested rules, mixins, inline imports, and more, all with a fully CSS-compatible syntax. Sass helps keep large stylesheets well-organized, and get small stylesheets up and running quickly.
A CSS preprocessor is a scripting language that extends CSS by allowing developers to write code in one language and then compile it into CSS.
Source: sass-lang.com
Answer:
Using @extend
lets you share a set of CSS properties from one selector to another. It helps keep your Sass very dry.
Consider:
%message-shared {
border: 1px solid #ccc;
padding: 10px;
color: #333;
}
.message {
@extend %message-shared;
}
.success {
@extend %message-shared;
border-color: green;
}
.error {
@extend %message-shared;
border-color: red;
}
.warning {
@extend %message-shared;
border-color: yellow;
}
CSS output:
.message, .success, .error, .warning {
border: 1px solid #cccccc;
padding: 10px;
color: #333;
}
.success {
border-color: green;
}
.error {
border-color: red;
}
.warning {
border-color: yellow;
}
Source: career.guru99.comsass-lang.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: Scrum is one of the most popular frameworks for implementing Agile. Many people think scrum and agile are the same thing but they're not.
With scrum, the product is built in a series of fixed-length iterations called sprints that give teams a framework for shipping software on a regular cadence.
Source: atlassian.com
Answer: Three essential roles for scrum success are:
- The Product Owner are the champions for their product. They are focused on understanding business and market requirements, then prioritizing the work to be done by the engineering team accordingly.
- ** The Scrum Master** are the champion for scrum within their team. They coach the team, the product owner, and the business on the scrum process and look for ways to fine-tune their practice of it.
- The Scrum Team are the champions for sustainable development practices. Scrum teams are cross-functional, "the development team" includes testers, designers, and ops engineers in addition to developers.
Source: atlassian.com
Answer: Epic: A customer described software feature that is itemized in the product backlog is known as epic. Epics are sub-divided into stories.
User Stories: From the client perspective user stories are prepared which defines project or business functions, and it is delivered in a particular sprint as expected.
Task: Further down user stories are broken down into different task
Source: career.guru99.com
Answer: In the Scrum methodology a sprint is the basic unit of development. Scrum sprints correspond to Agile iterations.
Each sprint starts with
- a planning meeting, where the tasks for the sprint are identified and an estimated commitment for the sprint goal is made.
A Sprint ends with
- a review or retrospective meeting where the progress is reviewed and lessons for the next sprint are identified. During each sprint, the team creates finished portions of a product.
Source: stackoverflow.com
Answer: Scrum calls for four ceremonies that bring structure to each sprint:
- Sprint planning: A team planning meeting that determines what to complete in the coming sprint.
- Daily stand-up: Also known as a daily scrum, a 15-minute mini-meeting for the software team to sync.
- Sprint demo: A sharing meeting where the team shows what they've shipped in that sprint.
- Sprint retrospective: A review of what did and didn't go well with actions to make the next sprint better.
Source: atlassian.com
Answer:
-
Product backlog: It contains a list of all desired features and is owned by the product owner
-
Sprint backlog: It is a subset of the product backlog owned by development team and commits to deliver it in a sprint. It is created in Sprint Planning Meeting
Source: career.guru99.com
Answer: In Scrum the task board is a visual display of the progress of the Scrum team during a sprint. It presents a snapshot of the current sprint backlog allowing everyone to see which tasks remain to be started, which are in progress and which are done.
Consider the following layout of the task board:
- Stories
- To Do
- In Progress
- Testing
- Done
Source: manifesto.co.uk
Answer: The work to be performed in the Sprint is planned at the Sprint Planning. This plan is created by the collaborative work of the entire Scrum Team.
Sprint Planning answers the following:
- What can be delivered in the Increment resulting from the upcoming Sprint?
- How will the work needed to deliver the Increment be achieved?
The Sprint Goal is an objective set for the Sprint that can be met through the implementation of Product Backlog.
Source: scrum.org
Answer:
-
The Product Backlog is an ordered list of everything that is known to be needed in the product. It is the single source of requirements for any changes to be made to the product.
-
The Sprint Backlog is the set of Product Backlog items selected for the Sprint during the Sprint Planning, plus a plan for delivering the product Increment and realizing the Sprint Goal.
Source: scrum.org
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
[⬆] Software Architecture Interview Questions
Answer: Clustering is needed for achieving high availability for a server software. The main purpose of clustering is to achieve 100% availability or a zero down time in service. A typical server software can be running on one computer machine and it can serve as long as there is no hardware failure or some other failure. By creating a cluster of more than one machine, we can reduce the chances of our service going un-available in case one of the machine fails.
Doing clustering does not always guarantee that service will be 100% available since there can still be a chance that all the machine in a cluster fail at the same time. However it in not very likely in case you have many machines and they are located at different location or supported by their own resources.
Source: fromdev.com
Answer: A cluster is group of computer machines that can individually run a software. Clusters are typically utilized to achieve high availability for a server software. Clustering is used in many types of servers for high availability.
- App Server Cluster
An app server cluster is group of machines that can run a application server that can be reliably utilized with a minimum of down-time. - Database Server Cluster
An database server cluster is group of machines that can run a database server that can be reliably utilized with a minimum of down-time.
Source: fromdev.com
Answer: Scalability is the ability of a system, network, or process to handle a growing amount of load by adding more resources. The adding of resource can be done in two ways
- Scaling Up
This involves adding more resources to the existing nodes. For example, adding more RAM, Storage or processing power. - Scaling Out
This involves adding more nodes to support more users.
Any of the approaches can be used for scaling up/out a application, however the cost of adding resources (per user) may change as the volume increases. If we add resources to the system It should increase the ability of application to take more load in a proportional manner of added resources.
An ideal application should be able to serve high level of load in less resources. However, in practical, linearly scalable system may be the best option achievable. Poorly designed applications may have really high cost on scaling up/out since it will require more resources/user as the load increases.
Source: fromdev.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q9: "People who like this also like... ". How would you implement this feature in an e-commerce shop? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Q14: How can you keep one copy of your utility code and let multiple consumer components use and deploy it? ⭐⭐⭐
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
[⬆] TypeScript Interview Questions
Answer: JavaScript is the only client side language universally supported by all browsers. But JavaScript is not the best designed language. It’s not a class-based object-oriented language, doesn’t support class based inheritance, unreliable dynamic typing and lacks in compile time error checking. And TypeScript addresses all these problems. In other words, TypeScript is an attempt to “fix” JavaScript problems.
TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language. TypeScript is quite easy to learn and use for developers familiar with C#, Java and all strong typed languages. At the end of day “TypeScript is a language that generates plain JavaScript files.”
As stated on Typescript official website, “TypeScript lets you write JavaScript the way you really want to. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source.” Where “typed” means that it considers the types of variables, parameters and functions.
Source: talkingdotnet.com
Answer: Modules in Typescript helps in organizing the code. There are 2 types of Modules — Internal and External
-
Internal Modules are now replaceable by using Typescript’s namespace.
-
External Modules used to specify and load dependencies between multiple external js files. If there is only one js file used, then external modules are not relevant.
Answer: TypeScript is a free and open-source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language.
Answer: Generics are able to create a component or function to work over a variety of types rather than a single one.
/** A class definition with a generic parameter */
class Queue<T> {
private data = [];
push = (item: T) => this.data.push(item);
pop = (): T => this.data.shift();
}
const queue = new Queue<number>();
queue.push(0);
queue.push("1"); // ERROR : cannot push a string. Only numbers allowed
Source: basarat.gitbooks.io
Details:
Answer: TypeScript is a superset of JavaScript which primarily provides optional static typing, classes and interfaces. One of the big benefits is to enable IDEs to provide a richer environment for spotting common errors as you type the code. For a large JavaScript project, adopting TypeScript might result in more robust software, while still being deployable where a regular JavaScript application would run.
In details:
- TypeScript supports new ECMAScript standards and compiles them to (older) ECMAScript targets of your choosing. This means that you can use features of ES2015 and beyond, like modules, lambda functions, classes, the spread operator, destructuring, today.
- JavaScript code is valid TypeScript code; TypeScript is a superset of JavaScript.
- TypeScript adds type support to JavaScript. The type system of TypeScript is relatively rich and includes: interfaces, enums, hybrid types, generics, union and intersection types, access modifiers and much more. TypeScript makes typing a bit easier and a lot less explicit by the usage of type inference.
- The development experience with TypeScript is a great improvement over JavaScript. The IDE is informed in real-time by the TypeScript compiler on its rich type information.
- With strict null checks enabled (
--strictNullChecks
compiler flag) the TypeScript compiler will not allow undefined to be assigned to a variable unless you explicitly declare it to be of nullable type. - To use TypeScript you need a build process to compile to JavaScript code. The TypeScript compiler can inline source map information in the generated .js files or create separate .map files. This makes it possible for you to set breakpoints and inspect variables during runtime directly on your TypeScript code.
- TypeScript is open source (Apache 2 licensed, see github) and backed by Microsoft. Anders Hejlsberg, the lead architect of C# is spearheading the project.
Source: stackoverflow.com
Answer:
We can call base class constructor using super()
.
Source: http://www.talkingdotnet.com
Answer: Yes we do. Typescript is just a language Extension browsers can't interpret it. Converting from TypeScript to JavaScript is called compiling. Compiling doesn't mean binary code is created in this case. For this kind of translation, also the term transpilation is used instead of compilation.
Source: stackoverflow.com
Answer: These are also called the primitive types in TypeScript:
- Number type: it is used to represent number type values and represents double precision floating point values.
var variable_name: number;
- String type: it represents a sequence of characters stored as Unicode UTF-16 code. It is the same as JavaScript primitive type.
var variable_name: string;
- Boolean type: in Typescript, it is used to represent a logical value. When we use the Boolean type, we get output only in true or false. It is also the same as JavaScript primitive type.
var variable_name: bool;
- Null type: it represents a null literal and it is not possible to directly reference the null type value itself.
var variable_name:number = null;
- Undefined type: it is the type of undefined literal. This type of built-in type is the sub-type of all the types.
var variable_name:number = undefined;
Answer: TypeScript has following benefits.
- It helps in code structuring.
- Use class based object oriented programming.
- Impose coding guidelines.
- Offers type checking.
- Compile time error checking.
- Intellisense.
Source: talkingdotnet.com
Answer:
- It is an object oriented programming language (not pure).
- Here it is static typing (We can declare a variable in multiple ways). ex: var num : number.
- It has interfaces.
- It has optional parameter feature.
- It has Rest Parameter feature.
- Supports generics.
- Supports Modules
- Number, string etc. are the interfaces.
Answer: One of TypeScript’s core principles is that type-checking focuses on the shape that values have.
An interface
is a virtual structure that only exists within the context of TypeScript. The TypeScript compiler uses interfaces solely for type-checking purposes.
When you define your interface you’re saying that any object (not an instance of a class) given this contract must be an object containing interfaces properties.
Source: medium.com
Answer: If you need/wish to create an instance of perhaps a custom object, whilst getting the benefits of type-checking things such as arguments, return types or generics - a class makes sense.
If you’re not creating instances - we have interfaces at our disposal, and their benefit comes from not generating any source code, yet allowing us to somewhat “virtually” type-check our code.
Source: toddmotto.com
Answer: TypeScript supports following object oriented terms:
- Modules
- Classes
- Interfaces
- Data Types
- Member functions
Source: http://www.talkingdotnet.com
Answer: TypeScript supports getters/setters as a way of intercepting accesses to a member of an object. This gives you a way of having finer-grained control over how a member is accessed on each object.
class foo {
private _bar:boolean = false;
get bar():boolean {
return this._bar;
}
set bar(theBar:boolean) {
this._bar = theBar;
}
}
var myBar = myFoo.bar; // correct (get)
myFoo.bar = true; // correct (set)
Source: typescriptlang.org
Answer: The answer is YES. There are 4 main principles to Object Oriented Programming:
- Encapsulation,
- Inheritance,
- Abstraction, and
- Polymorphism.
TypeScript can implement all four of them with its smaller and cleaner syntax.
Source: jonathanmh.com
Answer: Just use:
if (value) {
}
It will evaluate to true
if value
is not:
null
undefined
NaN
- empty string
''
0
false
TypesScript includes JavaScript rules.
Source: stackoverflow.com
Answer:
In TypeScript, the const
keyword cannot be used to declare class properties. Doing so causes the compiler to an error with "A class member cannot have the 'const' keyword." TypeScript 2.0 has the readonly
modifier:
class MyClass {
readonly myReadonlyProperty = 1;
myMethod() {
console.log(this.myReadonlyProperty);
}
}
new MyClass().myReadonlyProperty = 5; // error, readonly
Source: stackoverflow.com
Answer: Typescript doesn’t only work for browser or frontend code, you can also choose to write your backend applications. For example you could choose Node.js and have some additional type safety and the other abstraction that the language brings.
- Install the default Typescript compiler
npm i -g typescript
- The TypeScript compiler takes options in the shape of a tsconfig.json file that determines where to put built files and in general is pretty similar to a babel or webpack config.
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": true,
"outDir": "build"
}
}
- Compile ts files
tsc
- Run
node build/index.js
Source: jonathanmh.com
Answer: We use classes as object factories. A class defines a blueprint of what an object should look like and act like and then implements that blueprint by initialising class properties and defining methods. Classes are present throughout all the phases of our code.
Unlike classes, an interface is a virtual structure that only exists within the context of TypeScript. The TypeScript compiler uses interfaces solely for type-checking purposes. Once code is transpiled to its target language, it will be stripped from interfaces.
A class may define a factory or a singleton by providing initialisation to its properties and implementation to its methods, an interface is simply a structural contract that defines what the properties of an object should have as a name and as a type.
Source: toddmotto.com
Answer: A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators are functions that take their target as the argument. With decorators we can run arbitrary code around the target execution or even entirely replace the target with a new definition.
There are 4 things we can decorate in ECMAScript2016 (and Typescript): constructors, methods, properties and parameters.
Source: www.sparkbit.pl
Answer:
.map
files are source map files that let tools map between the emitted JavaScript code and the TypeScript source files that created it. Many debuggers (e.g. Visual Studio or Chrome's dev tools) can consume these files so you can debug the TypeScript file instead of the JavaScript file.
Source: stackoverflow.com
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Read answer on 👉 FullStack.Cafe
Answer: The elements of design are:
- LINE – The linear marks made with a pen or brush or the edge created when two shapes meet.
- SHAPE – A shape is a self contained defined area of geometric (squares and circles), or organic (free formed shapes or natural shapes). A positive shape automatically creates a negative shape.
- DIRECTION – All lines have direction – Horizontal, Vertical or Oblique. Horizontal suggests calmness, stability and tranquillity. Vertical gives a feeling of balance, formality and alertness. Oblique suggests movement and action
- SIZE – Size is simply the relationship of the area occupied by one shape to that of another.
- TEXTURE – Texture is the surface quality of a shape – rough, smooth, soft hard glossy etc.
- COLOUR – Colour is light reflected off objects. Color has three main characteristics: hue or its name (red, green, blue, etc.), value (how light or dark it is), and intensity (how bright or dull it is).
Source: j6design.com.au
Answer: User-centered design is an iterative design process in which designers focus on the users and their needs in each phase of the design process. UCD calls for involving users throughout the design process via a variety of research and design techniques so as to create highly usable and accessible products for them.
User-centered design demands that designers employ a mixture of investigative (e.g., surveys and interviews) and generative (e.g., brainstorming) methods and tools to develop an understanding of user needs.
Source: interaction-design.org
Answer: User research is conducted so as to understand users’ characteristics, aims, and behaviors towards achieving these aims. Its purpose is to produce designs that improve their working practices and lives. User research also involves the continuous evaluation of the impact of designs on the users, not only during the design and development phase but after long-term use, too.
Source: interaction-design.org
Answer: Just to name a few:
- Adobe XD,
- Figma,
- Invision studio
- Sketch
- Balsamiq
Source: uxplanet.org
Answer: User interface (UI) design is not the same as UX design. A seasoned UX design pro understands the vital difference and is able to articulate it clearly. Designing for the user interface often plays an important role in the work of a UX designer, but it is not the only function.
Whereas UI design is concerned with the effective layout of visual elements on a user interface, UX design is ‘people first.’ It’s about what motivates them—how they think and behave.
A great UX designer should be able to demonstrate knowledge describing the differences, in particular how UI design is only one slice of the UX design process ‘pie’, and only one of many different disciplines that reside under the UX banner. These include, but are not limited to: a user-centered design strategy, core user demographic definition, persona creation, user research, information architecture, content strategy, interaction design, visual design and usability testing.
Source: toptal.com
Answer: Graphic designers work with graphical images, whether they be illustrations, typography, or images, and on a variety of media including print and web. Graphic design is typically rendered in 2D — printed on a physical surface or displayed on a screen but not limited to 2D.
As a graphic designer, you can specialize in the following
- Logo design
- Brand design
- Print Designer
Source: uxplanet.org
Answer: Interaction designers, focus on digital products and interactive software design. Interaction design helps human