Wednesday, January 29, 2020

HackWithInfy

About the challenge
Infosys is inviting developers from India's select institutions to compete with the best minds in programming and showcase their coding skills in a real-time challenge for our first pan India hackathon, #HackWithInfy, beginning on July 9 at 11:30 AM IST and concluding on August 20, 06:30 PM IST with a grand finale at the sprawling Infosys Pune campus.
Programmers are full-stack developers:
  • driven by passion and an appetite for coding
  • keen to achieve breakthrough innovation when solving tough challenges
  • passionate about embracing open source technologies along with next-gen tech
  • keen on finding the "why" rather than just the "how" of coding technologies.
Change — inspired by changing technology — is not new. But today disruption is bringing a newness that’s mixed with uncertainty. It’s complicated, fast-paced and hyper-connected. This is making it difficult to imagine how today’s actions will shape tomorrow’s future – difficult to focus on what’s actually important rather than what is urgent. It’s hard to find the time, it’s hard to know where to begin, and it’s hard to do it alone. We invite you to join us in helping our clients find a way. Help them navigate their next. And, with them, navigate your next.
#HackWithInfy is an extraordinary initiative for students to inculcate the culture of rapid problem-solving and innovative thinking from early on. It not only provides the perfect stepping stone for students to explore their passion for programming, but also an opportunity to compete and earn a chance to work with Infosys.
If you are inspired to solve tough challenges with the help of technology, we invite you to participate in #HackWithInfy and show the world your mettle.
Come, compete with fellow programmers who share the passion for programming, technology, and innovation and create an unforgettable experience.
Eligibility
The competition is open for select colleges/universities/institutes in India. Please check with the placement office of your college/university/institute. If your college/university/institute has received #HackWithInfy invitation from Infosys, then you can register by giving them the details required for nomination.
Prizes
  • Winner: ₹200,000 
  • 1st Runner-Up: ₹100,000  
  • 2nd Runner-Up: ₹50,000 
  • Top 100 finalists from Round 2 will get an opportunity to compete in the grand finale, at Infosys Pune, to win a pre-placement interview(PPI) for the Power Programmer role. 
  • The next top 500 finalists will get a pre-placement interview(PPI) opportunity for the System Engineer and Data Analytics roles.
Also, Infosys will sponsor your travel tickets, accommodation, and food to make it convenient for you to compete in the grand finale at Infosys Pune campus.

Sunday, January 26, 2020

eLitmus

eLitmus Evaluation Private Limited is an Indian recruitment organization founded by ex-Infosys employees. It helps companies in hiring freshers for their entry-level jobs through its effective and unique test called eLitmus pH test.
This test is used by most of the companies including some fortune 500 companies like Dell, General Electric, etc. to recruit graduates.
Elitmus is a little tricky exam to crack compared to other employability tests. Elitmus is a content challenged test (less number of questions; high quality in depth of question) rather than a time-challenged test (more number of questions; less quality in depth of questions).
eLitmus calls this method of testing as ‘pH Test’.

 

eLitmus Exam Pattern 2019

The sections included in eLitmus exam pattern are:
  • Quantitative Ability (20 questions)
  • Logical Reasoning and Problem Solving (20 questions)
  • Verbal Ability (20 questions)
SectionsNo. of questionsTotal scoreNegative marking
Total60600Unique Negative Marking Scheme
Quantitative Ability20200Yes
Logical Reasoning20200Yes
Verbal Ability20200Yes
The syllabus for eLitmus exam pattern is given below. Please keep the below points in mind, before you attend the eLitmus exam.
  • eLitmus is a pen and paper based exam for a duration of 2 hours
  • Unlike other exams, there is no sectional timings as the exam is a pen & paper based test
  • The eLitmus exam is non-adaptive in nature.
  • There is negative marking in eLitmus exam.
  • elitmus exam score is valid for 2 years
  • Candidate should wisely allocate time among the three sections based on his/her proficiency in order to ace the exam.

eLitmus Syllabus 2020

Below is the updated eLitmus syllabus 2019 for Computer Science (CSE) and IT department students preparing for the eLitmus pH test. You need to practice each topic given in eLitmus syllabus, to score a good percentile in the test.

a) Quantitative Ability Syllabus for eLitmus

Below is the eLitmus syllabus for the quantitative ability sections. You need to answer 8 – 10 questions from this section to score good percentile.
  • Geometry
  • Speed, Time and Distance
  • Mensuration
  • Time and Work
  • Number System
  • Probability
  • Permutation and Combinations
  • Few Miscellaneous Questions on topics like Progressions, Algebra etc.

b) Logical Reasoning & Problem-Solving Syllabus for eLitmus

