February 15, 2021

Top 20 AJAX Interview Questions and Answers

 

Ques. 1): Is AJAX a programming language?

Answer: 

No, it is not. AJAX is an innovative technique designed for the purpose of creating modern day rapidly performing web applications in order to make the world of internet faster and more conducive to users. Importantly, AJAX primarily makes use of asynchronous data transfer between the web server and the browser.

AngularJS Interview Questions and Answers

Ques. 2): So, what do you think are the eventual objectives of AJAX in the first place?

Answer: 

AJAX has many potential objectives. First and foremost, it is used to mitigate the intensity of core network load, not to mention building a highly interactive user interface. Also, a reduced web server hit is one of the major goals of using AJAX. Additionally, platform and architecture neutrality continues to be the rudimentary aspects of AJAX. Moreover, it is also used for the purpose of both synchronous and asynchronous communication.

JavaScript Interview Questions and Answers

Ques. 3): Is Ajax Just Another Name For Xmlhttprequest?

Answer: 

No. XMLHttpRequest is only part of the Ajax equation. XMLHttpRequest is the technical component that makes the asynchronous server communication possible; Ajax is our name for the overall approach described in the article, which relies not only on XMLHttpRequest, but on CSS, DOM, and other technologies.

Node.js Interview Questions and Answers

Ques. 4): Why Does Html_ajax Hang on Some Server Installs?

Answer: 

If you run into an HTML_AJAX problem only on some servers, chances are your running into a problem with output compression. If the output compression is handled in the PHP config we detect that and do the right thing, but if its done from an apache extension we have no way of knowing its going to compress the body. Some times setting HTML_AJAX::sendContentLength to false fixes the problem, but in other cases you'll need to disabled the extension for the AJAX pages.

I've also seen problems caused by debugging extensions like XDebug, disabling the extension on the server page usually fixes that. Questions dealing with Using HTML_AJAX, and general JavaScript development

JQuery Interview Questions and Answers

Ques. 5): Are Ajax Applications Easier To Develop Than Traditional Web Applications?

Answer: 

Not necessarily. Ajax applications inevitably involve running complex JavaScript code on the client. Making that complex code efficient and bug-free is not a task to be taken lightly, and better development tools and frameworks will be needed to help us meet that challenge.

Advance Java interview Questions and Answers

Ques. 6): What is the difference between proxied and proxyless calls in AJAX?

Answer: 

Proxied calls are made through stub objects which can be called from PHP classes on the JavaScript side in AJAX.

Proxyless calls are made using utility JavaScript functions like HTML_AJAX.replace() and HTML_AJAX.append() in AJAX.

 

Ques. 7): What are the pre-requisites to execute AJAX applications on a server?

Answer: 

AJAX is a built-in functionality of .NET Framework 4.0 and AJAX application can be executed by just installing Microsoft Visual Studio 2010. To use extenders in your applications, you are required to install AJAX Control Toolkit and copy the AjaxControlToolkit.dll file to the Bin directory of your application.

 

Ques. 8): One of the demerits of AJAX is the redundant flow of requests. How can we hope to tackle simultaneous requests in AJAX?

Answer: 

To tackle concurrent requests, the respective Java script functions need to be written. Having written the functions, the call back function can be applied as a parameter in order to tackle simultaneous requests. The concerned parameters are then passed to what is known as the Ajax Interaction object to tackle the concurrency of incoming requests.

 

Ques: 9): What do you understand by the script manager?

Answer: 

Chiefly, the Script Manager acts as a perfunctory mediator. It is essentially important for the management of the client-side script of AJAX. It is important to note that any page that uses AJAX has a Script Manager in order to enable the application of AJAX libraries.

 

Ques: 10): What Browsers Does Html_ajax Work With?

Answer: 

We don't have a list right now, but most of the API is stable as of 0.3.0, all the examples that ship with HTML_AJAX have been verified to work with

1.    Firefox 1.0+

2.    Internet Explorer 5.5+ (5.0 should work but it hasn't been tested)

Most things work with

1.    Safari 2+

2.    Opera 8.5+ of 0.3.0. There should be no major changes at this point, though there will be lots of new additions.

 

Ques: 11): How many types of triggers are present in update panel?

Answer: 

There are two types of triggers used in update panel:

•      PostBackTrigger – This works as full postback and it cannot work asynchronously

•      AsyncPostBackTrigger – Partial post back asynchronously

 

Ques: 12): What are the disadvantages of Ajax?

Answer: 

Following are the disadvantages of Ajax:

