10 most popular javascript interview questions and answers for beginners PART 1

This article was originally published at https://www.blog.duomly.com/10-most-popular-javascript-interview-questions-and-answers-for-beginners/

Intro to 10 most popular Javascript questions for beginners

In this article, I’ve gathered 10 most often asked questions about Javascript, and I decided to answer those questions, one by one.

They mostly cover Javascript basics, so if you just started to learn this programming language, that’s a good idea to go through them and understand the essential concepts.

On this list, you can find such topics like closures, promises, hoisting or classes, and much more.

Although the knowledge isn’t very advanced, it’s good to know the answers, as some of them are often asked during the interviews.

In every programming language, some concepts seem easy, but for beginners, that’s not so straightforward to understand.

So, I’m even happier to describe and explain to you all the things asked by other people, which may be helpful for you as well, and you can avoid typing than in the search box.

As always, I’ve got videos version for those who prefer watching the reading. You’ll find it under each question.

Let’s start!

What is closure in Javascript?

The closure is a combination of functions enclosed together, where the inner function has access to its variables and variables of its outer function.
I think that the easiest way to explain it would be to show you a code example.

function outer() {
  var name = 'Maria';
  function inner() {
// 'Maria'

In the code above, you can see that inner() function has access to its parent function variable, name. So, if you call the outer() function, the console.log() from the inner() function will return the name variable Maria.

However, it can access the outer function arguments object, but very often, the inner function has its own arguments object, which overshadows the external function argument object.
Let’s see the example where we will create closure with an arrow function.

function outer(a, b) {
  const inner = (a, b) => console.log(a, b);
  inner(1, 2);
outer('Alice', 'Mark');
// returns 1, 2

The main reason why we use closures is to return the function that can return the other functions.

What is DOM in Javascript?

DOM is a Document Object Model, and it’s an object-oriented representation of the website. It can be modified using Javascript.

With Javascript you can manipulate DOM elements, liked colors, positions, sizes. For selecting the specific elements of the page Javascript provides some functions to make it ease:

getElementById() - to select an element by the id property,
getElementByName() - to select an element by the name property,
getElementsByTagName() - to select all elements of the selected tag,
getElementsbyClassName() - to select all elements with the certain class name,
querySelector() - to select elements by CSS selectors.

Javascript also provides other methods to manipulate element, not only select them, like appendChild() or innerHTML().

Besides that, with Javascript, we can work with the events and styles.

What is Promise in Javascript?

Promises are using with asynchronous programming, and it’s used to start an action, which takes time to resolve and return the value.
With promises, the action can be started and finished in the background without stopping other operations of the application.
It improves the performance and user experience of many web and mobile applications.

The promise may be in three states: pending, resolved with the value, or rejected with an error.

If the promise is resolved, we can call then() method and perform an action with the returned value. In case the promise is rejected, we can use the catch() method to handle the errors.

Other methods for handling asynchronous programming are async/await and callbacks.

What is a prototype in Javascript?

Javascript objects inherit methods and properties from the prototype, and the Object.prototype is on the top of the inheritance chain.

Javascript prototype keyword also can be used to add new values and methods to our constructor.

Let’s see the code example.

function Animal(name, kind, age) {
  this.name = name;
  this.kind = kind;
  this.age = age;


You can see that using the prototype, we were able to add ownerName property to our Animal() constructor.

What is hoisting in Javascript?

Hoisting is the mechanism that lifts all declared variables and functions as well, to the top of their local scope or at the top of the global scope if they are placed in the global scope.

In Javascript, it’s possible to declare a variable after it’s used.
Hoisting is used to avoid undefined errors because otherwise, code with variable or function might be executed, but it’s not defined.

Remember to declare your variables first to make sure your code won’t have any issues with undefined values.

Here is an example to show you how it works.

// What you see
name = 'Ted';
var name;
// returns 'Ted'

// What happens in a background
var name;
name = 'Ted';
// returns 'Ted';

While you will create a variable definition using var, it will be initialized in every line as undefined.

It’s a little bit different with let and const. The variable is not initialized until the line where the initialization really happens.
So, it doesn’t call any undefined in the meantime.

Also, it’s important to remember that while you declare const, it’s necessary to initialize it simultaneously because it won’t be possible to change it.

What is an object in Javascript?

Objects are a very important element of the Javascript, and almost everything in JS is an object.  
When the variable is a container for the value, the object can have many values and can be assigned to a variable.

Values in the object are written as a name:value pairs. Objects consist of properties and methods.
Properties are just simple values, and methods are the actions that can be performed on objects.

Let’s take a look at the object example.

var student = {
  firstName: 'Alice',
  lastName: 'Jones',
  age: 21,
  sayHi: () => {
    return 'Hi, I am ' + this.firstName;

In the code above, you can see the student object, which three properties and one method.

What is a function in Javascript?

Function in Javascript is a block of code, designed to perform a task. When the function is called or invoked, it’s executed.

Functions are defined with the function keyword or as a constant. Functions may have names, or they may be anonymous.

When we define the function, we can add a few parameters in the parenthesis after the function name.

When we call the function, the values passed in the parenthesis are called arguments.

Let’s see the code example of a Javascript function.

function calculate(x, y) {
  return x * y;

calculate(2, 5);

What is a pure function in Javascript?

Pure functions are the main concept of functional programming, and it’s a function that accepts an input and returns the value without modification of other data in the scope.

In other words, in pure function, the output or returned value must depend only on the input value.

What is a constructor in Javascript?

The constructor is a special method used to initialize and create the objects within the class in Javascript.

We use the constructor with the new keyword to create a similar object with the new values.
The good practice is to call the constructor method with uppercase.

Let’s see how the constructor looks like and how to use it.

function Person(name, age) {
  this.name = name;
  this.age = age;

var man = new Person('Mark', 23);
// { name: 'Mark', age: 23 }

In the code above, I’ve created a Person constructor, and below I’ve created a new variable, called man, and created a new object based on the Person constructor.

What are Javascript classes?

Since ES6 was introduced, we can use classes in Javascript. Class is a type of function, where instead of function keyword to initialize it, we use the keyword class.

Besides that, we have to add the constructor() method inside the class, which is called every time the class is initialized.

Inside the constructor() method, we add the properties of our class. To create another class based on the existing one, we use the extends keyword.

A great example of using classes in Javascript is ReactJS frameworks, and it’s class components.


In this article, I gathered 10 common Javascript questions asked by people in search engines.
I’ve explained them in a basic and easily understandable way, so even beginners could take advantage of this article.

Some of those questions can be asked during the interview, so it’s really worth to get familiar with the answers.

I hope you’ll find this list of questions useful, and it can help you understand the basic concepts of Javascript programming languages.

Thank you for reading,
Anna from Duomly

#javascript #web-development #pwa #angular #react #vue

What is GEEK

Buddha Community

10 most popular javascript interview questions and answers for beginners PART 1
Sigrid  Farrell

Sigrid Farrell


Top 10 Critical Spring Boot Interview Questions and Answers [For Beginners & Experienced]

offers powerful features for the rapid development of deployment-ready applications. It is the most used and best java framework for the development of scalable microservices and web applications.

If you want to become a domain expert, you have come to the right place. We have curated some the most repeatedly asked spring boot interview questions and answers to help you ace the interview.

Basic Spring Boot Interview Questions And Answers

Technical Spring Boot Interview Questions And Answers


#full stack development #interview question answer #spring boot interview questions answer #top spring boot interview questions #top 10 critical spring boot interview questions #answers

Top 130 Android Interview Questions - Crack Technical Interview Now!

Android Interview Questions and Answers from Beginner to Advanced level

DataFlair is committed to provide you all the resources to make you an android professional. We started with android tutorials along with practicals, then we published Real-time android projects along with source code. Now, we come up with frequently asked android interview questions, which will help you in showing expertise in your next interview.

android interview questions

Android Interview Questions – Get ready for your next interview

Android – one of the hottest technologies, which is having a bright future. Get ready to crack your next interview with the following android interview questions. These interview questions start with basic and cover deep concepts along with advanced topics.

Android Interview Questions for Freshers

1. What is Android?

Android is an open-source mobile operating system that is based on the modified versions of Linux kernel. Though it was mainly designed for smartphones, now it is being used for Tablets, Televisions, Smartwatches, and other Android wearables.

2. Who is the inventor of Android Technology?

The inventors of Android Technology are- Andry Rubin, Nick Sears, and Rich Miner.

3. What is the latest version of Android?

The latest version of Android is Android 10.0, known as Android Q. The upcoming major Android release is Android 11, which is the 18th version of Android. [Note: Keep checking the versions, it is as of June 2020.]

4. How many Android versions can you recall right now?

Till now, there are 17 versions of Android, which have their names in alphabetical order. The 18th version of Android is also going to come later this year. The versions of Android are here:

  • Android 1.0 – Its release is 23 September 2008.
  • Android 1.1 – Its release date is 9 February 2009.
  • Android 1.5 – Its name is Cupcake, Released on 27 April 2009.
  • Android 1.6 – Its name is Donut, Released on 15 September 2009.
  • Android 2.0 – Its name is Eclair, Released on 26 October 2009
  • Android 2.2 – Its name is Froyo, Released on 20 May 2010.
  • Android 2.3 – Its name is Gingerbread, Released on 06 December 2010.
  • Android 3.0 – Its name is Honeycomb, Released on 22 February 2011.
  • Android 4.0 – Its name is Ice Cream Sandwich, Released on 18 October 2011.
  • Android 4.1 – Its name is Jelly Bean, Released on 9 July 2012.
  • Android 4.4 – Its name is KitKat, Released on 31 October 2013.
  • Android 5.0 – Its name is Lollipop, Released on 12 November 2014.
  • Android 6.0 – Its name is Marshmallow, Released on 5 October 2015.
  • Android 7.0 – Its name is Nougat, Released on 22 August 2016.
  • Android 8.0 – Its name is Oreo, Released on 21 August 2017.
  • Android 9.0 – Its name is Pie, Released on 6 August 2018.
  • Android 10.0 – Its name is Android Q, Released on 3 September 2019.
  • Android 11.0 – As of now, it is Android 11.

5. Explain the Android Architecture with its components.

This is a popular android developer interview question

Android Architecture consists of 5 components that are-

a. Linux Kernel: It is the foundation of the Android Architecture that resides at the lowest level. It provides the level of abstraction for hardware devices and upper layer components. Linux Kernel also provides various important hardware drivers that act as software interfaces for hardwares like camera, bluetooth, etc.

b. Native Libraries: These are the libraries for Android that are written in C/C++. These libraries are useful to build many core services like ART and HAL. It provides support for core features.

c. Android Runtime: It is an Android Runtime Environment. Android Operating System uses it during the execution of the app. It performs the translation of the application bytecode into the native instructions. The runtime environment of the device then executes these native instructions.

d. Application Framework: Application Framework provides many java classes and interfaces for app development. And it also provides various high-level services. This complete Application framework makes use of Java.

e. Applications: This is the topmost layer of Android Architecture. It provides applications for the end-user, so they can use the android device and compute the tasks.

6. What are the services that the Application framework provides?

The Android application framework has the following key services-

a. Activity Manager: It uses testing and debugging methods.

b. Content provider: It provides the data from application to other layers.

c. Resource Manager: This provides users access to resources.

d. Notification Manager: This gives notification to the users regarding actions taking place in the background.

e. View System: It is the base class for widgets, and it is also responsible for event handling.

7. What are the important features of Linux Kernel?

The important features of the Linux Kernel are as follows:

a. Power Management: Linux Kernel does power management to enhance and improve the battery life of the device.

b. Memory Management: It is useful for the maximum utilization of the available memory of the device.

c. Device Management: It includes managing all the hardware device drivers. It maximizes the utilization of the available resources.

d. Security: It ensures that no application has any such permission that it affects any other application in order to maintain security.

e. Multi-tasking: Multi-tasking provides the users the ease of doing multiple tasks at the same time.

8. What are the building blocks of an Android Application?

This is a popular android interview question for freshers.

The main components of any Android application are- Activity, Services, Content Provider, and Broadcast Receiver. You can understand them as follows:

a. Activity- It is a class that acts as the entry point representing a single screen to the user. It is like a window to show the user interface.

b. Services- Services are the longest-running component that runs in the background.

c. Content Provider- The content provider is an essential component that allows apps to share data between themselves.

d. Broadcast receivers- Broadcast receiver is another most crucial application component. It helps the apps to receive and respond to broadcast messages from the system or some other application.

9. What are the important components of Android Application?

The Components of Android application are listed below:

  1. Widgets
  2. Intents
  4. Notification
  5. Fragments
  6. Layout XML files
  7. Resources

10. What are the widgets?

Widgets are the variations of Broadcast receivers. They are an important part of home screen customization. They often display some data and also allow users to perform actions on them. Mostly they display the app icon on the screen.

11. Can you name some types of widgets?

Mentioned below are the types of widgets-

a. Informative Widgets: These widgets show some important information. Like, the clock widget or a weather widget.

b. Collective Widgets: They are the collection of some types of elements. For example, a music widget that lets us change, skip, or forward the song.

c. Control Widgets: These widgets help us control the actions within the application through it. Like an email widget that helps check the recent mails.

d. Hybrid Widgets: Hybrid widgets are those that consist of at least two or more types of widgets.

12. What are Intents?

Intents are an important part of Android Applications. They enable communication between components of the same application as well as separate applications. The Intent signals the Android system about a certain event that has occurred.

13. Explain the types of intents briefly?

Intent is of three types that are-

a. Implicit Intents: Implicit intents are those in which there is no description of the component name but only the action.

b. Explicit Intents: In explicit intents, the target component is present by declaring the name of the component.

c. Pending Intents: These are those intents that act as a shield over the Intent objects. It covers the intent objects and grants permission to the external app components to access them.

14. What is a View?

A view is an important building block that helps in designing the user interface of the application. It can be a rectangular box or a circular shape, for example, Text View, Edit Text, Buttons, etc. Views occupy a certain area of the screen, and it is also responsible for event handling. A view is the superclass of all the graphical user interface components.

15. What do you understand by View Group?

It is the subclass of the ViewClass. It gives an invisible container to hold layouts or views. You can understand view groups as special views that are capable of holding other views, that are Child View.

16. What do you understand about Shared Preferences?

It is a simple mechanism for data storage in Android. In this, there is no need to create files, and using APIs, it stores the data in XML files. It stores the data in the pair of key-values. SharedPreferences class lets the user save the values and retrieve them when required. Using SharedPreferences we can save primitive data like- boolean, float, integer, string and long.

17. What is a Notification?

A notification is just like a message that shows up outside the Application UI to provide reminders to the users. They remind the user about a message received, or some other timely information from the app.

18. Give names of Notification types.

There are three types of notifications namely-

a. Toast Notification- This notification is the one that fades away sometime after it pops up.

b. Status Notification- This notification stays till the user takes some action on it.

c. Dialog Notification- This notification is the result of an Active Activity.

19. What are fragments?

A fragment is a part of the complete user interface. These are present in Activity, and an activity can have one or more fragments at the same time. We can reuse a fragment in multiple activities as well.

20. What are the types of fragments?

There are three types of fragments that are: Single Fragment, List Fragment, Fragment Transactions.

  1. Single Transactions can only show a single view for the user.
  2. List Fragments have a special list view feature that provides a list from which the user can select one.
  3. Fragment Transactions are helpful for the transition between one fragment to the other.

Frequently asked Android Interview Questions and Answers

21. What are Layout XML files?

Layout XML files contain the structure for the user interface of the application. The XML file also contains various different layouts and views, and they also specify various GUI components that are there in Activity or fragments.

22. What are Resources in Android Application?

The resources in Android Apps defines images, texts, strings, colors, etc. Everything in resources directory is referenced in the source code of the app so that we can use them.

23. Can you develop Android Apps with languages other than Java? If so, name some.

Yes, there are many languages that we can work with, for the development of Android Applications. To name some, I would say Java, Python, C, C++, Kotlin, C#, Corona/LUA.

24. What are the states of the Activity Lifecycle?

Activity lifecycle has the following four stages-

a. Running State: As soon as the activity starts, it is the first state.

b. Paused State: When some other activity starts without closing the previous one, the running activity turns into the Paused state.

c. Resume State: When the activity opens again after being in pause state, it comes into the Resume State.

d. Stopped State: When the user closes the application or stops using it, the activity goes to the Stopped state.

25. What are some methods of Activity?

The methods of Activity are as follows:

  • onCreate()
  • onStart()
  • onPause()
  • onRestart()
  • onResume()
  • onStop()
  • onDestroy()

26. How can you launch an activity in Android?

We launch an activity using Intents. For this we need to use intent as follows:

  1. ntent intent_name= new Intent(this, Activity_name.class);
  2. startActivity(intent_name);

27. What is the service lifecycle?

There are two states of a service that are-

a. Started State: This is when the service starts its execution. A Services come in start state only through the startService() method.

b. Bounded State: A service is in the bounded state when it calls the method bindService().

28. What are some methods of Services?

The methods of service are as follows-

  • onStartCommand()
  • onBind()
  • onCreate()
  • onUnbind()
  • onDestroy()
  • onRebind()

29. What are the types of Broadcast?

Broadcasts are of two types that are-

a. Ordered Broadcast: Ordered broadcasts are Synchronous and work in a proper order. It decides the order by using the priority assigned to the broadcasts.

b. Normal Broadcast: These are asynchronous and unordered. They are more efficient as they run unorderly and all at once. But, they lack full utilization of the results.

30. What are useful impotent folders in Android?

The impotent folders in an Android application are-

  1. build.xml- It is responsible for the build of Android applications.
  2. bin/ – The bin folder works as a staging area to wrap the files packages into the APK.
  3. src/ – The src is a folder where all the source files of the project are present.
  4. res/ – The res is the resource folder that stores values of the resources that are used in the application. These resources can be colors, styles, strings, dimensions, etc.
  5. assets/ – It provides a facility to include files like text, XML, fonts, music, and video in the Android application.

31. What are the important files for Android Application when working on Android Studio?

This is an important android studio interview question

There are following three files that we need to work on for an application to work-

a. The AndroidManifest.xml file: It has all the information about the application.

b. The MainActivity.java file: It is the app file that actually gets converted to the dalvik executable and runs the application. It is written in java.

c. The Activity_main.xml file: It is the layout file that is available in the res/layout directory. It is another mostly used file while developing the application.

32. Which database do you use for Android Application development?

The database that we use for Android Applications is SQLite. It is because SQLite is lightweight and specially developed for Android Apps. SQLite works the same way as SQL using the same commands.

33. Tell us some features of Android OS.

The best features of Android include-

  1. Multi-tasking
  2. Support for a great range of languages
  3. Support for split-screen
  4. High connectivity with 5G support
  5. Motion Control

34. Why did you learn Android development?

Learning Android Studio is a good idea because of the following-

  1. It has a low application development cost.
  2. It is an open-source platform.
  3. It has multi-platform support as well as Multi-carrier support.
  4. It is open for customizations.
  5. Android is a largely used operating system throughout the world.

35. What are the different ways of storage supported in Android?

The various storage ways supported in Android are as follows:

  1. Shared Preference
  2. Internal Storage
  3. External Storage
  4. SQLite Databases
  5. Network Connection

36. What are layouts?

Layout is nothing but arrangements of elements on the device screen. These elements can be images, tests, videos, anything. They basically define the structure of the Android user interface to make it user friendly.

37. How many layout types are there?

The type of layouts used in Android Apps are as follows:

  1. Linear Layout
  2. Relative Layout
  3. Constraint Layout
  4. Table Layout
  5. Frame Layout
  6. Absolute Layout
  7. Scrollview layout

38. What is an APK?

An APK stands for Android Package that is a file format of Android Applications. Android OS uses this package for the distribution and installation of the Android Application.

39. What is an Android Manifest file?

The manifest file describes all the essential information about the project application for build tools, Android operating system, and google play. This file is a must for every Android project that we develop, and it is present in the root of the project source set.

#android tutorials #android basic interview questions #android basic questions #android developer interview questions #android interview question and answer #android interview questions #android interview questions for experienced #android interview questions for fresher

Osiki  Douglas

Osiki Douglas


50 Python Interview Questions and Answers

Ace your next coding interview

Are you preparing for a job interview or an exam that involves knowledge about Python? Or do you want to quickly go through common topics of Python?

Here is a list of 50 interview questions with answers. The list is in no particular order.

I hope you enjoy it.

1. Name Some Differences Between a List and a Tuple

2. What Does the Range() Function Do?

3. How Does Map() Function Work?

4. What is the Difference between “is” and “==”?

#python #data-science #software-development #50 python interview questions and answers #interview questions and answers #python interview questions and answers

Juanita  Apio

Juanita Apio


21 Most Read C++ Interview Questions & Answers [For Freshers]

Even today, C++ is as popular as it was back in the 80s. This general-purpose, compiled, and multi-paradigm (object-oriented, procedural, and functional) programming language plays a crucial role in the IT industry, particularly in software development.

Developers worldwide use C++ to build systems software, database software, embedded software, enterprise applications, GUI-based applications, compilers, advanced computation & graphics, operating systems, browsers, games, cloud systems, etc. Naturally, C++ is still a highly relevant programming language.

In this post, we’ve created a list of 21 C++ interview questions that you should know if you aspire to build a career in Software Development. These C++ interview questions and answers will help you break the ice on the subject!

#c interview questions #c interview questions and answers #interview questions and answers

Aketch  Rachel

Aketch Rachel


21 Most Read C++ Interview Questions & Answers [For Freshers]

Even today, C++ is as popular as it was back in the 80s. This general-purpose, compiled, and multi-paradigm (object-oriented, procedural, and functional) programming language plays a crucial role in the IT industry, particularly in software development.

Developers worldwide use C++ to build systems software, database software, embedded software, enterprise applications, GUI-based applications, compilers, advanced computation & graphics, operating systems, browsers, games, cloud systems, etc. Naturally, C++ is still a highly relevant programming language.

In this post, we’ve created a list of 21 C++ interview questions that you should know if you aspire to build a career in Software Development. These C++ interview questions and answers will help you break the ice on the subject!

#full stack development #c interview questions #c interview questions and answers #interview questions and answers