Below is the eLitmus syllabus for quantitative ability sections. You need to answer 10 – 12 questions from this section to score good percentile.
  • Cryptarithmetic (3 questions)
  • Logical Reasoning (8 questions)
  • Data Interpretation (5 questions)
  • Data Sufficiency (4 questions)

c) Verbal Ability Syllabus for eLitmus

Below is the eLitmus syllabus for the verbal ability section. You need to answer 12-15 questions from this section to score good percentile.
  • Reading Comprehension (3 comprehensions – 16 questions)
  • Para Jumbles (2 questions)
  • Sentence completion based on vocabular (2 questions)
  • Sentence completion based on subject-verb agreement (4 questions)
  • Miscellaneous questions related to grammar 


Wednesday, January 22, 2020

AMCAT Exam

What is Amcat Exam?

AMCAT exam is an employability test for people who are in search of job oppportunities. This test showcases your employability quotient to companies hiring through AMCAT. If you obtain a decent score in AMCAT exam, then you will be eligible to apply for companies via AMCAT.
Other similar employability tests are eLitmus & Cocubes.


Amcat Exam Benefits

  • Amcat exam is used by 700+ companies to hire freshers and experienced candidates.
  • Job recommendations from top companies based on your AMCAT exam score.
  • Amcat provides feedback on assessment of strengths, weaknesses. This will help you improve your performance.
  • AMCAT ensures equal job opportunities, there is no percentage criteria or college criteria, only criteria is your test score.
  • Job profiles are available across industry sectors – IT, ITeS, Pharma, Retail, Manufacturing, Finance etc.

Amcat Exam Registration Process

Step 1: As a job seeker, give the AMCAT exam across 50+ centers in India.
Step 2: Get the AMCAT Score Certificate.
Step 3: Your AMCAT Score Certificate is shared with top companies.
Step 4: You can also apply to companies by yourself from the AMCAT portal.
Step 5: Get interview calls and get placed in your dream job

AMCAT has 3 compulsory modules and maximum two Optional modules.
Compulsory Modules:
  • English Comprehension – 900 Marks
  • Quantitative ability – 900 Marks
  • Logical Ability – 900 Marks

The Disadvantage of taking Amcat Exam?

Amcat has degraded the quality of jobs with time and totally concerned about selling their digital products to earn money. When you book a slot for Amcat, their sales team keep on calling you(irritate you at extreme level) again and again till you won’t buy their worthless digital products. So, better go for other alternative exams like Elitmus, Cocubes etc.

Saturday, January 18, 2020

Problem Statement

You are given an integer, your task is to print an alphabet rangoli of size n.

 
Different sizes of alphabet rangoli are shown below:

#size 3

----c----
--c-b-c--
c-b-a-b-c
--c-b-c--
----c----

#size 5

--------e--------
------e-d-e------
----e-d-c-d-e----
--e-d-c-b-c-d-e--
e-d-c-b-a-b-c-d-e
--e-d-c-b-c-d-e--
----e-d-c-d-e----
------e-d-e------
--------e--------

#size 10

------------------j------------------
----------------j-i-j----------------
--------------j-i-h-i-j--------------
------------j-i-h-g-h-i-j------------
----------j-i-h-g-f-g-h-i-j----------
--------j-i-h-g-f-e-f-g-h-i-j--------
------j-i-h-g-f-e-d-e-f-g-h-i-j------
----j-i-h-g-f-e-d-c-d-e-f-g-h-i-j----
--j-i-h-g-f-e-d-c-b-c-d-e-f-g-h-i-j--
j-i-h-g-f-e-d-c-b-a-b-c-d-e-f-g-h-i-j
--j-i-h-g-f-e-d-c-b-c-d-e-f-g-h-i-j--
----j-i-h-g-f-e-d-c-d-e-f-g-h-i-j----
------j-i-h-g-f-e-d-e-f-g-h-i-j------
--------j-i-h-g-f-e-f-g-h-i-j--------
----------j-i-h-g-f-g-h-i-j----------
------------j-i-h-g-h-i-j------------
--------------j-i-h-i-j--------------
----------------j-i-j----------------
------------------j------------------
 
The center of the rangoli has the first alphabet letter a, and the boundary has the alphabet letter (in alphabetical order).
Input Format
Only one line of input containing the size of the rangoli. 
Output Format
Print the alphabet rangoli in the format explained above.
Sample Input
5
Sample Output
--------e--------
------e-d-e------
----e-d-c-d-e----
--e-d-c-b-c-d-e--
e-d-c-b-a-b-c-d-e
--e-d-c-b-c-d-e--
----e-d-c-d-e----
------e-d-e------
--------e--------
 
Solution: 
import string
def print_rangoli(size):
width = 4 * size - 3
alpha = string.ascii_lowercase
for i in list(range(size))[::-1] + list(range(1, size)):
print('-'.join(alpha[size-1:i:-1] + alpha[i:size]).center(width, '-'))

