Wednesday, April 19, 2017

JavaScript Interview Questions & Answers 1

1. What is JavaScript?
JavaScript is a platform-independent, event-driven, client-side scripting and programming language, which explains Netscape Communications Corporation is a web browser developed by Sun Microsystems. JavaScript which tends to represent the most widely used software in a variety of HTML object is a document and the document itself material.

2. Calculate the difference between Java and JavaScript?
Java is a complete programming language. In contrast, JavaScript is a coded program that can be launched on the HTML page. These two languages are not all inter-dependent and are designed for different purposes. Java is an object-based programming (OOPS) or structured programming languages such as C ++ or C. JavaScript is a client-side scripting language and it can be said that it’s unregulated programming.

3. What is the type of JavaScript?
   The following is the kind of JavaScript:
·         Number
·         Rope
·         Boolean
·         Action
·         Purpose
·         Just
·         Indefinite

4. JavaScript and an ASP script, which is faster?
JavaScript fast JavaScript does not require a client-side language and thus the web server support is needed. On the other hand, ASP is server-side language and so it's always slow compared to JavaScript. JavaScript is still a server side language (node JS).

5. What can JavaScript program?
JavaScript without access to the web server on-the-fly generation of HTML pages helps. Users of the validity of user input to the client machine as the browser are simple computations can be performed on the user's browser, operating system, screen size, you can control and manage the date and time can be detected.

6. Are Java and JavaScript the same?
No.java and JavaScript are two different languages Java a powerful object-oriented programming language
Like C ++, C, whereas a client-side scripting language, JavaScript, with some limitations.

7. How to read and write a file using JavaScript?
I / O operations like reading or writing a file are not possible with client-side JavaScript. However, this is a Java applet that can be accomplished by coding the search for the script file.

8. What is the relationship between JavaScript and ECMA Script programming?
ECMA Script is the name of yet (other names include Live Script) is another name for JavaScript. JavaScript support your browser in order to see the current version of ECMA Script 3.

9. What kind of JavaScript?
The number of different types of JavaScript, string, Boolean, function, object, null, is unspecified.

10. What in JavaScript is dynamically typed?
We have a number assigned to a JavaScript variable and then you can assign a string to the same variable as follows:
Example:
i = 10;
I = "string"; the variable type is called.

11. How JavaScript to convert numbers between different bases?
parseInt () function that takes a string as the first parameter and a second parameter to use as a base. So, to convert a decimal to hexadecimal 3F, using the
parseInt ( "3F", 16);

12. What isNaN function work?
This function returns true if the argument is not a number.

13. What is negative infinity?
JavaScript is a number; a negative number is obtained by dividing by zero.

14. What support JavaScript Boolean operators?
The JavaScript support Boolean operators are &&, || And!.

15. What is "1" + 2 + 4 to evaluate?
From the time when 1 is a string, the whole thing is a string, so the result is 124.

16. How about 2 + 5 "8"?
Since the integer 2 and 5, the number 8 is a string of mathematical since it concatenation, so 78 results.

17. What the looping structure is JavaScript?
JavaScript is supported looping structure, time, no time loops, but no foreach

18. What is this word?
This term refers to the current object.

19. How to set the background color of an HTML document?
document.bgcolor property can be set to an appropriate color.

20. What JavaScript null What does it mean?
A null value is a value representing a unique value or object. It an object or a null string a valid Boolean value which indicates the number and array of objects

21. What JavaScript undefined value what does it mean?
The existence or lack of any standard or code Undefined value of the property is not determined the existence of scarcity means that variable is used.

22. What is the difference between the value of undefined and null values?
The main difference between the value of undefined and null values are:
1. Untold value cannot be stated explicitly in the words sound as null values are not called ambiguous call.
2. Type of undefined variable or the return of property, as the opposed type of null values.

23. Does have the opportunity to level the concept of JavaScript?
There is no chance no. JavaScript block level, all variables declared inside a function scope, unlike C, C ++, Java possesses the same level.

24. What undefined and undeclared variables?
The program was announced in undeclared variables (does not exist at all), trying to read their value in a runtime error. But undeclared variables are then handed over to the implicit declaration.

An undefined variable is assigned a value that is read, but these variables are declared program.Trying gives special value is the undefined value.

25. What delete operator work?
Delete to delete the operator of all the variables and objects used in the program is used, but it does not delete variables declared var keyword.

