Java Script Interview Question and Answer

1. Explain JavaScript?
JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object Oriented Programming language.

2. What is ‘this’ keyword in JavaScript?
‘This’ keyword refers to the object from where it was called. In JavaScript, the thing called this, is the object that “owns” the JavaScript code. The value of this, when used in a function, is the object that “owns” the function. The value of this, when used in an object, is the object itself. The this keyword in an object constructor does not have a value.

3. Explain === operator?
=== is called as strict equality operator which returns true when the two operands are having the same value without any type conversion.

4. What are disadvantage of using innerHTML in JavaScript?
Content will be  replaced everywhere
Cannot use like “appending to innerHTML”
When you use +=like “innerHTML = innerHTML + ‘html’” still the old content is replaced by html
The entire innerHTML content is re-parsed and build into elements, therefore its much slower
The innerHTML does not provide validation and therefore we can potentially insert valid and broken HTML in the document and break it

5. What is JavaScript Cookies?
Cookies are the small test files stored in a computer and it gets created when the user visits the websites to store information that they need. Example could be User Name details and shopping cart information from the previous visits. The data contained in a cookie is automatically transmitted between the web browser and the web server, so CGI scripts on the server can read and write cookie values that are stored on the client. JavaScript can also manipulate cookies using the cookie property of the Document object

6. Explain pop() method in JavaScript?
pop() method is similar as the shift() method but the difference is that the Shift method works at the start of the array.
pop() method take the last element off of the given array and returns it. The array on which is called is then altered.
The pop method removes the last element from an array and returns that value to the caller. pop is intentionally generic; this method can be called or applied to objects resembling arrays.

7. built-in method that sorts the elements of an array?
sort() method sorts the elements of an array. The sort method sorts the Array object in place; no new Array object is created during execution.

8. What is callback?
A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered.

Node.js Interview Questions and answers

1. Explain error-first callback?
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.

2. Explain how can you avoid callback hells?
Answer : modularization: break callbacks into independent functions
use a control flow library, like async
use generators with Promises
use async/await

3. Explain Promises?
Answer : Promises are a concurrency primitive, first described in the 80s. Now they are part of most modern programming languages to make your life easier. Promises can help you better handle async operations.

4. How can you listen on port 80 with Node?
Answer :Run the application on any port above 1024, and then put a reverse proxy like nginx in front of it.

5. What are the tools can be used to assure consistent style?
Answer :
JSLint
JSHint
ESLint
JSCS

6. Explain the difference between operational and programmer errors?
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.

7. What is a stub?
Answer : Stubs are functions/programs that simulate the behaviours of components/modules. Stubs provide canned answers to function calls made during test cases. Also, you can assert on with what these stubs were called.

8. What is a test pyramid?
Answer : A test pyramid describes that when writings test cases there should be a lot more low-level unit tests than high level end-to-end tests.

9. What is node.js?
Answer : Node.js is a Server side scripting which is used to build scalable programs. Its multiple advantages over other server side languages, the prominent being non-blocking I/O.

10. What tools can be used to assure consistent style?
Answer :
ESLint
Standard

Talend Interview Questions

1. Difference between tAggregaterow and tAggregatesortedrow.
Answer : tAggregateRow, receives a flow and aggregates it based on one or more columns. For each output line, are provided the aggregation key and the relevant result of set operations (min, max, sum).
tAggregateSortedRow receives a sorted flow and aggregates it based on one or more columns. For each output line, are provided the aggregation key and the relevant result of set operations (min, max, sum).
tAggregateSortedRow works on Sorted rows only. But tAggregateRow performs same operation without sorting rows.
tAggregateRow does not sort the result, but tAggregateSortedRow works on sorted flow that is why it produces result in sorted order.
tAggregateRow is not dependent on input row count, means we can use tAggregateRow component without knowing input row count whereas tAggregateSortedRow requires input row count in prior.

2. What is Talend data generator routine?
Answer : Talend data generator routine is a function which allow us to create group of set data. They are based on the entry of first name, address,town, etc.

3. What are the steps to replace an element in a string?
Answer : Replace one element with another in a string by using Change routine along with tJava components.