1.    AJAX is dependent on Javascript. If there is some Javascript problem with the browser or in the OS, Ajax will not support

2.    Ajax can be problematic in Search engines as it uses Javascript for most of its parts.

3.    Source code written in AJAX is easily human readable. There will be some security issues in Ajax.

4.    Debugging is difficult

5.    Increases size of the requests

6.    Slow and unreliable network connection.

7.    Problem with browser back button when using AJAX enabled pages.

 

Ques. 13): What is the difference between RegisterClientScriptBlock, RegisterClientScriptInclude and RegisterClientScriptResource?

Answer: 

Following are the functions:

•      RegisterClientScriptBlock – The script is specified as a string parameter.

•      RegisterClientScriptInclude – By setting the source attribute to a URL that point to a script file.

•      RegisterClientScriptResource – specifies Resource name in an assembly. The source attribute is automatically populated with a URL by a call to an HTTP handler that retrieves the named script from the assembly.

 

Ques. 14): What are the properties of XMLHttpRequest?

Answer: 

The important properties of the XMLHttpRequest object are given below.

•    onReadyStateChange - It is called whenever readystate attribute changes.

•    readyState - It represents the state of the request.

•    responseText - It returns response as text.

•    responseXML - It returns response as XML.

•    status - It returns the status number of a request.

•    statusText - It returns the details of status.

 

Ques. 15): What are the different ready states of a request in AJAX?

Answer: 

There are 5 ready states of a request in AJAX.

•    0 means UNOPENED

•    1 means OPENED

•    2 means HEADERS_RECEIVED

•    3 means LOADING

•    4 means DONE

 

Ques. 16): Won't My Server-side Framework Provide Me With Ajax?

Answer: 

You may be benefiting from AJAX already. Many existing Java based frameworks already have some level of AJAX interactions and new frameworks and component libraries are being developed to provide better AJAX support. I won't list all the Java frameworks that use AJAX here, out of fear of missing someone, but you can find a good list at www.ajaxpatterns.org/Java_Ajax_Frameworks.

If you have not chosen a framework yet it is recommended you consider using JavaServer Faces or a JavaServer Faces based framework. JavaServer Faces components can be created and used to abstract many of the details of generating JavaScript, AJAX interactions, and DHTML processing and thus enable simple AJAX used by JSF application developer and as plug-ins in JSF compatible IDE's, such as Sun Java Studio Creator.

 

Ques. 17): Is Adaptive Path Selling Ajax Components Or Trademarking The Name? Where Can I Download It?

Answer: 

Ajax isn’t something you can download. It’s an approach — a way of thinking about the architecture of web applications using certain technologies. Neither the Ajax name nor the approach is proprietary to Adaptive Path.

 

Ques. 18): Some Of The Google Examples You Cite Don't Use Xml At All. Do I Have To Use Xml And/or Xslt In An Ajax Application?

Answer: 

No. XML is the most fully-developed means of getting data in and out of an Ajax client, but there’s no reason you couldn’t accomplish the same effects using a technology like JavaScript Object Notation or any similar means of structuring data for interchange.

 

Ques. 19): Are There Any Security Issues With Ajax?

Answer: 

JavaScript is in plain view to the user with by selecting view source of the page. JavaScript cannot access the local file system without the user's permission. An AJAX interaction can only be made with the servers-side component from which the page was loaded. A proxy pattern could be used for AJAX interactions with external services.

You need to be careful not to expose your application model in such as way that your server-side components are at risk if a nefarious user to reverse engineer your application. As with any other web application, consider using HTTPS to secure the connection when confidential information is being exchanged.

 

Ques. 20): When Should I Use A Java Applet Instead Of Ajax?

Answer:

•    Applets provide features like custom data streaming, graphic manipulation, threading, and advanced GUIs which AJAX cannot.

•    However, with the help of DHTML, the functionalities of AJAX can be extended further.

•    AJAX requires that the browser be DHTML and AJAX capable.

•    AJAX-based functionality does need to take browser differences into consideration due to which using a JavaScript library such as Dojo which abstracts browser differences is recommended.

•    AJAX/DHTML works well for applications where the latest browsers are used.

 

 

February 12, 2021

Top 20 C++ language Interview Questions & Answers

 

Ques. 1): What is ‘this’ pointer?

Answer: The ‘this’ pointer is passed as a hidden argument to all non-static member function calls and is available as a local variable within the body of all non-static functions. ‘this’ pointer is a constant pointer that holds the memory address of the current object. ‘this’ pointer is not available in static member functions as static member functions can be called without any object (with class name).

 

