## Facebook Placement Papers

Facebook Interview Questions Set 5

Facebook Interview Questions Set 3

Facebook Interview Questions Set 2

Facebook Interview Questions Set 1

Facebook interview Questions for Software Engineer

Facebook Tough Interview questions

## Placement Papers for All Companies

3i infotech

Abacus Infotech

Abatix

Abaxis

ABB

ACC Limited

Accel Frontline

Accenture

Aditi Technologies

Adobe System

ADP

Agilysys

AgreeYa

AIG

AirNet

Alanco Technologies

Alle Technologies

Allfon

Alter Systems

Amazon

AMDL

Amdocs

AMI

Amiti Software Technologies

ANZ

Apple

Applied Materials

Apps Associates

Aricent

ASDC

Ashok Leyland Ltd

Asian Paints

Aspire System

AT & T

Atlas Copco

Atos Origin

AXA Technology Services

Axes Technology

Bain

Bajaj

Bayer

Bharti Airtel Ltd

Bhawan Cybertek

Birlasoft

Blue Star Infotech

BMC

BOB

Brakes India

C-DOT

CA Technologies

Cadence

Calsoft

Canarys

Capgemini

Caterpillar

Celstream

CGI Group

Changepond Technologies

Cimtrix Systems

Cisco system

Citicorp Overseas Software Ltd

ClinTech

CMC Limited

CMS

Cognizant

Compaq

Consagous Technologies

Convergys

CORDYS

CRISIL

Crompton Greaves

CSC

CSFB

CtrlS Datacenters Ltd

Cummins

Cyient

Daffodil

Daimler

Dell

Deloitte

Delphi-TVS

Dharma Systems

Directi

DSRC

Eicher

ELGI

ELICO

EMC Corporation

Emphasis

Ericsson

Ernst & Young

ESKO

Essar

Facebook

Fanuc Corporation

Fidelity

Flextronics

Flipkart

Freescale

Fujitsu

Gajshield

GE

Genpact India

Geodesic

Geometric Limited

GlobalEdge

GlobalLogic

GMR Group

Godrej Infotech

Google

Grapecity

Harita - TVS

HCL

HCL Technologies

Headstrong

Healthasyst

HEC Ltd

Hexaware

HFCL

Holool

Honeywell

HP

HTC Global Services

Huawei

Hughes

Hyundai

IBM

IBS Software Services

IGate

Ikanos

IKOS

Impetus

iNautix

Indecomm

IndiaBulls Power Limited

Inductis-EXL

Industrial Alliance

Infineon

Infogain

Infosys

Intec

Integra

Intel

Intergraph

ITC Infotech

Jindal Steel and Power Limited

KPIT

L & T

L & T Infotech

LG Soft

Linde India Ltd

LnT Emsys

LnT-ECC

Lucas - TVS

Mahindra Engineering Services Ltd

Mahindra Ltd

Maruti

Matrix

Maveric Systems

McAfee

Microland

Microsoft

Mindtree

Miraclesoft

MKCL

Motorola

Mu-Sigma

Nagarro

NASSCOM

NCR Corporation

Ness Technologies

Neudesic

NIIT Technologies

Novell

Nvidia

Oracle

Persistent

Philips

Planetasia

Polaris

Poornam Info Vision

PSI Data Systems Limited

Quest-Global

Quinnox

R Systems

Redpine

Reliance Energy

Robert Bosch

RS Software

Samsung

SAP labs India

Sapient

Sasken Communications

Schneider India

Serco

Siemens

Sierra Atlantic

SkyTECH

Soliton

Sonata Software

Sony India

SQL Star

Steria

Subex Limited

Sutherland Global Services

Syntel

Talisma

Tata motors

Tata technologies

Tata-ELXSI

TCE

TCS

Tech Mahindra

Temenos

Tesco

Texas Instruments

Thermax

ThoughtWorks

Torry Harris

Triad

Trianz

Trilogy

TVS Motor

Unisys

UnitedHealth Group

UST Global

UTC Aerospace System

Valuelabs

Vedanta

Verifone

Verizon

Virtusa

Vision Infotech

Vizual

VMware

Wipro

Yahoo

YASH Technologies

Zenith

Zensar Technologies

ZTE

# Facebook Interview Questions Set 4

Posted on :12-03-2016

**Q1. Create the data structure for a component that will receive a series of numbers over the time and, when asked, returns the median of all received elements.**

**(Median: the numerical value separating the higher half of a data sample from the lower half. Example: if the series is**

**2, 7, 4, 9, 1, 5, 8, 3, 6**

**then the median is 5.)**