4. In talend what is the fixed pattern of date?
Answer : Default the date pattern is dd-MM-yyyy.

5. Differentiate between ETL and ELT.
Answer : ETL stands for Extract, Transform and Load which is a process that involves gaining data from exterior source, converting it to get fit into operational requirement, then load it into the end target database.
ELT stands for Extract, Load and Transform which is the process in which data is get, then loaded into the staging table in the database and then data is converted according to the need.Read this incisive blog to clearly understand the process ofETL now.

6. Talend Characteristics
Answer :
Distinguishing feature => First Data integration software as a service.
Deployment =>Business modeling, graphical development.
ETL functionality => Makes ETL mapping faster and simpler for diverse data sources.

7. What is Default join for tMap.
Answer : Joining data using tMap
tMap is more powerful in terms of FUNCTIONALITY.
1. tMap can have many outputs links.
2. With tMap we can use the expression on the columns while providing the joining condition.
3. In tMap we have option to store the intermediate data in the disc.
4. In tMap, we can enable the option to reload the look-up for every record.
5. tMap supports more types of join model, includes unique join, first join and all join.
6. tMap allows you to link multiple look-up flows into it, and supports to load multiple look-up flows parallel.
7. tMap supports ‘die on error’ option.

8. For sorting data which component we generally use?
Answer : We can use tExternalSortRow and tSortRow.

9. What is MDM in talend ?
Answer : It is a management by which an organization makes and manage a single, consistent and correct view of key enterprise data.

10. Write the advantages of talend ?
Answer :
Highly versatile.
Cost effective.
User friendly.
Readily adaptable.

C++ Interview Question and Answers – Part 3

1. What is the difference between the keywords struct and class in C++?
Answer : By default the members of struct are public and by default the members of the class are private.

2. Explain Call by address and Call by reference
Answer : Call by address: We send address of the actual parameters instead of values. We choose this if we do want the actual parameters to be modified with formal parameters.
Call by reference: The actual parameters are received with the C++ new reference variables as formal parameters. We choose this if we do want the actual parameters to be modified with formal parameters.

3. How can we refer to the global variable if the local and the global variable names are same?
Answer : We can apply scope resolution operator (::) to the for the scope of global variable.

4. What are valid operations on pointers?
Answer : The only two permitted operations on pointers are
Comparision and Addition/Substraction

5. Which function is used to move the stream pointer for the purpose of writing data from stream?
Answer : seekp()

6. Can we create and empty class? If so what would be the size of such object.
Answer : We can create an empty class and the object size will be 1.

7. Define polymorphism?
Answer : Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program.It allows us to have overloading of operators so that an operation can exhibit different behaviours in different instances

8. What is iterator class?
Answer : Iterator class provides an access to the class which are inside the containers(it holds a group of objects in an organized way).
The containers include the data structure, class and abstract data type.

9. What are the types of declarations in C++?
Answer : There are so many types of declaration in C++ are :
Variable declaration
Constant declaration
Function declaration
Object declaration

10. What is scope resolution operator?
Answer : The Scope resolution operator(::) can be used to define the member functions of a program outside the boundary of a class and not within the class specifier.

C++ Interview Question and Answers – Part 2

51. What is dynamic memory allocation?
Answer : A dynamic memory allocation uses functions such as malloc() or calloc() to get memory dynamically. If these functions are used to get memory dynamically and the values returned by these function are assigned to pointer variables, such a way of allocating memory at run time is known as dynamic memory allocation.

52. What is a function?
Answer : A large program is subdivided into a number of smaller programs or subprograms. Each subprogram specifies one or more actions to be performed for the larger program. Such sub programs are called functions.

53. What is an argument?
Answer : An argument is an entity used to pass data from the calling to a called function.
54. what is the similarity between a Structure, Union and enumeration?
Answer : All of them let the programmer to define new data type.

55. Difference between array and pointer?
Answer : Array
a – Array allocates space automatically
b – It cannot be resized
c – It cannot be reassigned
d – sizeof (arrayname) gives the number of bytes occupied by the array.
Pointer
a – Explicitly assigned to point to an allocated space.
b – It can be sized using realloc()
c – pointer can be reassigned.
d – sizeof (p) returns the number of bytes used to store the pointer variable p.