if __name__ == '__main__':
n = int(input())
print_rangoli(n)
 

Sunday, January 12, 2020

Infosys Certification Exam | InfyTQ


Hi, I am Aman Kamboj. I attended the Infosys Certification exam.

About the Exam

This is a certification exam organised by Infosys only for the students from B.E., B.Tech, M.E., M.Tech, M.Sc., MCM or MCA and graduate/post-graduate who will be passing in 2020. The candidate has to register at the InfyTq app or portal to appear in the exam. The exam consists of two round, first – an online round at the centre and second – HR interview round, both take place on the same day at the same place.
The candidate has to score a minimum of 65% in the online round to be eligible for the certificate. The candidate who scores 65% or more are eligible for on the spot interview for the role of System Engineer .
 

My Experience  

Round 1: Online Round

It was an online round consisting of 20 MCQs and two hands-on programming questions. MCQs were from the OOPs concept in Python, Data Structure and Algorithm in Python (basics like Stack and Queue, Binary Search), Database and SQL. And one question was from MongoDB in MCQ Part. The answers were of multiple correct types.

Two hands-on programming questions were easy but the coding was to be done completely in Python 3.
Question 1:
Given a string, find the substring based on following conditions,
  1. The substring must be the longest one of all the possible substring in the given string.
  2. There must not be any repeating characters in the substring.
  3. If there is more than one substring satisfying the above two conditions, then print the substring which occurs first.
  4. Length of the substring must be minimum 3.
If there is no substring satisfying all the aforementioned conditions then print -1.

Question 2:
Given an array of integers, find the combination of integers forming a sequence which satisfies the below conditions:
    1. The ith  integer must satisfy the given equation in the sequence
      (1)    \begin{equation*} X[i] = X[i-1] + X[i-2] \end{equation*}
    2. The length of the sequence must be maximum possible
    3. If there is more than one sequence satisfying above two conditions then print that sequence which contains least integers.
      In case there is no combination of integers possible then print -1.
      See the example below:
Example 1:
If the given integers are 4, 2, 7, 5, 3, 8, 10, 11, 19 then the possible combinations of integers satisfying above conditions are 2, 3, 5, 8 and 3, 8, 11, 19 and hence the output must be 2, 3, 5, 8. Here you cannot form any other combination of integers whose length is greater than 4 and satisfies the given equation.
Example 2:
If the given integers are 1,5,6,10 then print -1.

Round 2: HR Interview Round

I was not asked any question which is generally asked in HR Interview like, Tell me about yourself? or Why do you want to join Infosys? or What is your career aspiration? or Where do you see yourself after five years? or even anything related to my hobbies. Below are all the questions which I was asked by the interviewer:
  1. Tell me about your projects: I had mentioned some projects in the resume so he asked me about what have you done in the projects, not in detail only the overview.
  2. Tell me about your content writing: I had mentioned about my Technical Content Writing at amankamboj.blogspot.com in my resume, I gave him an overview of that.
  3. On what topics have you been writing?: I mentioned topics like Data Science and Machine Learning, Python etc.
  4. Give a real-life scenario where we can use absolute frequency and relative frequency: I gave a real-life scenario.
  5. Will you work if I changed your field of work? Like if we give you the work in cybersecurity or computer networking or anything else.
  6. Next question was What is your job location preference?: I said to him I don’t have any preference, I am ready to work from anywhere.
  7. Do you have any question?: I asked him when will I know the result of this interview whether I am selected or not? Then he explained, there will be more rounds conducted for a higher salaried profile like Senior System Engineer and Power Programmer profile. If you clear those rounds then you will be offered higher compensation for that profile.

Monday, January 6, 2020

Smart India Hackathon 2020

Smart India Hackathon (SIH) 2020 is a national initiative launched by AICTE and MHRD aimed at providing students with a platform to solve some of the pressing problems we face in our daily lives, and to inculcate a culture of product innovation and problem-solving mentality.

During the last edition of the hackathon, 2 Lakh+ students with 55,000+ ideas from 2000+ institutions against 500+ problem statements provided by 120+ organizations from across India involved in it. In SIH 2020, students will also have the opportunity to work on the challenges facing private sector organizations and create world-class solutions for some of the world's largest companies, helping the private sector hire the best brains from the country.

Problem statement Organization type:

  • State Ministry
  • Central Ministry
  • Industry Personal

Problem Statement Themes:

  • Smart Communication
  • Healthcare & Biomedical devices
  • Agriculture & Rural Development
  • Smart Vehicles
  • Food Technology.
  • Robotics and Drones
  • Waste management
  • Clean water
  • Renewable Energy
  • Security & Surveillance
  • Miscellaneous