**Model the data structure for a component that would have these two methods:**

**@interface SampleHandler {**

**- (void)addNumber:(NSNumber*)number;**

**- (NSNumber*)median;**

**}**

**Q2. You want to create a staff to use in your martial arts training, and it has to meet some specific requirements.**

**1. You want it to be composed of two smaller staves of equal length so that you can either use it as a single staff or as two smaller ones.**

**2. You want the full sized staffs center of gravity to be exactly in the middle of the staff.**

**You have a very, very long branch from which you can cut the pieces for your staff. The mass of the branch varies significantly throughout it, so you use just any two pieces of the same length. Given a description of the mass throughout the branch, determine the longest staff you can make, then return three integers on a single line, the first two indicating the first index of each half-staff, and the third indicating the length of each half-staff.**

**The input will be given on a single line as a string of digits [1-9], each digit representing the mass of a section of the branch. All sections are the same size and the maximum length of the string is 500. Here is an example:**

**41111921111119**

**11119 11119**

**If the indicated sections are cut from the branch they will satisfy your requirements. They are both the same length, and they can be put together as either 9111111119 or 1111991111, both of which have a center of gravity exactly in the center of the staff.**

**Center of gravity can be determined by taking a weighted average of the mass of each section of the staff. Given the following distances and masses:**

**Distance: 12345678**

**Mass: 22241211**

**Sum of the mass of each section: 2 + 2 + 2 + 4 + 1 + 2 + 1 + 1 = 15**

**Weighted sum of the masses:**

**2*1 + 2*2 + 2*3 + 4*4 + 1*5 + 2*6 + 1*7 + 1*8 = 60**

**Weighted sum / regular sum = 60 / 15 = 4**

**This means that the center of mass is in section 4 of the staff. If we wanted to use this staff the center of gravity would need to be (8+1)/2 = 4.5.**

**Here is an example problem:**

**131251141231**

**---- ----**

If we take the sections indicated we get 1312 and 1231. By reversing the first one and putting them together we get 21311231

Sum of the mass of each section: 2 + 1 + 3 + 1 + 1 + 2 + 3 + 1 = 14

Weight sum of the masses:

2*1 + 1*2 + 3*3 + 1*4 + 1*5 + 2*6 + 3*7 + 1*8 = 63

Weighted sum / regular sum = 63 / 14 = 4.5

This puts the center of mass exactly in the center of the staff, for a perfectly balanced staff. There isnt a longer staff that can be made from this, so the answer to this problem is

0 8 4

Because the half-staves begin at indices 0 and 8 (in that order) and each is of length 4.

**Q3. /****

*** Implement a function OneEditApart with the following signature:**

*** bool OneEditApart(string s1, string s2)**

*****

*** OneEditApart("cat", "dog") = false**

*** OneEditApart("cat", "cats") = true**

*** OneEditApart("cat", "cut") = true**

*** OneEditApart("cat", "cast") = true**

*** OneEditApart("cat", "at") = true**

*** OneEditApart("cat", "acts") = false**

*** Edit is: insertion, removal, replacement**

***/**

**Q4. Given an array of words, write a method that determines whether there are any words in this array that are anagrams of each other.**

**Sample #1: @[@"bag", @"bat", @"tab"]; // output TRUE**

**Sample #2: @[@"gab", @"bat", @"laf"]; // output FALSE**

**Q5. An UIView A2 is subclassed from the same parent as an UIView A1.**

**Given inputs of A1, A2, and an UIView that is in the tree of UIViews of A1 somewhere, return the exact UIView that mirrors this in A2.**

**Example setup:**

**A1------------**

**| |**

**UIView UIView**

**|**

**UIView <-- Given this**

**A2------------**

**| |**

**UIView UIView**

**|**

**UIView <-- Find/return this**

**Q6. Given a list of n sorted lists of numbers, write a method that returns one giant list of all the numbers in order.**

**Example input:**

**NSArray* input = @[**

**@[@2, @5, @10],**

**@[@25, @100, @105],**

**@[@7, @56, @42],**

**.......**

**];**

**Q7. Given the following hashmap for numeric to alpha translation of a telephone keypad:**

**NSDictionary* dict = @[email protected]: @[@"A", @"B", @"C"],**

**@3: @[@"D", @"E", @"F"],**

**@4: @[@"G", @"H", @"I"],**

**@5: @[@"J", @"K", @"L"],**

**@6: @[@"M", @"N", @"O"],**

**@7: @[@"P", @"Q", @"R", @"S"],**

**@8: @[@"T", @"U", @"V"],**

