Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

HackWithInfy Power Programmer Technical Interview Questions and Answers

HackWithInfy Power Programmer Technical Interview 2020

 Here below you will get HackWithInfy Technical questions and answers that are asked in power programmer role.

These are the most asked questions of HackWithInfy paper. This will help you in preparation of HackWithInfy pre-placement opportunity of power programmer role. This is the best opportunity you have got of placement so please prepare well for the HackWithInfy Interview.

HackWithInfy Power Programmer role

HackWithInfy Most Asked Interview Questions and Answers

Q1.Write the recursive C function to count the number of nodes present in a binary tree.

int count (struct node* t)  

{  

    if(t)  

    {  

        int l, r;  

        l = count(t->left);  

        r=count(t->right);  

        return (1+l+r);  

    }  

    else   

    {  

        return 0;  

    }  

}  

Q2. What is a unique key?

Solution:- A Unique key constraint uniquely identified each record in the database. This provides uniqueness for the column or set of columns.

A Primary key constraint has automatic unique constraint defined on it. But not, in the case of Unique Key.

There can be many unique constraint defined per table, but only one Primary key constraint defined per table.

Q3.Write a recursive C function to calculate the height of a binary tree.

int countHeight(struct node* t)  

{  

    int l,r;  

    if(!t)  

        return 0;  

    if((!(t->left)) && (!(t->right)))  

        return 0;  

    l=countHeight(t->left);  

    r=countHeight(t->right);  

    return (1+((l>r)?l:r));  

}         

Q4.What is the difference between NULL value, zero and blank space?

Solution:-

A NULL value is not the same as zero or a blank space. A NULL value is a value which is ‘unavailable, unassigned, unknown or not applicable.’ On the other hand, zero is a number, and a blank space is treated as a character.

The NULL value can be treated as unknown and missing value as well, but zero and blank spaces are different from the NULL value.

Q5.What is SAVEPOINT in a transaction control?

Solution:- A SAVEPOINT is a point in a transaction when you can roll the transaction back to a certain point without rolling back the entire transaction.

SQL> INSERT INTO TEST VALUES (1,’Savepoint A’);
1 row inserted.
SQL> SAVEPOINT B
SQL> INSERT INTO TEST VALUES (2,’Savepoint B’);
1 row inserted.
SQL> ROLLBACK TO B;
Rollback complete.
SQL> SELECT * FROM TEST;
ID MSG
——– ———–

Q6.How can AVL Tree be useful in all the operations as compared to Binary search tree?

Solution:- AVL tree controls the height of the binary search tree by not letting it be skewed. The time taken for all operations in a binary search tree of height h is O(h). However, it can be extended to O(n) if the BST becomes skewed (i.e. worst case). By limiting this height to log n, AVL tree imposes an upper bound on each operation to be O(log n) where n is the number of nodes.

Q7. How does dynamic memory allocation help in managing data?

Solution:- Apart from being able to store simple structured data types, dynamic memory allocation can combine separately allocated structured blocks to form composite structures that expand and contract as needed.

Q8.What is the difference between a PUSH and a POP?

Solution:- Pushing and popping applies to the way data is stored and retrieved in a stack. A push denotes data being added to it, meaning data is being “pushed” into the stack. On the other hand, a pop denotes data retrieval, and in particular, refers to the topmost data being accessed.

Q9.What are the syntax and use of the COALESCE function?

Solution:- Pushing and popping applies to the way data is stored and retrieved in a stack. A push denotes data being added to it, meaning data is being “pushed” into the stack. On the other hand, a pop denotes data retrieval, and in particular, refers to the topmost data being accessed.

Q10.What are the syntax and use of the COALESCE function?

Solution:- The syntax of COALESCE function:


COALESCE(exp1, exp2, …. expn)

Q11. How do signed and unsigned numbers affect memory?

Solution:- In the case of signed numbers, the first bit is used to indicate whether positive or negative, which leaves you with one bit short. With unsigned numbers, you have all bits available for that number. The effect is best seen in the number range (an unsigned 8-bit number has a range 0-255, while the 8-bit signed number has a range -128 to +127.

Q12.State the properties of B Tree.

Solution:- 

A B tree of order m contains all the properties of an M way tree. In addition, it contains the following properties.

  • Every node in a B-Tree contains at most m children.
  • Every node in a B-Tree except the root node and the leaf node contain at least m/2 children.
  • The root nodes must have at least 2 nodes.
  • All leaf nodes must be at the same level.

Q13. What is the minimum number of queues needed when implementing a priority queue?

Solution:- The minimum number of queues needed in this case is two. One queue is intended for sorting priorities while the other queue is used for actual storage of data.

Q14. Which sorting algorithm is considered the fastest?

Solution:-  There are many types of sorting algorithms: quick sort, bubble sort, balloon sort, radix sort, merge sort, etc. Not one can be considered the fastest because each algorithm is designed for a particular data structure and data set. It would depend on the data set that you would want to sort.

Q15. How do you search for a target key in a linked list?

Solution:- To find the target key in a linked list, you have to apply sequential search. Each node is traversed and compared with the target key, and if it is different, then it follows the link to the next node. This traversal continues until either the target key is found or if the last node is reached.

Q16.Define the graph data structure?

Solution:- A graph G can be defined as an ordered set G(V, E) where V(G) represents the set of vertices and E(G) represents the set of edges which are used to connect these vertices. A graph can be seen as a cyclic tree, where the vertices (Nodes) maintain any complex relationship among them instead of having parent-child relations.

Q17.What is the syntax of object oriented method call?

Solution:-The object oriented syntax tells about the object oriented features and methodologies that are present and shown as:

target.method(arguments);

This is the line that can be used to call the functions, but not invoking the methods on an object.

A function is made up of both the operands and operators and they are very essential to call a method. So, the method will be written as:

a = sub(c,b);

  • Object oriented syntax allows easy to write ways and some specified rules that has to be remembered while programming.
  • The operator has to always come in the middle of the statement.
  • A class is made for every module and it also represents the template used for a class made up of objects.

Q18.What is inheritance? What are the types of inheritance?

Solution:-

  • Inheritance is technique of deriving a new classes from existing one.
  • The derived class inherits all the features of base class from which it is declared.

Types of Inheritance:

1) Single Inheritance
2) Multiple Inheritance
3) Hierarchical Inheritance
4) Multilevel Inheritance
5) Hybrid Inheritance

Q19.What is context switching?

 Solution:- Context is associated with each process encompassing all the information describing the current execution state of the process
– When the OS saves the context of program that is currently running and restores the context of the next ready to run process, it is called as context switching.
– It is important for multitasking OS.

Q20.Tell us something about Mutex.

Solution:- Mutex – ‘Mutual Exclusion Lock’ is a lock which protects access to shared data resource.
– Threads can create and initialize a mutex to be used later.
– Before entering a critical region the mutex is locked. It is unlocked after exiting the critical region. If any thread tries to lock the mutex during this time, it can’t do so.