What is SIH 2020?

  • World’s Biggest Hackathon and Open Innovation model, an initiative by Ministry of HRD of India
  • 4th edition of highly successful Smart India Hackathon initiative
  • Involves 2 Lakh+ students with 57,000+ ideas from 2200+ institutions against 530+ problem statements provided by 120+ organizations from across India
  • Students across India compete creatively to solve problems of Ministries, Departments and Industries to give solutions
  • Harness expertise of students from AICTE/UGC approved institutions, IITs, NITs and IISc.

 

Who can Participate:

All students Pursuing degree or in AICTE Recognized institutes in India


SIH 2020 Software Edition Rules:
  • College SPOC to be responsible to conduct internal hackathon in the campus
  • College to finalise total best 5 teams + 2 waitlisted teams from the internal hackathon.
  • SPOC to recommend the selected teams for SIH 2020 Software edition at SIH portal
  • Out of the 5 selected teams per college, 4 can be chosen from blocked PSs & 1 can be chosen for Student Innovation category
  • Team leaders of the selected teams to be registered at the SIH portal to submit ideas
  • Submission of ideas by selected teams against PSs by college SPOC for the SIH2020 Finale
    For more details and registration process : https://www.sih.gov.in/

Sunday, January 5, 2020

Database Interview Questions

1. What do you understand by ‘Database’?
Ans: Database is an organized collection of related data where the data is stored and organized to serve some specific purpose.
For Example, A librarian maintains a database of all the information related to the books that are available in the library.

2. Define DBMS.
Ans: DBMS stands for Database Management system. It is a collection of application programs which allow the user to organize, restore and retrieve information about data efficiently and as effectively as possible.
Some of the popular DBMS's are MySql, Oracle, Sybase, etc.

3. Define RDBMS.
Ans: Relational Database Management System(RDBMS) is based on a relational model of data that is stored in databases in separate tables and they are related to the use of a common column. Data can be accessed easily from the relational database using Structured Query Language (SQL).

4. Enlist the advantages of DBMS.
Ans: The Advantages of DBMS includes:
  • Data is stored in a structured way and hence redundancy is controlled.
  • Validates the data entered and provide restrictions on unauthorized access to the database.
  • Provides backup and recovery of the data when required.
  • Provides multiple user interfaces.
5. What do you understand by Data Redundancy?
Ans: Duplication of data in the database is known as Data redundancy. As a result of Data Redundancy, duplicated data is present at various locations, hence it leads to wastage of the storage space and the integrity of the database is destroyed.

6. What are the various types of relationships in Database? Define them.
Ans: There are 3 types of relationships in Database:
  • One-to-one: One table has the relationship with another table having the similar kind of column. Each primary key relates to only one or no record in the related table.
  • One-to-many: One table has a relationship with another table that has a primary and foreign key relations. The primary key table contains only one record that relates to none, one or many records in the related table.
  • Many-to-many: Each record in both the tables can relate to many numbers of record in another table.
7. Explain Normalization and De-Normalization.
Ans: Normalization is the process of removing redundant data from the database by splitting the table in a well-defined manner in order to maintain data integrity. This process saves much of the storage space.
De-normalization is the process of adding up redundant data on the table in order to speed up the complex queries and thus achieve better performance.

8. What are the different types of Normalization?
Ans: Different Types of Normalization are:
  • First Normal Form (1NF): A relation is said to be in 1NF only when all the entities of the table contain unique or atomic values.
  • Second Normal Form (2NF): A relation is said to be in 2NF only if it is in 1NF and all the non-key attribute of the table is fully dependent on the primary key.
  • Third Normal Form (3NF): A relation is said to be in 3NF only if it is in 2NF and every non-key attribute of the table is not transitively dependent on the primary key.
9. What is BCNF?
Ans: BCNF is the Boyce Code Normal form. It is the higher version of 3Nf which does not have any multiple overlapping candidate keys.

10. What is SQL?
Ans: Structured Query language, SQL is an ANSI(American National Standard Institute) standard programming language that is designed specifically for storing and managing the data in the relational database management system (RDBMS) using all kinds of data operations.

11. How many SQL statements are used? Define them.
Ans: SQL statements are basically divided into three categories, DDL, DML, and DCL.
They can be defined as:
Data Definition Language (DDL) commands are used to define the structure that holds the data. These commands are auto-committed i.e. changes done by the DDL commands on the database are saved permanently.
Data Manipulation Language (DML) commands are used to manipulate the data of the database. These commands are not auto-committed and can be rolled back.
Data Control Language (DCL) commands are used to control the visibility of the data in the database like revoke access permission for using data in the database.

12. Enlist some commands of DDL, DML, and DCL.
Ans: Data Definition Language (DDL) commands:
  • CREATE to create a new table or database.
  • ALTER for alteration.
  • Truncate to delete data from the table.
  • DROP to drop a table.
  • RENAME to rename a table.