C++ Interview Question and Answers – Part 1

1. Explain the difference between reference and pointer?
Answer : a)References are less powerful than pointers. Once a reference is created, it can’t refer to other object later. Pointers provide the powerful facilities than references.
b) References are safer and easier to use than pointers. Pointers are comparatively difficult to use.

2. What are command line arguments?
Answer : The arguments which we pass to the main() function while executing the program are called as command line arguments. The parameters are always strings held in the second argument (below in args) of the function which is array of character pointers. First argument represents the count of arguments (below in count) and updated automatically by operating system.
main( int count, char *args[])
{
}

3. Explain the pointer – this.
Answer : This, is the pointer variable of the compiler which always holds the current active object’s address.

4. STL stands for ?
Answer : Standard template library

5. What are static members and static functions?
Answer : Static members are created and initialized only once and shared among all the class objects.
Static functions are similar to the static variables and are associated with the class and can only access static variables of a class and can also be called using the scope resolution operator.

6. Can a function overloading depend only on passing by value and passing by reference?
Answer : No, the reason is that whether a function is called the passing a parameter as a value or by reference, it appears similar to the caller of the function.

7. How can a struct in C++ differs from a struct in C?
Answer : The differences between struct in C++ and C are listed in the following points:
In C and C++, the variables of the structures are public; however, in C, the variable cannot be declared as private or protected. On the contrary, in C++, the variables can be declared as private or protected.
In C, the concept of inheritance is not supported. In C++, the concept of inheritance is fully supported.
On declaring a struct in C, the addition of the struct keyword is must. On the contrary, there is no need of the struct keyword on declaring struct in C++.
In C, the initialization cannot be done outside the scope of a structure. However, in C++, the initialization can be done outside the scope of a structure.
In C, structures do not have direct functions or methods.

8. What are the types of STL containers?
Answer : deque
hash map
hashmultimap
hash_multiset
hashset
list
map
multimap
multiset
set
vector

9. What is a modifier?
Answer : A modifier, also called a modifying function is a member function that changes the value of at least one data member.
In other words, an operation that modifies the state of an object.
Modifiers are also known as mutators.

10. What is the difference between array and a list?
Answer : Array is a collection of homogeneous elements while list is a collection of heterogeneous elements.
Array memory allocation is static and continuous while List memory allocation is dynamic and random.
In Array, users don’t need to keep in track of next memory allocation while In list user has to keep in track of next location where memory is allocated.

C Programming theory Questions and answers – Part 5

201. What is the difference between exit() and return() in c?
Answer : Exit() is a system call which terminates current process. Exit() is not an instruction of c language. Whereas, return() is a c language instruction/statement and it returns from the current function (I.E. Provides exit status to calling function and provides control back to the calling function).

202. What is the difference between memcpy() & strcpy() functions in c?
Answer : Memcpy() function is used to copy a specified number of bytes from one memory to another. Whereas, strcpy() function is used to copy the contents of one string into another string.
Memcpy() function acts on memory rather than value. Whereas, strcpy() function acts on value rather than memory.

203. What is the difference between memcpy() & memmove() functions in c?
Answer : Memcpy() function is is used to copy a specified number of bytes from one memory to another.
Memmove() function is used to copy a specified number of bytes from one memory to another or to overlap on same memory.
Difference between memmove() and memcpy() is, overlap can happen on memmove(). Whereas, memory overlap won’t happen in memcpy() and it should be done in non-destructive way.

204. Is there any inbuilt library function in C to remove leading and trailing spaces from a string? How will you remove them in C?
Answer : There is no inbuilt function to remove leading and trailing spaces from a string in c. We need to write our own function to remove them. We need to check first non-space character in given string. Then, we can copy that string from where non space character is found. Then, we can check whether any spaces are available in copied string from the end of the string. If space is found, we can copy ‘\0’ in that space until any character is found. Because, ‘\0’ indicates the end of the string. Now, we have removed leading and trailing spaces in a given string.

205. Can array subscripts have negative value in C ?
Answer : No. Array subscripts should not have negative value. Always, it should be positive.