Ques. 2): What are VTABLE and VPTR?

Answer: vtable is a table of function pointers. It is maintained per class.

vptr is a pointer to vtable. It is maintained per object.

Compiler adds additional code at two places to maintain and use vtable and vptr.

1) Code in every constructor. This code sets vptr of the object being created. This code sets vptr to point to vtable of the class.

2) Code with polymorphic function call (e.g. bp->show()). Wherever a polymorphic call is made, compiler inserts code to first look for vptr using base class pointer or reference, for example, since pointed or referred object is of derived type, vptr of derived class is accessed). Once vptr is fetched, vtable of derived class can be accessed. Using vtable, address of derived derived class function show() is accessed and called.

 

Ques. 3): What do you mean by ‘void’ return type?

Answer: All functions should return a value as per the general syntax.

However, in case, if we don’t want a function to return any value, we use “void” to indicate that. This means that we use “void” to indicate that the function has no return value or it returns “void”.

Example:

void myfunc()

{

Cout<<”Hello,This is my function!!”;

}

int main()

{

myfunc();

return 0;

}

 

Ques. 4): What is an Inline function in C++?

Answer: Inline function is a function that is compiled by the compiler as the point of calling the function and the code is substituted at that point. This makes compiling faster. This function is defined by prefixing the function prototype with the keyword “inline”.

Such functions are advantageous only when the code of the inline function is small and simple. Although a function is defined as Inline, it is completely compiler dependent to evaluate it as inline or not.

 

Ques. 5): What is a Reference Variable in C++?

Answer: A reference variable is an alias name for the existing variable. This means that both the variable name and the reference variable point to the same memory location. Hence, whenever the variable is updated, the reference is updated too.

Example:

int a=10;

 int& b = a;

Here, b is the reference of a.

 

Ques. 6): When to use “const” reference arguments in a function?

Answer: Using “const” reference arguments in a function is beneficial in several ways:

   “const” protects from programming errors that could alter data.

   As a result of using “const”, the function is able to process both const and non-const actual arguments, which is not possible when “const” is not used.

   Using a const reference will allow the function to generate and use a temporary variable in an appropriate manner.

 

Ques. 7): What is the main difference between Class and Structure.

Answer:

Structure: In C language, the structure is used to bundle different types of data types together. The variables inside a structure are called the members of the structure. These members are by default public and can be accessed by using the structure name followed by a dot operator and then the member name.

Class: Class is a successor of the Structure. C++ extends the structure definition to include the functions that operate on its members. By default, all the members inside the class are private.

 

Ques. 8): What is Namespace?

Answer: Namespace allows us to group a set of global classes, objects and/or functions under a specific name.

The general form to use namespaces is:

namespace identifier { namespace-body }

Where identifier is any valid identifier and the namespace-body is the set of classes, objects, and functions that are included within the namespace. Namespaces are especially useful in the case where there is a possibility for more than one object to have the same name, resulting in name clashes.

 

Ques. 9): What is Name Mangling?

Answer: C++ compiler encodes the parameter types with function/method into a unique name. This process is called name mangling. The inverse process is called as demangling.

Example:

A::b(int, long) const is mangled as ‘b__C3Ail’.

For a constructor, the method name is left out.

That is A:: A(int, long) const is mangled as ‘C3Ail’.

 

Ques. 10): What is a COPY CONSTRUCTOR and when is it called?

Answer: A copy constructor is a constructor that accepts an object of the same class as its parameter and copies its data members to the object on the left part of the assignment. It is useful when we need to construct a new object of the same class.

Example:

class A{

int x; int y;

public int color;

public A() : x(0) , y(0) {} //default (no argument) constructor

public A( const A& ) ;

};

A::A( const A & p )

{

this->x = p.x;

this->y = p.y;

this->color = p.color;

}

main()

{

A Myobj;

Myobj.color = 345;

A Anotherobj = A( Myobj ); // now Anotherobj has color = 345

}

 

Ques. 11): What is the main difference between Declaration and Definition of a variable?

Answer: The declaration of a variable is merely specifying the data type of a variable and the variable name. As a result of the declaration, we tell the compiler to reserve the space for a variable in the memory according to the data type specified.

Example:

int Result;

char c;

int a,b,c;

All the above are valid declarations. Also, note that because of the declaration, the value of the variable is undetermined.

Whereas, a definition is an implementation/instantiation of the declared variable where we tie up appropriate value to the declared variable so that the linker will be able to link references to the appropriate entities.

From above Example,

Result = 10;