Data Manipulation Language (DML) commands:
  • INSERT to insert a new row.
  • UPDATE to update an existing row.
  • DELETE to delete a row.
  • MERGE for merging two rows or two tables.
Data Control Language (DCL) commands:
  • COMMIT to permanently save.
  • ROLLBACK to undo the change.
  • SAVEPOINT to save temporarily.
13. Define DML Compiler.
Ans: DML compiler translates DML statements in a query language into a low-level instruction and the generated instruction can be understood by Query Evaluation Engine.

14. What is DDL interpreter?
Ans: DDL Interpreter interprets the DDL statements and records the generated statements in the table containing metadata.

15. Enlist the advantages of SQL.
Ans: Advantages of SQL are:
  • Simple SQL queries can be used to retrieve a large amount of data from the database very quickly and efficiently.
  • SQL is easy to learn and almost every DBMS supports SQL.
  • It is easier to manage the database using SQL as no large amount of coding is required.
16. Explain the terms ‘Record’, ‘Field’ and ‘Table’ in terms of database.
Ans: Record: Record is a collection of values or fields of a specific entity. Example: An employee, Salary account, etc.
Field: A field refers to an area within a record that is reserved for a specific piece of data. Example: Employee ID.
Table: Table is the collection of records of specific types. Example: Employee table is a collection of record related to all the employees.

17. What do you understand by Data Independence? What are its two types?
Ans: Data Independence refers to the ability to modify the schema definition in one level in such a way that it does not affect the schema definition in the next higher level.
The 2 types of Data Independence are:
  • Physical Data Independence: It modifies the schema at the physical level without affecting the schema at the conceptual level.
  • Logical Data Independence: It modifies the schema at the conceptual level without affecting or causing changes in the schema at the view level.
18. Define the relationship between ‘View’ and ‘Data Independence’.
Ans: View is a virtual table that does not have its data on its own rather the data is defined from one or more underlying base tables.
Views account for logical data independence as the growth and restructuring of base tables is not reflected in views.

19. What are the advantages and disadvantages of views in the database?
Ans: Advantages of Views:
  • As there is no physical location where the data in views is stored, it generates output without wasting resources.
  • Data access is restricted as it does not allow commands like insertion, updation, and deletion.
Disadvantages of Views:
  • The view becomes irrelevant if we drop a table related to that view.
  • More memory is occupied when the view is created for large tables.
20. What do you understand by Functional dependency?
Ans: A relation is said to be in Functional dependency when one attribute uniquely defines another attribute.
For Example, R is a Relation, X and Y are two attributes. T1 and T2 are two tuples. Then,
T1[X]=T2[X] and T1[Y]=T2[Y] means the value of component X uniquely define the value of component Y.
Also, X->Y means Y is functionally dependent on X.

21. When is functional dependency said to be the fully functional dependency?
Ans: To fulfill the criteria of fully functional dependency, the relation must meet the requirement of functional dependency.
A functional dependency ‘A’ and ‘B’ are said to be fully functional dependent when removal of any attribute say ‘X’ from ‘A’ means the dependency does not hold anymore.

22. What do you understand by the E-R model?
Ans: E-R model is an Entity-Relationship model which defines the conceptual view of the database.
The E-R model basically shows the real-world entities and their association/relations. Entities here represent the set of attributes in the database.

23. Define Entity, Entity type, and Entity set.
Ans: Entity can be anything, be it a place, class or object which has an independent existence in the real world.
The entity type represents a set of entities that have similar attributes.
Entity set in the database represents a collection of entities having a particular entity type.

24. Define a Weak Entity set.
Ans: Weak entity set is the one whose primary key comprises of its partial key as well as the primary key of its parent entity.
This is the case because the entity set may not have sufficient attributes to form a primary key.
  
25. Explain the terms ‘Attribute’ and ‘Relations’
Ans: Attribute describes the properties or characteristics of an entity. For Example, Employee ID, Employee Name, Age, etc., can be attributes of the entity Employee.
The relation is a two-dimensional table containing a number of rows and columns where every row represents a record of the relation. Here, rows are also known as ‘Tuples’ and columns are known as ‘Attributes’.

26. What are VDL and SDL?
Ans: VDL is View Definition language which represents user views and their mapping to the conceptual schema.
SDL is Storage Definition Language which specifies the mapping between two schemas.

27. What is the Database transaction?
Ans: Sequence of operation performed which changes the consistent state of the database to another is known as the database transaction. After the completion of the transaction, either the successful completion is reflected in the system or the transaction fails and no change is reflected.

28. Define Database Lock and its types.
Ans: Database lock basically signifies the transaction about the current status of the data item i.e. whether that data is being used by other transactions or not at the present point of time.
There are two types of Database lock which are Shared Lock and Exclusive Lock.