**@9: @[@"W", @"X", @"Y", @"Z"]};**

**Write a method that takes a phone number as input and returns all possible letter combinations for that phone number.**

**Q8. Print all paths of a binary tree from root to leaf.**

**Later, extend the solution to work with graphs, careful attention to cycles which you should print as paths as well (without printing visited nodes twice).**

**Q9. Given two extremely large numbers - each number is stored in a Singly Linked list, with the MSB at the head. You are not allowed to reverse the Linked lists. Write a program to multiply them in optimum space and time.**

**Q10. input [2,3,1,4]**

**output [12,8,24,6]**

**Multiply all fields except its own position.**

**Restrictions:**

**1. no use of division**

**2. complexity in O(n)**

**Q11. Given a matrix with 1s and 0s, a rectangle can be made with 1s. What is the maximum area of the rectangle.**

**00010**

**11100**

**11110**

**11000**

**11010 In this test case the result needs to be 8.**

**How:**

**00010 00010**

**11100 11 100**

**11110 11 110**

**11000 11 000**

**11010 11 010**

**If you see above the 11s are used from the first two columns and last four rows making the area or count of 1s to be 8.**

**Q12. Imagine x is an operand and * is a binary operator. We say a string of x and * follows Reverse Polish notation if it is a postfix notation.**

**For example strings xx*, x, and xx*xx** follow Reverse Polish notation.**

**Given a string of x and *, how many insert, delete, and replace operations are needed to make the string follow the RPN.**

**For example, xx* need 0 operation to follow RPN since it already follows RPN.**

**x*x needs two operations to become xx* which follows RPN.**

***xx* needs one operation to become xx* which follows RPN.**

**Your algorithm should work for a string of size up to 100.**

**Q13. WAP to modify the array such that arr[I] = arr[arr[I]].**

**Do this in place i.e. with out using additional memory.**

**example : if a = {2,3,1,0}**

**o/p = a = {1,0,3,2}**

Note : The array contains 0 to n-1 integers.

**Q14. Given a linked list where apart from the next pointer, every node also has a pointer named random which can point to any other node in the linked list. Make a copy of the linked list.**

**Q15. Microsoft Excel numbers cells as 1...26 and after that AA, AB.... AAA, AAB...ZZZ and so on.**

**Given a number, convert it to that format and vice versa.**

**Q16. Design question: Say you have hacked in to a network and can deploy your bot thousands of machines, how would you design your bot so that all the machines work together to download a website, say wikipedia. There should be load balancing and a page should be queryable given its URL.**

**Q17. Given a matrix of letters and a word, check if the word is present in the matrix. E,g., suppose matrix is:**

**a b c d e f**

**z n a b c f**

**f g f a b c**

**and given word is fnz, it is present. However, gng is not since you would be repeating g twice.**

**You can move in all the 8 directions around an element.**

**Q18. Given a matrix consisting of 0s and 1s, find the largest connected component consisting of 1s.**

**Q19. Given two arrays of sorted integers, merge them keeping in mind that there might be common elements in the arrays and that common elements must only appear once in the merged array.**

**Q20. Given a normal binary tree, write a function to serialize the tree into a string representation (returning the string), and also a function to deserialize a serialized string into the original binary tree.**

**Q21. Given a normal binary tree, write a function to serialize it into a string representation (returning a string), and also a function to deserialize the string into the original binary tree**

**Q22. A professor wants to see if two students have cheated when writing a paper. Design a function : hasCheated(String s1,String s2, int N) that evaluates to true if two strings have a common substring of length N. Additional question after implementation. Assume you dont have the possibility of using String.contains() and String.substring(). How would you implement this?**

**Q23. Given a list of 4 billion integers, find an integer not in the list using 4MB of memory. (interview was in Java)**

**Q24. Write atof in Java, which converts a string representation of a float (like "342.18E-10") to an actual float without using any built-in parsing functions.**

**Q25. Given a Binary Tree (balanced or not) write a method that transforms the tree in a degenerate tree (basically a data structure like a sorted linked list where each node has the left child null) and returns the new root. This must be made in place, no external memory usage is allowed.**

**Q26. What are the screen dimensions of various iPhone models?**

## Top Companies Placement Papers

TCS Papers

Wipro Papers

HCL Papers

IBM Papers

Amazon Papers

CISCO System Papers

Cognizant Papers

CSC Papers

Tata Motors Papers

Tech Mahindra Papers

L&T Papers

Facebook Papers

Dell Papers

L & T Infotech Papers

Capgemini Papers

HP Papers

Microsoft Papers

Google Papers

Samsung Papers