C = ‘A’;

These are valid definitions.

 

Ques. 12): What is Local and Global scope of a variable in C++?

Answer: The scope of a variable is defined as the extent of the program code within which the variable remains active i.e. it can be declared, defined or worked with.

There are two types of scope in C++:

1. Local Scope: A variable is said to have a local scope or is local when it is declared inside a code block. The variable remains active only inside the block and is not accessible outside the code block.

2. Global Scope: A variable has a global scope when it is accessible throughout the program. A global variable is declared on top of the program before all the function definitions.

Example:

#include <iostream.h>

Int globalResult=0; //global variable

int main()

{

Int localVar = 10; //local variable.

}

 

Ques. 13): What is the precedence when there are a Global variable and a Local variable in the program with the same name?

Answer: Whenever there is a local variable with the same name as that of a global variable, the compiler gives precedence to the local variable.

Example:

#include <iostream.h>

int globalVar = 2;

int main()

{

int globalVar = 5;

cout<<globalVar<<endl;

}

The output of the above code is 5. This is because, although both the variables have the same name, the compiler has given preference to the local scope.

 

Ques. 14): What is a Constant? Explain with an example.

Answer: A constant is an expression that has a fixed value. They can be divided into integer, decimal, floating-point, character or string constants depending on their data type.

Apart from the decimal, C++ also supports two more constants i.e. octal (to the base 8) and hexadecimal (to the base 16) constants.

Examples of Constants:

      75 //integer (decimal)

      0113 //octal

      0x4b //hexadecimal

      3.142 //floating point

      ‘c’ //character constant

      “Hello, World” //string constant

 

Ques. 15): What is the difference between equal to (==) and Assignment Operator (=)?

Answer: In C++, equal to (==) and assignment operator (=) are two completely different operators.

Equal to (==) is an equality relational operator that evaluates two expressions to see if they are equal and returns true if they are equal and false if they are not.

The assignment operator (=) is used to assign a value to a variable. Hence, we can have a complex assignment operation inside the equality relational operator for evaluation.

 

Ques. 16): what is the difference between Pre and Post Increment/Decrement Operations in C++?

Answer: C++ allows two operators i.e ++ (increment) and –(decrement), that allow you to add 1 to the existing value of a variable and subtract 1 from the variable respectively. These operators are in turn, called increment (++) and decrement (–).

Example:

a=5;

a++;

The second statement, a++, will cause 1 to be added to the value of a. Thus a++ is equivalent to

a = a+1; or

a += 1;

A unique feature of these operators is that we can prefix or suffix these operators with the variable. Hence, if a is a variable and we prefix the increment operator it will be

++a;

This is called Pre-increment. Similarly, we have pre-decrement as well.

If we prefix the variable a with an increment operator, we will have,

a++;

This is the post-increment. Likewise, we have post-decrement too.

The difference between the meaning of pre and post depends upon how the expression is evaluated and the result is stored.

In the case of the pre-increment/decrement operator, the increment/decrement operation is carried out first and then the result passed to an lvalue. Whereas for post-increment/decrement operations, the lvalue is evaluated first and then increment/decrement is performed accordingly.

Example:

a = 5; b=6;

++a;       #a=6

b–;         #b=6

–a;         #a=5

b++;      #6

 

Ques. 17): What is Data Abstraction in C++?

Answer: Data Abstraction is a technique of providing only essential information of any application to the user and hiding its implementation, thus making the data more secure.

Example: Consider WhatsApp, we as users can only have a look at the elements useful for us and operate using the same but we never know what happens in the background.

 

Ques. 18): What is a destructor, and can there be more than one destructor in a class?

Answer: Destructors are used to de-allocate the memory that has been allocated for an object by the constructor. It has the same name as of the class name with a tilde symbol in front of the class name.

Syntax: class_name() { }

Also, there should be only one destructor in a class even if there are more than one constructors in a single class with no parameters and no return type.

 

Ques. 19): What is Pure Virtual Function?

Answer: A pure virtual function is a virtual function which does not contain any definition. The normal virtual function is preceded with a keyword virtual. Whereas the pure virtual function is preceded with the keyword virtual and ended with the value 0.

Example: virtual void add() = 0;

 

Ques. 20): Are exceptions and errors the same?

Answer: No. Errors occur because of any mistakes in the syntax of the program. i.e. errors occur during compile time. Whereas exceptions during run time of the program.

Example: If you forget to give semicolon at the end of an assignment statement, then it is an error. If you give 6 input values to an array which is declared only to store 5 elements, then that is an exception.