26. What does not have to break and statements?
Statement on a new iteration of the current loop (if not specified tag), continuing the break statement to exit the loop

27. What is negative infinity?
Negative Infinity is a digit in JavaScript which can be derivative by isolating negative number by zero.

28. Is it possible to break JavaScript Code into several lines?
Breaking inside a strong statement can be complete by the use of a backslash, ‘\’, at the end of the first line
29. Which company developed JavaScript?
Netscape is the software company who developed JavaScript.

30. What are undeclared and undefined variables?
Undeclared variables are a program that does not exist and is not announced.
Undefined variables are declared in the program but they are not priced at all. If the program tries to read the value of an undefined variable, an undefined value is returned.

31. What are global variables? How are this variable declared and what are the problems associated with using them?
Global variables that are available in the length of the code, that is, there is no scope available. Var key is used to declare a local variable. If the var key is omitted, then a global variable will be declared.

32. What is a prompt box?
A prompt box is a box that provides a text box to enter user input. Labels and boxes will be provided to enter text or numbers.

33. What is ‘this’ keyword in JavaScript?
The expression 'this' refers to the object where it was said.

34. Explain the working of timers in JavaScript? Also explain the weaknesses using the timer, if any?
The timer is used to run a position of code at a specific time or repeated the code within a certain period. This function is made using setTimeout, setInterval and clearInterval.
SetTimeout (function, delay) function is used to start a timer, which calls a specific function after the specified delay. The SetInterval (function, delay) function is delayed only for the delayed function of the given delay and to be canceled at the time of cancellation. The clear intranwall (id) tells the function timer to stop.
The timer works on a single thread, and thus the events may be rows, waiting for execution.

35. What is the difference between View State and Session State?
'View state' is a page specific to a page.
The 'session state' is specific to specific information that can be accessed on all pages of the web application

36. Does JavaScript support auto type conversion?
Yes JavaScript supports automatic type conversion; It is the common way to convert types used by JavaScript developers

37. Explain how to read and write a file using JavaScript?
There are two ways to read and write a file using JavaScript
• Use the JavaScript Extension
• Using a web page and ActiveX object

37. What are all the looping structures in JavaScript?
Following are looping structures in JavaScript:
·         For
·         While
·         do-while loops

39. What is called variable typing in JavaScript?
Variable typing is used to determine the a number of variables and the same variable can be allocated to a string.

40. How is DOM used in JavaScript?
DOM stands for Document Object Model and is responsible for how many objects of a document communicate with each other. DOM is required to develop web pages, which include links like links, links, etc. These objects can be managed to include actions such as acne or delete. DOM is also required to add additional capabilities to a web page. Above, the use of the API gives an advantage over other existing models.

41. How did the event handlers use JavaScript?
Events will result in actions, such as clicking a link or completing a form, by the user. An event handler is required to manage these operations to perform properly. This feature includes the name of the event and the action taken when the event is played.

42. Explain the role of delayed scripts in JavaScript?
By default, HTML code parsing does not stop during page loading until the script is closed. This means that if the server is slow or the script is particularly heavy, then the webpage is displayed with a delay. When using the default, the scripts execute script execution while running HTML parser. These web pages decrease the loading time and they appear faster.

43. What are the various functional components in JavaScript?
There are various effective components in JavaScript-
First Class Function: JavaScript functions are used as first-class objects. This usually means that these functions can be passed as arguments to other functions, to be returned from the defined function for variables, or stored in the data structures.
Nested function: Function; which is defined in other functions, it says nested function. They called 'every time' to call the main function.

44. Write about the error shown in JavaScript?
JavaScript gives a message if it encounters an error. The recognized errors are:
Load-time error: The error shown during page loading is calculated under the load-time errors. These errors are met by using inappropriate syntax and are thus being detected when the page is loading.
Run-time error: an error that comes when it is running in the program. It is caused by the illegal operation, for example, a number separator by zero, or try to access an existential area of memory
Logic error: It uses the syntactic correct code, which does not satisfy the required action. For example, an infinite loop.

45. What are Screen objects?
Screen objects are used to read the information from the client’s screen. The properties of screen objects are –
·         Avail Height: Gives the height of client’s screen
·         Avail Width: Gives the width of client’s screen.
·         Color Depth: Gives the bit depth of images on the client’s screen
·         Height: Gives the total height of the client’s screen, including the taskbar
·         Width: Gives the total width of the client’s screen, including the taskbar


No comments:

Post a Comment