29. What do you understand by Join?
Ans: Join is the process of explaining the relationship between different tables by combining columns from one or more table having common values in each. When a table joins with itself, it is known as Self Join.

30. What are the disadvantages of a Query?
Ans: Disadvantages of a Query are:
  • Indexes are not present.
  • Stored procedures are excessively compiled.
  • Difficulty in interfacing.
31. Define Join types.
Ans: Given below are the types of Join, which are explained with respect to the tables as an Example:
employee table:
employee table
employee_info table:
employee_info table

1) Inner JOIN: Inner JOIN is also known as a simple JOIN. This SQL query returns results from both the tables having a common value in rows.
SQL Query:
SELECT * from employee, employee_info WHERE employee.EmpID = employee_info.EmpID ;
Result:
Inner Join Example

2) Natural JOIN: This is a type of Inner JOIN that returns results from both the tables having the same data values in the columns of both the tables to be joined.
SQL Query:
SELECT * from employee NATURAL JOIN employee_info;
Result:
Natural JOIN

3) Cross JOIN: Cross JOIN return results as all the records where each row from the first table is combined with each row of the second table.
SQL Query:
SELECT * from employee CROSS JOIN employee_info;
Result:
Let us do some modification in the above tables to understand Right JOIN, Left JOIN, and Full JOIN.
employee table:
employee table new
employee_info table:
employee_info table new

1) Right JOIN: Right JOIN is also known as Right Outer JOIN. This returns all the rows as a result from the right table even if the JOIN condition does not match any records in the left table.
SQL Query:
SELECT * from employee RIGHT OUTER JOIN employee_info on (employee.EmpID = employee_info.EmpID);
Result:
Right Join Example

2) Left JOIN: Left JOIN is also known as Left Outer JOIN. This returns all the rows as a result of the left table even if JOIN condition does not match any records in the right table. This is exactly the opposite of Right JOIN.
SQL Query:
SELECT * from employee LEFT OUTER JOIN employee_info on (employee.EmpID = employee_info.EmpID);
Result:
Left JOIN

3) Outer/Full JOIN: Full JOIN return results in combining the result of both the Left JOIN and Right JOIN.
SQL Query:
SELECT * from employee FULL OUTER JOIN employee_info on (employee.EmpID = employee_info.EmpID);
Result:
Outer Full JOIN

Saturday, January 4, 2020

OOPs Interview Question

1. What is Object Oriented Programming? Object Oriented Programming (OOP) is a programming paradigm where the complete software operates as a bunch of objects talking to each other. An object is a collection of data and methods that operate on its data.

2. Why OOP?
The main advantage of OOP is better manageable code that covers following.

1) The overall understanding of the software is increased as the distance between the language spoken by developers and that spoken by users.

2) Object orientation eases maintenance by the use of encapsulation.   One can easily change the underlying representation by keeping the methods same. OOP paradigm is mainly useful for relatively big software.
3. What are main features of OOP?
Encapsulation
Polymorphism
Inheritance


4. What is encapsulation?
Encapsulation is referred to one of the following two notions.
1) Data hiding: A language feature to restrict access to members of an object. For example, private and protected members in C++.
2) Bundling of data and methods together: Data and methods that operate on that data are bundled together.


5. What is Polymorphism? How is it supported by C++?
Polymorphism means that some code or operations or objects behave differently in different contexts. In C++,  following features support polymorphism.

Compile Time Polymorphism: Compile time polymorphism means compiler knows which function should be called when a polymorphic call is made.  C++ supports compiler time polymorphism by supporting features like templates, function overloading and default arguments.
Run Time Polymorphism: Run time polymorphism is supported by virtual functions. The idea is, virtual functions are called according to the type of object pointed or referred, not according to the type of pointer or reference. In other words, virtual functions are resolved late, at runtime.


6. What is Inheritance? What is the purpose?
The idea of inheritance is simple, a class is based on another class and uses data and implementation of the other class.
The purpose of inheritance is Code Reuse.


7. What is Abstraction?
The first thing with which one is confronted when writing programs is the problem. Typically we are confronted with “real-life” problems and we want to make life easier by providing a program for the problem. However, real-life problems are nebulous and the first thing we have to do is to try to understand the problem to separate necessary from unnecessary details: We try to obtain our own abstract view, or model, of the problem. This process of modeling is called abstraction.

8. What is a class?
A class is simply a representation of a type of object. It is the blueprint/plan/template that describes the details of an object.

9. What is an Object?
An object is an instance of a class. It has its own state, behavior, and identity.
 
10. What are manipulators?
Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and setw.
 
11. Explain the term constructor
A constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation. Rules for constructor are:

  • Constructor Name should be the same as a class name.
  • A constructor must have no return type.
