logo

Interview Questions

Attempt questions on logging in an application, use of global variables, exception handling, removing duplicates from a list, checking if strings are permutations, and designing a promotion giveaway for a retail client.

7 Pages1175 Words91 Views
   

Added on  2023-03-17

About This Document

This document provides a list of common interview questions and their answers. It covers topics such as logging in software development, exception handling, and problem-solving techniques. The document also includes code examples in C++ for solving specific problems. Suitable for students and professionals preparing for job interviews.

Interview Questions

Attempt questions on logging in an application, use of global variables, exception handling, removing duplicates from a list, checking if strings are permutations, and designing a promotion giveaway for a retail client.

   Added on 2023-03-17

ShareRelated Documents
Running head: INTERVIEW QUESTIONS
INTERVIEW QUESTIONS
Name of the Student
Name of the University
Author Note
Interview Questions_1
INTERVIEW QUESTIONS 1
Basics:
1) Logging is one of the most essential part of development of the software. This
provides the support teams and the developers with the glasses that helps the
developers to look at what is being really done by the code of the applications
actually. The logs have been categorised according to 5 various levels that are,
verbose/debug, info, error, warning, critical.
2) The approach of the global variable is clear and it is easy to debug. As example it can
be said that an application of database can work great with the global variables but
when the developer want to make connection between 2 database, problem can be
occur.
3) Do’s in exception handling:
i. Use finally or try blocks around the code which may generate potentially an
exception.
ii. Postfix the class names of the exceptions with “Exception”.
iii. At the time of creation of new exception must use at least 3 constructors that
are common.
Don’ts in exception handling:
i. When ‘if’ statement will be able to check errors, do not through exception.
ii. Do not swallow exception via putting a catch block that is empty.
iii. Do not use throw ex.
Level 100:
1)
a) By using hashing, the problem can be solved. By traversing linklist from the head
to the end. For each of the encountered element that are new, after checking if that
Interview Questions_2
2INTERVIEW QUESTIONS
is within the hash table or not. If it is yes then we remove that otherwise it will be
put in the hash table.
C++ code:
#include(iostream.h)
using namespace std;
struct Node //node of a linked list
{
int data; //data as integer
struct Node *next;
};
struct Node *newNode(int data) //function for creating new code
{
Node *temp = new Node; //function
temp->data = data;
temp->next = NULL;
return temp;
}
void removeDuplicates(struct Node *start) //code to remove duplicates
{
unordered_set<int> seen; //for storing seen values
struct Node *curr = start; //picking the elements one after another
struct Node *prev = NULL; //previous value as null
while (curr != NULL) //condition
{
if (seen.find(curr->data) != seen.end()) //if the value has seen before
{
prev->next = curr->next;
Interview Questions_3

End of preview

Want to access all the pages? Upload your documents or become a member.