12. Define Destructor?
A destructor is a method which is automatically called when the object is made of scope or destroyed. Destructor name is also same as class name but with the tilde symbol before the name.

13. What is an Inline function?
An inline function is a technique used by the compilers and instructs to insert complete body of the function wherever that function is used in the program source code.

14. What is a virtual function?
A virtual function is a member function of a class, and its functionality can be overridden in its derived class. This function can be implemented by using a keyword called virtual, and it can be given during function declaration.
A virtual function can be declared using a token(virtual) in C++. It can be achieved in C/Python Language by using function pointers or pointers to function.

15.  What is a friend function?
A friend function is a friend of a class that is allowed to access to Public, private, or protected data in that same class. If the function is defined outside the class cannot access such information.
A friend can be declared anywhere in the class declaration, and it cannot be affected by access control keywords like private, public, or protected.

16. What is function overloading?
Function overloading is a regular function, but it can perform different tasks. It allows the creation of several methods with the same name which differ from each other by the type of input and output of the function.

17. What is operator overloading?
Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function, and it has its own precedence to execute

18. What is an abstract class?
An abstract class is a class which cannot be instantiated. Creation of an object is not possible with an abstract class, but it can be inherited. An abstract class can contain only an Abstract method. Java allows only abstract method in abstract class while other languages allow non-abstract method as well.

19. What are the different types of arguments?
A parameter is a variable used during the declaration of the function or subroutine, and arguments are passed to the function body, and it should match with the parameter defined. There are two types of Arguments.

  • Call by Value – Value passed will get modified only inside the function, and it returns the same value whatever it is passed into the function.
  • Call by Reference – Value passed will get modified in both inside and outside the functions and it returns the same or different value.
20. What is the super keyword?
The super keyword is used to invoke the overridden method, which overrides one of its superclass methods. This keyword allows to access overridden methods and also to access hidden members of the superclass.
It also forwards a call from a constructor, to a constructor in the superclass.

21. What is method overriding?
Method overriding is a feature that allows a subclass to provide the implementation of a method that overrides in the main class. It will override the implementation in the superclass by providing the same method name, same parameter, and same return type.

22. What is an interface?
An interface is a collection of an abstract method. If the class implements an interface, it thereby inherits all the abstract methods of an interface.
Java uses Interface to implement multiple inheritances.

23. What is exception handling?
An exception is an event that occurs during the execution of a program. Exceptions can be of any type – Runtime exception, Error exceptions. Those exceptions are adequately handled through exception handling mechanism like try, catch, and throw keywords.

24.  What is the main difference between overloading and overriding?
Overloading is static Binding, whereas Overriding is dynamic Binding. Overloading is nothing but the same method with different arguments, and it may or may not return the equal value in the same class itself.
Overriding is the same method names with the same arguments and return types associated with the class and its child class.

25. What is the main difference between a class and an object?
An object is an instance of a class. Objects hold multiple information, but classes don’t have any information. Definition of properties and functions can be done in class and can be used by the object.
A class can have sub-classes, while an object doesn’t have sub-objects.

26. What are the access modifiers?
Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes. There are five types of access modifiers, and they are as follows:

  • Private
  • Protected
  • Public
  • Friend
  • Protected Friend
27. What are the various types of constructors? There are three types of constructors:
–  Default Constructor – With no parameters.
–  Parametric Constructor – With Parameters. Create a new instance of a class and also passing arguments simultaneously.
–  Copy Constructor – Which creates a new object as a copy of an existing object.

28. What is ‘this’ pointer?
THIS pointer refers to the current object of a class. THIS keyword is used as a pointer which differentiates between the current object with the global object. It refers to the current object.

29. What is a pure virtual function?
A pure virtual function is a function which can be overridden in the derived class but cannot be defined. A virtual function can be declared as Pure by using the operator =0.

30. What are all the operators that cannot be overloaded?
Following are the operators that cannot be overloaded -.

  1. Scope Resolution (::)
  2. Member Selection (.)
  3. Member selection through a pointer to function (.*)

 31. What is a copy constructor?
This is a special constructor for creating a new object as a copy of an existing object. There will always be only one copy constructor that can be either defined by the user or the system.
 

Data Structure Interview Questions

1. What is a Data Structure?
A data structure is a way of organizing the data so that the data can be used efficiently. Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. For example, B-trees are particularly well-suited for implementation of databases, while compiler implementations usually use hash tables to look up identifiers.


2. What are linear and non linear data Structures?
  • Linear: A data structure is said to be linear if its elements form a sequence or a linear list. Examples: Array. Linked List, Stacks and Queues
  • Non-Linear: A data structure is said to be non-linear if traversal of nodes is nonlinear in nature. Example: Graph and Trees. 
3. What are the various operations that can be performed on different Data Structures?
  • Insertion ? Add a new data item in the given collection of data items.
  • Deletion ? Delete an existing data item from the given collection of data items.
  • Traversal ? Access each data item exactly once so that it can be processed.
  • Searching ? Find out the location of the data item if it exists in the given collection of data items.
  • Sorting ? Arranging the data items in some order i.e. in ascending or descending order in case of numerical data and in dictionary order in case of alphanumeric data.
4. How is an Array different from Linked List?
  • The size of the arrays is fixed, Linked Lists are Dynamic in size.
  • Inserting and deleting a new element in an array of elements is expensive, Whereas both insertion and deletion can easily be done in Linked Lists.
  • Random access is not allowed in Linked Listed.
  • Extra memory space for a pointer is required with each element of the Linked list.
  • Arrays have better cache locality that can make a pretty big difference in performance.
5. What is Stack and where it can be used?
Stack is a linear data structure which the order LIFO(Last In First Out) or FILO(First In Last Out) for accessing elements. Basic operations of stack are : Push, Pop , Peek
Applications of Stack:

  1. Infix to Postfix Conversion using Stack
  2. Evaluation of Postfix Expression
  3. Reverse a String using Stack
  4. Implement two stacks in an array
  5. Check for balanced parentheses in an expression
6. What is a Queue, how it is different from stack and how is it implemented? Queue is a linear structure which follows the order is First In First Out (FIFO) to access elements. Mainly the following are basic operations on queue: Enqueue, Dequeue, Front, Rear
The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added. Both Queues and Stacks can be implemented using Arrays and Linked Lists.


7. What is a Linked List and What are its types?
A linked list is a linear data structure (like arrays) where each element is a separate object. Each element (that is node) of a list is comprising of two items – the data and a reference to the next node.Types of Linked List :

  1. Singly Linked List : In this type of linked list, every node stores address or reference of next node in list and the last node has next address or reference as NULL. For example 1->2->3->4->NULL
  2. Doubly Linked List : Here, here are two references associated with each node, One of the reference points to the next node and one to the previous node. Eg. NULL<-1<->2<->3->NULL
  3. Circular Linked List : Circular linked list is a linked list where all nodes are connected to form a circle. There is no NULL at the end. A circular linked list can be a singly circular linked list or doubly circular linked list. Eg. 1->2->3->1 [The next pointer of last node is pointing to the first]

 8. Briefly explain the approaches to develop algorithms.

There are three commonly used approaches to develop algorithms −
  • Greedy Approach − finding solution by choosing next best option
  • Divide and Conquer − diving the problem to a minimum possible sub-problem and solving them independently
  • Dynamic Programming − diving the problem to a minimum possible sub-problem and solving them combinedly
 9. What are some examples of divide and conquer algorithms?
The below given problems find their solution using divide and conquer algorithm approach −
  • Merge Sort
  • Quick Sort
  • Binary Search
  • Strassen's Matrix Multiplication
  • Closest pair (points)
 10. What is linear searching?
Linear search tries to find an item in a sequentially arranged data type. These sequentially arranged data items known as array or list, are accessible in incrementing memory location. Linear search compares expected data item with each of data items in list or array. The average case time complexity of linear search is Ο(n) and worst case complexity is Ο(n2). Data in target arrays/lists need not to be sorted.

11. What is binary search?
A binary search works only on sorted lists or arrays. This search selects the middle which splits the entire list into two parts. First the middle is compared.
This search first compares the target value to the mid of the list. If it is not found, then it takes decision on whether.

12. What is merge sort and how it works?
Merge sort is sorting algorithm based on divide and conquer programming approach. It keeps on dividing the list into smaller sub-list until all sub-list has only 1 element. And then it merges them in a sorted way until all sub-lists are consumed. It has run-time complexity of Ο(n log n) and it needs Ο(n) auxiliary space. 

13. How quick sort works?
Quick sort uses divide and conquer approach. It divides the list in smaller 'partitions' using 'pivot'. The values which are smaller than the pivot are arranged in the left partition and greater values are arranged in the right partition. Each partition is recursively sorted using quick sort.

14. What is a tree?
A tree is a minimally connected graph having no loops and circuits.

15. What is a binary tree?
A binary tree has a special condition that each node can have two children at maximum.

16. What is a binary search tree?
A binary search tree is a binary tree with a special provision where a node's left child must have value less than its parent's value and node's right child must have value greater than it's parent value.

17. What is tree traversal?
Tree traversal is a process to visit all the nodes of a tree. Because, all nodes are connected via edges (links) we always start from the root (head) node. There are three ways which we use to traverse a tree −
  • In-order Traversal
  • Pre-order Traversal
  • Post-order Traversal
18. What is hashing?
Hashing is a technique to convert a range of key values into a range of indexes of an array. By using hash tables, we can create an associative data storage where data index can be find by providing its key values.