0% found this document useful (0 votes)
389 views163 pages

Important Questions

Uploaded by

kidzplanet5763
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
389 views163 pages

Important Questions

Uploaded by

kidzplanet5763
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 163

Rules of the Game

1. This Sheet is for GEEKS


2. Share and Care, Please do update questions
3. It is available as Long as you want, Dont Worry

Highlight Rules:
Repeated Question Question Asked More then 40% Interviews
Unique Question Question Asked Only in That Interview

Please Update These Sheets as Well :-)


Reading Material

S .No Topic
1 Solid Principles
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Reading Material

Link Rating
http://www.codeproject.com/Articles/703634/SOLID-architecture-principles-using-simple-Csharp
Good
Please Add Questions Here.
Company Question
e Add Questions Here.
Answer
Interview #

3
Question
Write a program to remove all duplicates from a 2d array of characters. Try to come up with a solution
which
Write asolves the which
program problem in 0(n),
returns truewhere
if the ninput
is the number
array of elements
of characters in the a2dduplicate
contains array else returns false.
Solve the problem in 0(n) time
Implementation of Tries (also called Prefix Tree) and complexity of operations on it
Implementation of Binary Tree and complexity of operations on it
Given
Given a file of
a file of size
size 30
10GBGB,containing
which is stored
stringsondelimited
your disk,
byhow would
spaces, you
find thesort that fileof all prefixes that can
frquency
Design
be made pattern scenario based questions. Scenarios were made out of real use cases of careem app -
What is afrom
Most important
the?strings
thread How ittoin
patterns
that
isknow file from a process ? For what kind of operations
different
are Observer pattern, MVC, Adapter pattern, Singeleton will youpattern,
make aStrategy
thread ?
What are the consequences of making too much threads ? What is meant by thread
pattern, Facade Pattern and Factory Method. SOLID design principles, Dependancy Injection and 2 safety ?
practical
OOP basic examples
conceptsof-that
Abstraction, Encapsulation, Information Hiding, Polymorphism, Delegation,
Inheritance, Abstract
Basic Database classes,
concepts Interfaces,
- Functional Generics/Templates,
dependencies, Access
Normalization specifiers,
(1NF, 2NF, 3NF, BCNF), ERD , SQL
joins, Indexes, Database connection pool, Foreign keys, Primary Keys, Uniqueness constraint
Basic concepts like how a does a client communicates with the server
What REST (Representational State Transfer) is ?
What
If you are
havepush notifications
mentioned andon
Android how they
your work ?then be ready for a lot of android platform specific
resume,
questions

How you implement Cache using Interfaces?


Proxy Design Pattern
Implementation of Signleton
RoundRobin tournament program(Combinations)
Interfaces(advantages / disadvantages and difference from abstractclass)
Hashtable/Hash function
Overloading/Overriding

(Dev day'17) 3 people were there:


*****
('-' = space)
2nd: (sb se chill yehi gya, bnda aala tha :P) [ Mr. Tariq ]
code lkhaya:
given integer array less than 5 ko left me and greater than 5 ko right me kro in o(n). stack se kr k de dya. dekha us ne kaha chl b
phr swapping krayi start - end se compare kra k. the best part us ki shakal dekhne wali thi :P :P
1 aur code lkhaya : given a string of string, count the frequency of each string.
input: Ali, Ahmed, Ali, Ahmed
output: Ali =2 Ahmed 2
phr DS se start kia
hash map btao, iss ki koi realtime example do .:
i said suppose 50 students ka data store kia he than search krna he k ye id he ya nai tou o(n) lageyga. hashing kr do .he asked ac
web server ka scenario dya suppose 1 server pr multiple requests aati hein kese deal krega.
I said depend krta he 1 wqt me ktni request fullfil kr skta he and multiple request ko same resource chaiye ya nai.
agr same chaiye tou interleaving approach use kro time sharing hogi sb ko thori thori dair ml jayegi . agr different chaiye tou th
agr bht sari threads bn gyi aur kill hui because of insufficient memory kon handle krega ye sb i said processor than realized kia
thread me thora merge sort ka pucha wo kese deal krega iss ko
end me pucha aap ko kch puchna he i asked few things related to my interest about technologies you usually work on and kia k
swift for front end
java spring backend
AWS , mysql
android , ios, Angular
BI, DBA, Business Analyst, test automation
3rd:
2 ka parallel me le rha tha aata tha code kehta tha and chala jata tha dusre k pass
srf code lkhaye
fibonacci lkhya, pura dry run kia
phr recursive fibonacci lkhya
number reverse
string reverse
k de dya. dekha us ne kaha chl bhai stack use nai kr sktey :P

eyga. hashing kr do .he asked acha agr collision aye tou i said separate chaining use kr lo us me bhi traverse krna hoga but significantly kam

rce chaiye ya nai.


yegi . agr different chaiye tou thread me daal do, multiple threads me different resourse use hogi by different request.
said processor than realized kia bol rha hun :Pinstantly said OS krega ye manage process and memory management os ka kaam he processo

s you usually work on and kia kia opprotunities hein


krna hoga but significantly kam time lageyga, aur bhi solutions he linear probing, quadratic probing, double hashing.

gement os ka kaam he processor ka nai.


Please Add Questions Here.
Interview # Question Answer
1 Four Principles of OOP with examples ?
Which framework have you worked on ? I answered Codeignitor
On what pattern/coding technique does Codeignitor works on ?
What is MVC?
How are the four principles implemented in Codeignitor ?
What is SQL ?
What are joins in SQL ?
What is the difference between inner join and right join ?
What is group by clause ?
What is distinct in SQL?
Scenario like if i have to return the query with name = "Uzair" how to write it?
if i have multiple names "uzair" how to get a single distinct result?
if i use group by clause then would it return the same as Distinct ?
if so then what is the difference between Distinct and Group by ?
What is JSON ? and where is it used ?
What are aggregate functions ?
If you have to calculate total number of rows in a table and you dont know about column names how would y
air" how to write it?
ct result?
Distinct ?

ut column names how would you do it?


Make a complete Queue class and all its funtions
1) Enqueue
2) Dequeue
3) Print Queue
Interview # Question
4) isEmpty
1 5) isFull

2 - Technical interview started with:


OOP questions
1- What is OOP? Qualities of OOP?
2- if you make an object of derived class. then in which order will constructors be called ?
3- Explain public, protected, private with examples.
3- What happens if base class constructor is private? when is it needed? show example
4- What is singleton design pattern and how do you implement it?
6- Run-time/Compile time binding ka difference aur polymorphism ka kia faida hota hai?
5- Explain
What if youstatic
passkeyword
a pointerwhen used
of base in classes
class (holdingorderived
just generally.
object) to a function as
reference?
Java questions:
8- Immutable variables kia hotay hain? is it possible to manipulate a value in immutable
7- whatinsuperclass
String Java? howextends
can youall classes
copy in java?
immutable value to mutable variable? and what is
base class of String in java?
9- Explain garbage collector working. can you explicitly invoke garbage collector in Java?
10- Interface and abstract ka difference. When should you use which?
Data Structures:
13-
11- Assume
Show BFS youworking
have no way to access HEAD pointer in Linked list. Then if you have a
function which deletes any Link List node passed in a function, is it possible to
12- Singly linked
implement list kaprototype
it: function midpointis:
kese
voidnikalain, show*temp)
delete(node algo. // mene kaha not possible as
prev node reference is not available and will break linked list
14- Reverse
15- Say a linked
you have twolist with lists
linked RECURSION.
A and B, and they merge at some point but you don't
16-
know If you have
which. Finda array
that with
node sorted
at butthey
which some repeating integers such that 1 2 2 3 3 3 3 4
merge.
// I solved
5 5... returnthis using
only the nested
integersiteration in O(A*B)
which occur once.time.
LimitThen they
is: you askeduse
cannot meanother
to do it array
in to
o(a+b) time. And then even implement it in log time.
store count of numbers (i did it using nested loops, and using vector to insert uniquely
occuring numbers)
Other questions:
17- Generate this using recursion only, you may use a total of just two variables in your
program: 1 2 3 4 5 4 3 2 1
prototype: int printpattern(int n) { }
called with printpattern(5)
18- Explain difference between POST/GET.
19- Explain HTML5.
20- How does a web service work?
21- About my HPC course, they asked me to explain threads, locks, communication
between two threads, and synchronous/asynchronous comm? Also a little bit about
Hadoop, OpenMPI , MPI and when to use which.
22- If a function is called in int main(), is it a synchronous or asynchronous call?
Maths/IQ
23- You have a path in shape of a triangle and a person is standing at each corner.
Suppose they all start walking and each has 50% probability to walk in a particular
direction (each person has two directions available to them) ... find out % probability of
them colliding.
24- Person is stuck at bottom of a well and he has to climb 4 stars to get out... with each
2 climbs he falls 1 down. how many climbs will it take to get out of well?

3 Avanza test included IQ questions, OOP, a couple of DP questions, and


database. You also had to write a few queries using joins and codes to find
whether a string is palindrome or not, and largest contiguous sum in an array of
integers.
4 Indexing
Answers
Interview # Question
FYP Discussion
1
Why we use classes? What is the main reason?

4 pillars of OOP define all

Abstraction and Abstract Class difference?

Interface and abstract class difference?


What is compile time and runtime?
overloading kis time py hti hy?
overriding kis time py hti hy?

Early Binding and Late Binding?

What is overloading and overriding?


What is joins?
Inner joins and Outer joins difference?
Same as above + the following
2 Circular dependence in database
Why do we normalize database
Types of normalization and definitions
3
-Introduce your self.
-Explain FYP indetail.
-Adavantages of Obect oriented programming.
-Question regarding OOP pillars.
-implementation of 4 pillars of OOp in java.
-some codes in java were given . what will be the output?
-conditional loop vs unconditional loop.
-code wrapping design patterns.
-why need constructors, can their be multiple constructor in a class.
-what is cloud computing . why need cloud?
-protocols to implement cloud on web in detail.
-(AND else i forgot).

4 Difference between Composition and Aggregration


What are Sessions
Difference Between Sessions and Cookies
difference bw candidate key and unique key

traverse a linked list with odd number of node only once and tell the
value of middle element
1. FYP
5 2. language used in fyp
3. other languages used
4. rate your database skills out of 10
5. rate your oop skills out of 10
6. abstract and interface
7. static and non static variables
8. favorite language
9. types of polymorphism in c#
10. templates in c#
11. static ko access kaise krtay hai
12. bhot saari classes aik class ko access kr rahi ho to kya
hoga? variables ki value change hongi ya nae?
13. singleton ka code
14. Car bike airplane ki classes ko singleton kaise kr sktay
hai?

15. array mai se odd integers nikal ke doosray array mai copy
krnay ka code its complexity in the case of sorted or unsorted
16. trees kitnay types ke parhay hai?
17. data structures kitnay types ke parhay hai
18. load balancer kya hota hai? kaise kaam krta hai
19. agr aik pc ko access nae mil raha baki saaro ko cloud ka
access mil raha hai to uska kya matlab hai?
20. is room mai dusters kaise fit karo gay
21. sealed class kya hoti hai
22. your role in fyp
23. matlab kyun use kia
24. folio 3 se kya expect kartay ho?
25. fast ka area kitna hoga in kilometres
26. fast mai kitni cs buildings place kr sktay hai?
27. computer science mai sb se achi cheez kya lagi apko
FYP in detail
6 OOP:
1.what is abstract class?
2.abstract class vs interface
3.java mein multiple inheritance kio nae hti?
4.kia hum abstract class mein definition de sakty hy functions
ki?
5.diamond problem kia hti hy?
6.kistrah solve kartay hy ?
class A{
public:
A (){
cout << "cons A" << endl;
}
virtual void print(){
cout << "A" << endl;
}
};
class B: public A{
public:
B (){
cout << "cons B" << endl;
}
virtual void print(){
cout << "B";
}
};
class C: public A, B{
public:
C (){
cout << "cons C" << endl;
}
virtual void print (){
cout << "C";
}
};
int main ()
{
C c;// konsa constructor call hga ? konsa baad mein hga
c.print();// kis ka call karega function?
return 0;
}
7.polymorphism kia hy?
8.overloading kia hy?
9.overriding kia hy ?
class A{
};
class B: public A{
};
A a=new A();
B b= new B();
A c = new B();
kia yai 3ino theek hy?
power ka code using recursion
what is aggregation, composition explain with example.
10.logical question
OS:
11.OS parhi haina?
12.multiprocessing ka idea hy?
13.mutex kia hta hy? kio use kartay hy?
14.semaphore kio use karty hy?
15.critical section hti kia hy? code mein kese hti hy? kia hta hy uske
andar?
Design Patterns:
16.patterns parhe hy?
17.singleton kia hta hy?
code likho
Data structure:
18.linked list kia hti hy?
19.stack ko linked list s implement karo.
20.hash map kia hty hy?
21.complexity btao hash map ki?
22.search in a link list ki complexity kia hti hy?
Database:
23.ERD bnao university, teacher, student, course
relation define karo
24.join kitny trah k hty hy?
25.self join kia hta hy?
example de skty hy self join ki?
26.aik self join dia
ID Name ManagerID
1 Ali 2
2 Iqbal NULL
ismein Manager k name print kar k dou.
27.upar jo erd bnai hy ismein s konse bachay ny sab s zayda
course uthaye huay hy ?

aur second highest kis ny courses liye huay name print karo.
28.candidate key kia hti hy ?
29.primary key kia hti hy?
30.super key kia hti hy?
31.composite key kia hti hy?
32.kia foreign ki hamesha unique hgi?
33.kia composite key hamesha unique hgi?
34.Normalization kio kartay hy?
35.kia normalization k koi drawback b hty hy?
36.indexing kia hti hy?
37.indexing kio use kartay hy?
38.kitni trah ki hti hy?
39.triggers kia hty hy?
40.store procedure kia hty hy?

41.store procduere zayda efficient hy ya simple sql ki query?


42.clustering ka concept hy kuch database mein?
Automata parhi hy?
43.Regular expressions kia hti hy?
44.Logical question
Folio 3 , first interview:-
7 Intro
OOP:-
Difference b/w interface and abstract class and when to use
them
diamond problem
Programming:-
code for fizzbuzz, fibonacci, num and its power given-what will be
output(recursively),
Database:-
primary key, unique key, candidate key, composite key
triggers and stored procedures
ERD to be drawn of given scenario
Query: Student name having maximum marks in table
Design Pattern:-
Difference b/w factory and abstract factory
when to use adapter pattern(I presented a scenario)
Singleton pattern code
How to make singleton thread safe
CSS:-
If there are 5 div(each inside the other), write a selector for
capturing 2nd div
Javascript:-
var x=function() { return 2+3; }(); // what will be the value of x
Folio3 first interview :
8 1- about yourself
2- fyp
3- why classes, oop, structure
4- Unity3d ka overview
5- Abstract Factory Pattern
6- MVC
7- Open source
8- Interface (why in android)
9- Github
10- Sourcetree
11- Data Anomalies
12- Normalization
13- ERD of fyp (1 join ki query)
14- normalization kon kon si hoe wi hai erd mein
15- c# Vs java
16- string ka code
Input : yes, how
Output: yheosw
17- multiple inheritance and Diamond problem
Discussion on different techniques and languages.
And har sawal pe uper se aate the like github ka pocha,
source tree kyun, why open source, value type hai to
reference phr har sawal ka counter milta grin emoticon
18- reference vs value type in java
19- queue, real life example + kahi use ki ho to
20- hashing dictionary uses
And buhat sare yaad nahi
Folio 3 VP interview
9 They called it technicle. But it was mostly pailam paali.
He offered k if u have time give HR interview right now. I accepted
the chance.
He offered k if u have time give HR interview right now. I accepted
the chance.

10 Folio3 1st interview. In sab cheezo ma bht detail poocha plus


codes likhwae almost sb k. Phr codes ma changes karaen aur
different tareeqay sa bht ziada ghumaya.
Static funtion in c++
Virtual function and diamond problem
Copy constructor
Singleton
Pointers
Database normalization
Indexing
Friend function
Polymorphism
Overriding overloading

11 If you choose C++ to be the language you are most


comfortable with,
Be ready to write correct: frown emoticon
- Copy Constructors
- Pointer Manipulation functions
- Friend functions
- Operator Overloading.
- Solve Diamond problem
Folio Interview...
12 -Tell about urself.
-Fyp.
-Session and Cookies.
12

-Some questions about HTTP.


-Pillars of OOP.
-Asked me humbly: Bubble sort ata apko.
me: Yes.
Ok to "Quick Sort" Likhdain squint emoticon .
-Class diagram of scenario.
-All db keys.
-Noramlization.
-Semaphore and mutex.
-ERD.
-One Long query with many many joins.
-Output of a program.
-Some questions related to basic OOP.
Folio3 interview.
13 - explain yourself
- public private protected variables
- variable initialization.. Stack vs heap
- object initialization .. Stack vs heap
- array vs generics.
- the object class
- constructor overloading
- chain constructor
- oop pillers
- inheritance vs encapsulation - do they void each other?
- factory vs Singleton pattern
- why do we use design patterns?
- difference BTW functional and oop
- why using oop?
-Benefits of functional over oop.
- database normalization. What and why
- explain all normal forms
- design erd and write a query
- write a recursive function to reverse a string
FOLIO3 2nd Interview
14
- FYP
- What is OOP ?
- 4 PILLAR ALONG WITH CODE (Encapsulation , abstraction mein
fakar with code samjhaya)
- Inheritance
- Polymorphism (with code of overiding)
- Shape s = new Shape() , Shape ss = new Traingle() , Traingle t =
new Traingle() - (In mein sai kis mein overriding hoge ?)
- Indexing
- Outer and Inner Join
- Full Join
- Big O kiya hota hai ?
-Array vs linked list difference
- How to find 15 value element in array and linked list ? (Dono ki big
O) (In linked list O(n) worst case, In array O(1) )
- What is O(1) ( if constant than what is constant)
- Ek array hai unsorted humain us mein 10 value find karne hai big
o kiya hoga uska ?
- Agar array sorted hai to kaise find karo ge efficinetly wo given
value ? (Mein nai Binary Search ka batya) (Uska big O phucha)
- What is data Structure?
- Program likhwa 3.
Reverse String
Palindrome
Reverse Sentence
- Binary tree
FOLIO3 1st Interview
15
- Inheritance
- What is interface and abstract?

- Difference between interface and abstract ? If we make a class


that has only abstract methods than what is need of interface?
- Which join is fast and why ? (Inner join)
- Primay key, composite key, Candidate key

- if primary key contain unique values to primary key kyun bane jab
kai unique key hai to ? (B/c primary does not contain null values)
- Erd of scenerio (library sai related tha) and us par ek query)
- What is data structure?
- What is design patterns?
- What is Data mining?
- Difference between OOP and OOAD?
- Write Program to reverse string (recursively)?
- Singleton , MVC ,Abstract along with examples
- MVC mein business logic kahn bante hai ?
- What is businees logic?
- Stored Procedure vs function ? Where to use them ?
- What are views? Where to use them ?
- Compostion and Aggregration with examples
- Session vs Cookies (Mujhe nhn ata tha)
- SDLC
- Unit Testing

- Normalization kiya hai ? Why we do it? Uska types explain karo?


- Kyun job karna chayte ho?
- 10 years bad khud ko kahn dekhte ho ?
- Techlogy interest?
1:45 - 2:00 hours ka hwa
16 - FYP (kya banaya and learning kitni hwi)

- Sare projects skim kiye cv pe bari bari pucha jo inhain achai lage
- Teaching ke ke kya faida hwa in improving skills
- websolutions wali job kyun chori
- sab se zyada kaam kis pe kia he?
Acha bhae ab oops pe ajate hain
- Operator vs Function overloading?
- Function overloading vs Function overriding?
- Example de kar samjhain overrriding?
- Polymorphism kya hoti he
- interfaces and abstract classes
- why interfaces then? kyun use karun main?
- access modifier (public, private, protected)
- code likha purai page pe classes main inheritance ho rahi thi,
different scenario btai pucha kab kya output aiga, error ka btaya to
maan nhi rahe thai pahlai end main acknowledge kardia ke haan
error aiga
- constructor btao, default and parametric
Scenario 1:
Pahlai context switching ki baatin puch li thin
Aik object he ismain 100 members hain humhain iski state save
karwani ho kahlo koi game he phir baad main loading main is ko
restore karwana he? kaise karoge?
- static class, static function, static member
- code lika our ispe sawal kiye
- heap, stack and code section our kahan hote hain
- Local var kahan store hota hay
- design pattern nhi parha? chalo singleton to likh dain
- stored procedures kya hote hain, kyun use karun, faida btao
- binary search btao
- array vs linklist
- difference between aggregation and composition
- c# main multiple inheritance nhi hoti magar phir bhi koi tariqa he
karne ka aik btaya to dusra pucha
- session and cookie
- browser main cookie disable kardun ab? kaise session maintain
karoge?
- acha post get ka difference btao
- web pe kaam kia he na example btao kahan kahan use kia our
konse senario main konsa better he?

- craglist ki web main tumnai get lagaya tha user ko ise kya faida?
- credential ko through post hi karun?
- soap and rest, web services, api bla bla
- jis project main web service banai thi wo samjhao
- indexes, faida btao?
- table and virtual table ka diff?
- function and store procedure ka diff?
Scenario 2:
Humhare pas aik table tha hum har dafa 3 se 4 queries lkhte hain
ismain magar aik querry nhi chali ab kya karen? database
inconsistant hojaiga jab dobara chalo ge wohi queries? kaise masla
hal hoga?
Commit kaha tumnai, roll back kaha, transaction kaha sabko explain
karain
Database schema banaya queries likhwaen 2 aik main join lag raha
tha aik main nhi, phir is main se hi 4 scenarios diye our is main 4
result btane thai
Inner join se
left join
right join
full outer join
cross join our outer join ka difference btao
Phir last main 9 balls wali game puchi 2 times main karo lighter
btao.
Phir discussion ki, maina sawal pucha what to see when choosing
first job
Mujhse pucha kahan kahan interview diya, kaafi guide kia.
Folio3 TEST not Interview
17 coding:

30 marks: edit distance


20 marks: insert node in binary search tree
15 marks: word wrap.. screen size dia hoga aur sentence, us
sentence ko torna hai aise ke screen size ki limit cross na kare
eg. sentence: the quick brown fox jumps over the lazy dog
screen size = 20

[1]=> jumps over the lazy

10 marks: prime number... 1st 100,000 prime numbers generate


karo marks rewarded on efficient approach
10 marks: hex to decimal converter

Database:

5 marks: define entity, attribute, relationship


5 marks: types of relationships explain all
20 marks: ERD of flight schedule system, passengers, flights un ki
bookings wagaira, seats arival departure etc

5 marks: duration of flights


5 marks: passengers travelling from one country to another
5 marks: agents who have not sold any ticket for a month
IQ:

- odd one out shapes and letters


- number sequences

- cottage problem

- mary was asked to subtract 3 from a number and divide by 9. she


subtracted 9 instead and divided by 3 which gave a result of 43
what would have been the result in the first approach
- 2/5 freshies and 4/5 sophos give a test in which freshies and
sophos were equal. how many sophos are there
- 3x3x3 cube ka aik problem tha ke usay glue se joray gay to 27
ayega aisa kuch tha
- Ralph likes 25 but not 24 he likes 400 but not 300 he likes 144 but
not 145 What does he like ?
10, 50, 124, 200, 1600
- John likes 400 but not 300; he likes 100 but not 99; he likes 2500
but not 2400.
answer: 900
Answers
N/A

• Maintainability
• Reusability

1.Abstraction
Abstraction is a process of exposing essential feature of an entity while hiding other irrelevant detail.
2.Encapsulation
Binding of data and code together while hiding the information is called encapsulation.
3.Inheritance
The ability of creating a new class from an existing class
4.Polymorphism
Function overloading and overriding

With abstractions you represent notions and ideas, rather than the concrete way these ideas are implemented.
An abstract class is a class which is declared abstract and can not be instantiated but they can be subclassed.

Abstract Class:
1 - An abstract class can have method body (non-abstract methods).
2 - An abstract class can have instance variables.
3 - An abstract class can have constructor.
4 - An abstract class can have static methods.
5 - You can extends one abstract class.

Interface:
1 - Interface have only abstract methods.
2 - An interface cannot have instance variables.
3 - Interface cannot have constructor.
4 - Interface cannot have static methods.
5 - You can implement multiple interfaces.
- The compilation process where source code is complied to machine code is know as complie time.
- When a complied program is being executed, it is known as runtime.
Compile time per
Runtime per
The short answer is that early (or static) binding refers to compile time binding(Overloading) and late (or dynamic)
binding refers to runtime binding (for example when you use reflection) (Overriding).
Overloading :
- When multiple function with same name but different signatures are defined.
Overriding :
- Same function in child class with different implementation
output: [0]=> the quick brown fox // ab is mai 19 characters hai screen size 20 hai aik aur word add karega to 20
ko

1 8 27 ? 125 216 yeh wala yaad hai mujhay aur bhi thay
exceed kar jayega to tu naya string bnayega
naya string bnayega
Interview # Question

1 1-FYP description
2- FYP erd n how data is saved
3- query on fyp db
3- 4 pillars of OOP
4- overloading n overriding
5- singleton
6- using one for loop join two sorted arrays.
After that 15 min HR interview.

2 -OOP ( Concepts of overloading and overriding )


-Code of reversing a string
-Erd bnwai
-Types of joins
-Database view bnwaya ERD ka
*****************************************
HR Interview (50 min)
-Who is Asad.
-Hobbies
-What you love and hate about yourself
-What you love and hate about FAST
-Random discussion on IT
-Then sheyou
-She said explained me about
have cleared systems
your limited
technical in great
interview. Wedetail
will mail you by
Thursday
-In the end she was like. I hope I sold you systems limited well
3 1) fyp erd.
2) queries related to my fyp erd 4-5.
3)inheritance.
4) polymorphism.
3)mvc, singleton pattern and advantages.
4) delegates.
5)view and session state.
Amd then hr interview of more than 1 hour
About fyp
4 4 pillars of oop
Encapsulation vs abstraction
Polymorphism
How to use function without creating its object
Types of constructor
Kashif khan ki burai grin emoticon
Erd of fyp
1 simple join query
1. FYP in detail discussion
5 2. why oop?
3. Inheritance
4. abstraction
5

3. polymorphism
4. code to find the duplicate letter in a string
5. link list
6. binary tree
7. depth first search
8. breadth first search
9. agar tree infinite bara hy hoskta hy woh depth mein ho and breadth mein ho tu
kese search karoge element?
10. what is OCR?
11. Diamond Problem? solution?
HR Interview hua 30mins ka.
System's Interview Questions
6 HR interview is going to be in english , so be prepared wink emoticon
Technical-
Fyp related question , libraries , functions etc jo jo kia hai
oop basics
oop Pillars
Polymorphism types , overriding , overloading
Prime numbers code
Session , cookies ,
how to maintain state in web application
truth table ki if then else statement , basically he wanted to see optimized code , but he
didnt ask for me , so agar koi bht easy question ajae to try to write optimized code , not
dirty working code
overloading ki return type change kr den to ???
derived class d = new base(); possible or not , benefits , i asked sir rafi , it is possible but
agar derived ka destructor call hogaya to base ka destrusctor call hone se reh jae ga ,
do check urself ,

-----------------------------------------
Table A has a,b,c .... Table B has 1,2,3
Select * from A,B.... what will be the result !!...

result a1,a2,a3,b1,b2,b3 -> its the query for the cartesian product
------------------------------------------------
Systems 1st Interview Questions
7 1) What are distributed Systems why do we need them.. What are disadvantages
2) What is Cluster
3) Socket Programming k baray me Questions
4) Questions on threads
5) What are Function Signatrue
6) Access modifiers .. What is their use
7) Extends keyword
8) Difference between runtime and compile time errors, how to avoid runtime errors
9) What is JIT
10) Define the use of interface
11) How much have you used database..
12) Explain all types of Join
13) What is Association
14) What is Composition
15) What is the name of Amazon EC2 cloud.. Microsoft? IBM?
16) Name microsoft's Cloud Service
17) Have you used any cloud ?
18) Explain Design Patterns (Shit mene to course hi nahi liya tha :P)
19) Does java support passing by reference?
20) Use of Super in java
21) can a thread be called .start() twice ?
22) what is singleton.....
Answers
-
-
-
https://standardofnorms.wordpress.com/2012/09/02/4-pillars-of-object-oriented-programming/
In this table, the asymptotic notation O(f(n)) means "not exceeding some fixed multiple
of f(n) in the worst case."
Interview # Question
(http://en.wikipedia.org/wiki/Search_data_structure) and also
(http://en.wikipedia.org/wiki/Best,_worst_and_average_case)
Asymptotic amortized worst-case analysis
Unsorted array
Sorted array
Unsorted linked list
Sorted linked list
Self-balancing binary tree
Heap
Hash table
Trie
1 Explain Your FYP.
Explain Inheritance.
What is Virtual Function and describe its advantages.
what is Hash Functions and how we can enter values in hash table.
what is Dictionary.
write a code for Binary Search Tree.
You have an array write a code to find whether the given value is in the array or not.
define its complexity.
can its complexity be reduced? write a code.
writehave
you recursive code
a store for this
in which case.
there are 3 entities a) store. b) product. c)category. create
erd diagram.
there are multiple stores write a query to write all the category names for each store.
How would you create a class of Hash Table?
Write a code to find the largest contiguous sum in an array
Write a code to find whether a string is palindrome or not

Where local variable will be declared ? stack or heap ?

what is the difference b/w stack and queue

what is difference between virtual and pure virtual function?


What's your part in FYP.
2
Model the following using OOD:
- Forest (Consist of tree)
- Mango Trees
- Apple Trees
2

public class A {
void method(){
System.out.println("Class A");
}
}
public class B extends A {
void method(){
System.out.println("Class B");
}
int method(){
return 1;
}
}
main(){
// Output the following
A a = (B) new A();
A a1 = (A) new A();
A a2 = (A) new B();
B b = (B) new A();
}
Dictionary(key,value) where key is an object of class A and B previous class. Do we have to
take care of something to use Object as key ?

How BFS and DFS works.

Space and time Complexity of BFS and DFS.


What is a thin and thick client?

When to use transactions ?

Given two sql statements which should be executed in in single transaction apply try catch
block.

try{
}catch(e){
}
finally{
//close Database Connection here
}
what happens when something went wrong while closing connection.
Write a function for validating en email address.
What is the complexity of the following
for(int i=0; i< array.length; i++)
{
//some work on whole array here
}
What is the complexity of the following
function f(){
for(int i=0; i< array.length; i++)
{
//some work on whole array here
}
for(int j=0; j< array.length; j++)
{
//some work on whole array here
}
}

What is the complexity of the following:


for(int i=0; i< array.length; i++)
{
for(int i=0; i< array.length; i++)
{
//some work on whole array here
}
}
Which design patterns have you studied?
When there could be a problem while using singleton pattern.

What is the difference between factory method and abstract factory pattern.

Explain Android life cycle.

Show implementation of singleton design pattern

3 1. Complexity of linear Search

2. Complexity of Binary Search

3. Can we apply binary search in link list


4. Where local variable will be declared ? stack or heap ?
5. If you want to search a name which data structure you will use? hash map, hash table or
dictionary.
what is the difference b/w stack and queue

if you want to perform fastest insertion which data structure you will use
How does run-time binding happen? Whats a virtual table? How does it work?

Can a custom class object be used as a key in a hash table?


How to resolve an OS deadlock?

Does OS help with allocating an array if no contagious memory available?


1 CV daikhi... Piano bjaana aata hay ? Nice yaar grin emoticon
4 2 Internship kyu nhi ki kahin?
Me: Vacations are not supposed to be ruined
3 Abstract and Interface main difference
4 What are Static variables and functions
5- Concept of Polymorphism and Virtual Functions
public class A {
void method(){
System.out.println("Class A");
}
}
public class B extends A {
void method(){
System.out.println("Class B");
}
int method(){
return 1;
}
}
main(){
// Output the following
A a2 = new A();
A a = (B) new A();
B b = (A) new B();
}
6 Char [][] aur Char ** main kiya farq hota hay ?
7 Kia Char [][] aur Char** ki performance main farq hota hay?
8 Write a code which converts string "12345" into an integer 12345
9 Difference b'w HashMap and Hastable.

10 What is a Hash code ?//I said I forgot. He said daikh leina. Yh pata hona chahiyh
11 In sorting algorithms what can be the lowest worst time complexity
12 What will be the time complexity to Search a number in an array
13 What if that array is sorted ? Will it help to lower the complexity?
14 Can you make the searching part better ?
11-14 ----- Iss main woh kaafi ooper se araha thay.
15 Design Pattern parha hay?
Me: Jee sayed yousuf parha rahay hain
He: Tumhari uni main k students ko daikh k toh nhi lagta k unn k students hain
(Bezzati hogyee)
16 Singleton ka code likho
17 Threading ka issue ayega ? . Kesey resolve karogey ?
18 Type of joins?
19 Self join use kar k btao?
20 Doubly aur Singly linked list main differences btao
21 Linked List reverse karnay ka code likh saktay ho?
Me : Yess
He : Likhdo
22 Singly linked list ko reverse karnay main issue kia hay?
23- OOP, DS, DB, DP hogyaa. Theek hay.. Interview hogya hay tumhara
Workforce final interview/discussion with director
1. Aik external library use kr rae ho usme bugs hain i/o p error deta. Usko apne pas
use krna h tmko to kia kroge k sahi chale and crash na ho
2. OS ki batain
Goto vs func call in os
Aik code kese work.krega
Dynamic bind and late bind using external libraries and local code + .class file m late
bind kese show hoga
.class ki batain kia hota kese hota code execute kese hota etc
3. Workforce k baare m kia jante ho.
4. Expected salary
Baqi normal sawal k apne bare m btao plans btao etc
Workforce 1 hour 30 mins interview
6 1 - Explain your FYP.
2 - What's your part in FYP.
3 - Model the following using OOD:
- Forest (Consist of tree)
- Mango Trees
- Apple Trees
4 - public class A {
void method(){
System.out.println("Class A");
}
}
public class B extends A {
void method(){
System.out.println("Class B");
}
int method(){
return 1;
}
}
main(){
// Output the following
A a = (B) new A();
A a1 = (A) new A();
A a2 = (A) new B();
B b = (B) new A();
}
5 - Dictionary(key,value) where key is an object of class A and B previous class.
What we have to take care of something to use Object as key ?
6 - How BFS and DFS works.
7 - Space and time Complexity of BFS and DFS.
8 - What is a thin and thick client?
9 - When to use transactions ?
10 - Given two sql statements which should be executed in in single transaction apply
try catch block.
11 - try{
}catch(e){
}
finally{
//close Database Connection here
}
what happens when something went wrong while closing connection.
12 - Write a function for validating en email address.
13 - What is the complexity of the following
for(int i=0; i< array.length; i++)
{
//some work on whole array here
}
14 - What is the complexity of the following
function f(){
for(int i=0; i< array.length; i++)
{
//some work on whole array here
}
for(int j=0; j< array.length; j++)
{
//some work on whole array here
}
}
16 - What is the complexity of the following:
for(int i=0; i< array.length; i++)
{
for(int i=0; i< array.length; i++)
{
//some work on whole array here
}
}
17 - Which design patterns have you studied?
18 - When there could be a problem while using singleton pattern.

19 - What is the difference between factory method and abstract factory pattern.
20 - Explain Android life cycle.
1-
7 how to detect if a linked list is circular, without going through all the nodes?
2-
code of singleton.
3-
classA
{
func 1(){}
func2(){}
};
classB
{
func2(){}
func3(){}
};
main()
{
A a= new B();
a.fun2(); // ????
}
1- Explain Your FYP.
8 2- Explain Inheritance.
3- What is Virtual Function and describe its advantages.
4- what is Hash Functions and how we can enter values in hash table.
5- what is Dictionary.
6- write a code for Binary Search Tree.
7- You have an array write a code to find whether the given value is in the array or
not.
8- define its complexity.
9- can its complexity be reduced? write a code.
10- write recursive code for this case.
11- you have a store in which there are 3 entities a) store. b) product. c)category.
create erd diagram.

12- there are multiple stores write a query to write all the category names for each store.
Workforce 30-45mins interview
9 Oop concepts:
Composition
Abstraction
Abstraction with casting
DS concepts:
Complexities
Sorting Algos
Code:
Anagram ka code
String to int ka code
Code ko efficient bnana
Design Patterns:
Singleton etc
1. Complexity of linear Search
10 2. Complexity of Binary Search
3. Can we apply binary search in link list
4. Where local variable will be declared ? stack or heap ?
5. If you want to search a name which data structure you will use? hash map, hash
table or dictionary.
6. what is the difference b/w stack and queue
7. if you want to perform fastest insertion which data structure you will use
Answers

Insert Delete
O(n) O(n)
O(n) O(n)
O(1) O(1)
O(1) O(1)
O(1) O(1)
O(1) O(1)
Dictionary is an abstract data type composed of a collection of (key, value) pairs, such
O(1)
that each possible key appears just once in the collection.
O(1)
In object-oriented programing (OOP) inheritance is a feature that represents the "is a"
O(m) O(m)
relationship
Operations
// initiallyit calledbetween
associated different
with low with
= 0,thisclasses.
data
high Inheritance
type
= N-1 allow allows a class to have the same
Explain
behavior as another class and extend or tailor that behavior to provideclass
special
BinarySearch(A[0..N-1], value, low,
It is a function whose behavior can be overridden withinhigh) { an inheriting by aaction for
function
specific
the
withaddition
//the needs.
invariants:
same (http://www.webopedia.com/TERM/I/inheritance.html)
of signature.Advantages
pairs to >the
value collection
A[i] for all i <on
lowlink below
the removal ofvalue pairs<from theall
A[i] for collection
i > high
(http://stackoverflow.com/questions/2391679/why-do-we-need-virtual-methods-in-c)
the modification
if (high < low)of the values of existing pairs
the lookup return ofnot_found
the value associated
// value would withbea inserted
particularatkey
index "low"
for(int
String =i=0;i<arr.length;i++)
(http://en.wikipedia.org/wiki/Associative_array)
midoriginal,(low +reverse
high) / 2= "";
{ Scanner
ifif(arr[i]==no_to_find)
(A[mid] in >= value)
new Scanner(System.in);
http://algs4.cs.princeton.edu/32bst/BST.java.html
{ return
cout<<"no found at index==>"<<i<<endl;}
BinarySearch(A, value, low, mid-1)
}else if (A[mid] < value) a string to check if it is a palindrome");
System.out.println("Enter
N original return=BinarySearch(A,
in.nextLine(); value, mid+1, high)
else
Yesint using
return
length binary
mid search but array must be sorted
= original.length();
}(http://rosettacode.org/wiki/Binary_search)
Make foras ( int
you i =wish
length - 1; i >= 0; i-- )
reverse = reverse + original.charAt(i);
depends on your erd
if (original.equals(reverse))
http://www.algolist.net/Data_structures/Hash_table/Simple_example
System.out.println("Entered string is a palindrome.");
http://www.geeksforgeeks.org/largest-sum-contiguous-subarray/
else
System.out.println("Entered string is not a palindrome.");
local varaibles are created at stack (
http://gribblelab.org/CBootcamp/7_Memory_Stack_vs_Heap.html )
Stack is LIFO (Last In First Out) the last element you entered would be accessed first
and Queue is FIFO (First in first Out) the element you entered first would be accessed
first.

For a virtual function you need to provide implementation in the base class. However
derived class can override this implementation with its own implementation. Normally ,
for pure virtual functions implementation is not provided. You can make a function pure
virtual with =0 at the end of function declaration. Also, a class containing a pure virtual
function is abstract i.e. you can not create a object of this class.
Describe your role

to be determined
to be determined

to be determined

BFS explores/processes the closest vertices first and then moves outwards away from
the source. Given this, you want to use a data structure that when queried gives you the
oldest element, based on the order they were inserted. A queue is what you need in this
case since it is first-in-first-out(FIFO). Whereas a DFS explores as far as possible along
each branch first and then bracktracks. For this, a stack works better since it is
LIFO(last-in-first-out) (http://stackoverflow.com/questions/3929079/how-can-i-
remember-which-data-structures-are-used-by-dfs-and-bfs)

BFS:

Time complexity is O(|V|) where |V| is the number of nodes,you need to traverse all
nodes.
Space complecity is O(|V|) as well - since at worst case you need to hold all vertices in
the queue.

DFS:

Time complexity is again O(|V|), you need to traverse all nodes.


Space complexity - depends on the implementation, a recursive implementation can
have a O(h) space complexity [worst case], where h is the maximal depth of your tree.
Using an iterative solution with a stack is actually the same as BFS, just using a stack
instead of a queue - so you get both O(|V|) time and space complexity.

(*) Note that the space complexity and time complexity is a bit different for a tree then for
a general graphs becase you do not need to maintain a visited set for a tree, and |E| =
O(|V|), so the |E| factor is actually redundant.
(http://stackoverflow.com/questions/9844193/what-is-the-time-and-space-complexity-of-
a-breadth-first-and-depth-first-tree-tr)
A thin client (sometimes also called a lean, zero or slim client) is a computer or a
computer program that depends heavily on another computer (its server) to fulfill its
computational roles. A fat client (also called heavy, rich or thick client) is a computer
(client) in client–server architecture or networks that typically provides rich functionality
independent of the central server. Originally known as just a "client" or "thick client
(http://en.wikipedia.org/wiki/Thin_client &&&&& http://en.wikipedia.org/wiki/Fat_client)

Transactions should be used when there is the possibility that either failure to complete
or someone else reading or writing in the middle of your task could cause damage to the
data. These include but are not limited to:

Reading from a table for subsequent deletion


Writing related data to multiple tables
(http://stackoverflow.com/questions/2159045/when-should-i-use-transactions-in-my-
queries).

BEGIN TRANSACTION [Tran1]

BEGIN TRY

INSERT INTO [Test].[dbo].[T1]


([Title], [AVG])
VALUES ('Tidd130', 130), ('Tidd230', 230)

UPDATE [Test].[dbo].[T1]
SET [Title] = N'az2' ,[AVG] = 1
WHERE [dbo].[T1].[Title] = N'az'

COMMIT TRANSACTION [Tran1]

END TRY
BEGIN CATCH
ROLLBACK TRANSACTION [Tran1]
END CATCH

GO

to be determined

n
n

n^2
tell your studied pattern
In multithreading there can be a deadlock

http://stackoverflow.com/questions/5739611/differences-between-abstract-factory-pattern-and-factory-method

http://stackoverflow.com/questions/8515936/android-activity-life-cycle-what-are-all-these-methods-for

class Singleton
{
private static Singleton _instance;

// Constructor is 'protected'
protected Singleton()
{
}

public static Singleton Instance()


{
// Uses lazy initialization.
// Note: this is not thread safe.
if (_instance == null)
{
_instance = new Singleton();
}

return _instance;
}
}

o(N)
O(log(n))
yes you can use skip list
(https://msdn.microsoft.com/en-us/library/ms379573(v=vs.80).aspx)
already answered above
Dictionary
Alredy answered above
binary search tree (http://stackoverflow.com/questions/17647607/what-data-structure-
supports-fast-insertion-deletion-and-search )
Balance Get at index Search Find minimum Find maximum Space usage
N/A O(1) O(n) O(n) O(n) O(n)
N/A O(1) O(log n) O(1) O(1) O(n)
N/A O(n) O(n) O(n) O(n) O(n)
N/A O(n) O(n) O(1) O(n) O(n)
O(log n) N/A O(log n) O(log n) O(log n) O(n)
O(log n) N/A O(n) O(1) O(n) O(n)
O(n) N/A O(1) O(n) O(n) O(n)
N/A O(n) O(m) O(m) O(m) O(n)
Interview # Question

1 40 mins interview at VENTURE DIVE


1. FYP in detail.
2. Pillars of OOP.
3. Explain all pillar of OOP with example.
4. Interface VS Abstract
5. Mutable and imMutable
6. Asp .net MVC working
7. Explain WCF and Why we use it ?
8. What is Contract in WCF , Explain each of them?
9. Tell Web Invoking methods and what are the purpose of it ?
10. Hashing and Why we use hashing
11. ArrayList Vs Array Vs List
12. When to use array and when to use arraylist?
13. Singleton and its implementation
14. Primary key vs Unique key
15. Indexing
16. What will be the impact of indexing on CRUD operations?
17. One database Schema and define its relation
18. Relation of Inheritance and Composition
19. One Logical question.
20. 2 programming question (just check the logic)
21. What are joins?
22. Normalization and De-normalization
23. What will be the impact of query on normalized database
24. Anomalies ?
and many others questions (JO YAAD NAHI :P)
Venture Dive Interiview today: 15-20 minutes
2 - Pillars of OOP
- Cat object inheriting from Animal, which of the following are legal ?
Animal a= new Animal()
Animal a= new Cat()
Cat a= new Animal()
Cat a= new Cat()
- Describe Singleton, how do u initialize singleton to be thread safe?
- What is Threading
- Why do we need threading?
- Will u prefer threading for CPU intensive or IO intensive tasks?
- What is indexing
- What are primary key, unique key and foreign key
- If i add foreign key colum on Employee table for Department Id but forget to
declare a constraint , what will be the effect on database?
- Logic Question, 9 balls, 1 is heavy, what are the minimal worst case tries u
need?
Venture Dive Technical Interview
Explain FYP
Difference b/w Struct and Class
Encapsulation, Abstraction and Polymorphism ; reasons for them
Overloading and Overriding

Set Datastructure
Mutable and Immutable
Builder Design Pattern

Write String Builder Syntax in Java.. can assume methods name

StringBuilder sb = new StringBuilder(new String("VentureDive"));


Sb. append("yes"); //he was just seeing the semantics, not syntax
String s = sb.toString();
Can you write it in single line?
String s = new StringBuider(newString("Venturedive")).append("yes").toString();
What are indexes?why indexing? overhead?

denormalization? and why


One simple Query; Group by was used

Program to get duplicate integers from an int array

Logical Question 1 :
There are three boxes, one contains only apples, one
contains only oranges, and one contains both apples and oranges. The
boxes have been incorrectly labeled such that no label identifies the
actual contents of the box it labels. Opening just one box, and without
looking in the box, you take out one piece of fruit. By looking at the
fruit, how can you immediately label all of the boxes correctly?
Logical Quesiton 2: You have to measure exactly 4 liters of water, but you only have a 3-
liter bottle and a 5-liter bottle.
How do you do it?
get
IP Pooling
And some other questions...

Venture Dive - Android


what is serialization?
Difference in interface and abstract class?
Logic: Cut a pizza in 8 pieces what will be the minimum number of steps required.
Arrange a string in reverse order
concept of singleton
multiple inheritance in java

4 Venture Dive
define oop pillars with eg
dif dw abstract and interface
diff bw thread and prcess
what is deadlock
views
manay to many relation in stud andy course
singleton
muteable and imutable string
big o notation
write aprogram which find pair of odd no and returen the index of frist oddin pair handle
all the cases
multiple inhertance in java
constructor
fyp
Answers

-
Encapsulation, Inheritance, Polymorphism, Abstraction
https://standardofnorms.wordpress.com/2012/09/02/4-pillars-of-object-oriented-programming/
Comparable and Icomparable interface
n Question

1 Trg tech 1st 45 min technical interview:


1. about yourself.
2. fyp around 10 min discussion.
3. Design patterns.
singleton when to use and benefits.
MVC when to use and benefits.
Observer apply observer pattern on slate.
4. Database.
normalization.
one scenario jisko normalize krna tha.
execution plan in sql?
unique key vs private key.
5. OOP Basic concepts with one code example.
print triangle i.e.
*****
***
*
6. difference between get and post in php.
and couple more questions that i cant remember.
2 Trg personality
Q. How interview.
many litres of petrol will be consumed by Karachi in month of april 2015.
Assume population to be 20million.
3 Trgtech Technicle (2 rounds)
1st Round: 1hour
1 algorithm statement...
Started with O(n square) to O(nlogn) to O(n)
1b. Another Algorithm with only a twist in 1st Algorithm
2. Another Algo Related to String Subsequence
------------------
2nd Round: 30 minutes after 15 min break
-> Mostly about every single project thats there on my CV, like literally
-> 1 algorithm , regarding longest substring from List of String,.... no optimization
asked
-> 1 basic db query
Answers
Interview # Question

1 1- What is wi??
Write a detailed code which shows polymorphism.
2- What is Abstract class??
3- Does Interface class is an abstract class??
4- What is Normalization
5-
6- What are
Write a anomalies??
code with correct syntax of reversing string given in char[] array
"hello"
7- Write a code for reversing words order "Hello I am here" to "Here I am
hello"
8- Make ERD
9- Write Query to that ERD which contains Join and aggregate function...
Answers
Interview # Question

1 40 mins 2nd interview at SOFTECH


1. Code of QUEUE class (after code, array se q nahi kya? list se q kiya?)
2. Code of Recursive Fibonacci
3. Overloading and Overriding in detail (Pakk gya ta itny sary sawal se)
4. Classes VS Structs
5. Try & Catch Block scenario
6. Stored Procedure
7. Types of Joins
8. What is left outer join
9. Encapsulation & Abstraction
10. Interface & Abstract
11. What is Access modifier
12. Many codes of OOP and asked cross question
13. Singleton.
14. Sealed Keyword in C#
15. Static variable and Static Function and Static Class
16. Hashmap in DS
17. I have sorted array and hashmap and I need one value , Which one is faster ?

2 25 mins interview at SOFTECH WORLD WIDE and 1.5 hours HECTIC Test.
1. FYP in detail.
2. what is query string ?
3. what is [HttpPOST] and [HttpGET] ?
4. [HttpGET] se bhi to POST kr sakty ?
5. Page life cycle of ASP .NET MVC ?
6. What is Address , Binding and Contract in WCF?
7. What is Contract and its type ?
8. What is Application Object in .NET ?
9. What is Decision Tree ?
10. How Business Analysis tool i.e SQL SERVER ANALYSIS SERVICE
work ?
11. Past academic projects done in .NET , define them?
12. What is session ?
13. What if we don't have sessions ? any solution for it
and many other chotay motay questions jo yad nahi ..
25 mins interview at SOFTECH WORLD WIDE
3 Code: Compute nth power of number recursively.
Code: Asked from another guy Reverse a String.
1) What projects have you done state your role.
2) Explain FYP
3) Explain Networking Project #NadeemKafi
4) Explain Working of Hadoop
4)Stack vs Heap http://www.programmerinterview.com/…/difference-between-
st…/
and that's all folks...
delegates
4 swapping code
prime numbers
Interfaces n abstract class ka code sample likhwa bhi sakta hai n whether they inherit
each other or not
fibonacci code
linked list
stacks
queues
memory management
such as stack memory heap memory
recursion
fyp
ur main focus
Softech 1st Interview
5 1- FYP kia hai
2- Basic principles of oop
-abstraction and encapsulation
- polymorphism with example
3- Pass by ref and value
4- Exception handling
5- Code to detect Prime no or not
6- Code for find factorial (both recursive and iterative)
Softech 2nd Interview
6 1-FYP pocha in detail.
2- Meray android project ka pocha in detail
3- diff between enumeration and iterator
4-OOP principles
-Polymorphism,Abstraction,inheritance,Encapsulation
5- types of overloading & overriding
6-differnce between arrays and list
7- jvm
8- jdk
Answers
Interview # Question

1 Game Developer Technical Interview1) Tell me about yourself?


2) Why Gaming? and why specifically 10pearls?
3) OOP?
4) Pillars of OOP?
5) FAST sai ho, design patterns tou achay aatay hi hon gai? kitny yaad hain, name bato?
6) Singleton? Game mai kabhi use kiya hai? aur agr nai tou kuin?
7)
8) Unity3d
Game maimaiphiysics
kitna experience hai?
kaisay lagti ray
hai? casting
apnay FYPkya hoti
mai hai? lagai hai? aur zaroorat kuin
kahan
pari? koi aur tareeqa nai hai kya?
9) 2d ya 3d? kya prefer karty ho?
11) Ab IQ bhi check kar laitay hain, thora sa, sirf aik sawal, 9 balls hai, same shape and
10) FYPbut
weight, maione
AI lagai hai?
slightly heavy, 1 balance hai tumharay pas, min kitny steps mai tum
gurantee kar sakty ho k konsi odd ball hai?
12) Working in team? or individual? Gussa aata hai, jab aana chahiay?
... aur bhi questions thai, yaad nai kafi :( 25-30 min ka hoga interview

2 Game Developer HR 1 interview


1)
2) Tell something
10pearls about
k baray yourself?
mai kisi khaas tarekay sai pata chala, ya waisay hi jaisay sab ko pata
chalta hai?
3) Game passion hai? pata hai na market nai Pakistan mai game ki?
4) Graduate kab ho rahay ho?
Note: At the
5) Salary end
kitni? HR
Min wali boli k last batao minimum kitni salrary? mai nai kaha k 45k
batao?
min, 10pearls k interview k lia aaya hn tou mujhay lagta hai k mery talent k hisab
aur mujhay
sai kuch general
rewardnonmilay
technical questions,
ga, wo boli fairwo bhi yaad
enough nai :( hum FAST sai CVs ko
:) waisay
1) It was discussion of around 20 mins, baat karty karty achanak saibatain
kuch poch laitako
tha,
3 check
Game
like tum
kar
Dev
nai
rahay
kaha
hain,
interview
k head
tou ab
withgesturehum
Project sai unko
Manager
car
evaluate
tun hoti hai,
karnay
tou wo
k baad
ulat tou nai
status, agar aap ki graduation k waqt humary pas aap k hisab sai koi opening hogi
gai aap
jati? acha agar
mai chahon
tou aap k wo dain
ko bata ulty tou
gai,kaisay karogai?
until then its our last meeting, in case humara jawab nai
aaye tou sorry :) Best of Luck :)
Answers

min 2 steps.
Interview # Question

1 Difference between abstract class & interface class.


Inheritance (sami wala scene k derived class instance can't call constructor of base class)
3. Why do u need interface class when u have abstract class
4. Palindrome
5. You have a wala
stringprogram
of alphabets, sort it in alphabetical order, and if any alphabet is
repeated, delete that
6. Swap 2 variables WITHOUT using a 3rd variable.
7. You have an int 12345, convert that int into 54321 by using math operations only
8. Pointer aur double pointer mein kya farq hai
9. Virtual inheritance kya hoti hai
10. ERD of student,courses,teachers (sab k beech mein many-to-many relationship tha)
11. Self Join ki query likhni thi
12. What is a cloud.
13. What is socket programming.
14.
15. Difference betweencollector?
What is a garbage stored procedure & function
Why do we use garbage collector when we have a
destructor
16. KuchBIQinherits
1) Class questions bhiAthay
Class with boht classes having foo function printing their class names
2 now what will be th output of following.. A a = new B() and B b = new A()
a) a.foo();
b) b.foo();
2) delete a node from linked list.
3) Breath first search algorithm.
4) Threads and Processes , race condition and locks.
5) What if class is static? what if function is static?
6) Interface vs Abstract class
7) Pros and cons of Arrays and linkedlist.
8) What if hashing produce same index?
9) Recursive Factorial function
10) final keyword in java.
11) Inner class concepts.
12) garbage collector.

write a code for the output;


here N = 4;
*
**
***
****

and also for reverse


what are obejcts?
3
Define data, database, datawarehouse, facts, dimensions, star and snowfleak scehma,
difference
what btwn union
are source vs union
system, all, olap
transaction vs oltpbetween
, realtion , procedure vs function
them,

3 simple sql queries and 3 IQ

4 2nd technical interview at streebo related to database and dwh mostly along with
personal characteristics.. updated....
4
After 2nd interview their will be 1 discussion session and then again a final
interview... smile emoticon
Answers
Abstract may have implemented method, but interface doesn't have any

Interface can help you in multiple inheritance / behavior wala scene

Depends on language to language


S No Question

1 About Fyp
ERD / Implementation of fyp
2,3 joins query
2,3 subqueries
1:m relationship and foreign key
m:m relationship and how many tables and why?
Polymorphism
12 balls ,11 with equal weights ,find the heaviest in 3 turns
what is the angle between the arrows of a clock at 3:15
polymorphism
Logic / Code to Find if a number is power of 2

2 About fyp
Implementation of fyp
Android activity lifecycle
diff btw android activity and fragment
android storage types
Intent in android
Database with two tables (books and author) 1:m relationship
how many tables in 1:m relationship
what is candidate key,composite key
same table with m:n relationship and how many tables in m:n relationship
4 pillars of oop
polymorphism

3 Define your FYP


Your Favorite Subjects
Make program for calculating Square root without using any math library
Design Database for School Managamenet System (Teacher, course and students)
Is this database normalized? isnt it violating NFs?
Write query which views Students studying by the same teacher
Compiler Construction: How did you perform parsing?Which Grammar rules have you used
in your project
Your future aims & ambitions

4 Introduce yourself

Define your FYP


What technology it has been built on?

You have a 3 Litres and a 5 Litres bucket of water. How will you fill 4 Litres in one of the
bucket
How do you find equilibrium index in an array i.e. the index where sum of its previous and
remaining elements is same

Whats is static? is there any restriction for static functions to use members of class? why?

Difference between Interface and Abstract


What are Virtual Functions?Their use? any examples?
what is composite key?
what are Outer Joins? left join? right join
when Outer joins exists so whats the purpose of inner joins? what is the difference b/w
them
What is self join? examples?
Introduce your self
5 Define your fyp
write a mvc
Define code to reverse individual words

what is stored procedure and what are its advantages


i put a bacteria in a jar after 1 minute bacteria break into two after an hour bacteria is full of
jar tell me the time when it is half

futre plans

6
3rd interview at Techlogix: You will be interviewed by one of the founders of the
company. Revise your FYP and make sure you can explain its working in detail. No
other technical questions. Just general discussion on life goals and academic life.
Techlogix two technical interview questions
7 First they will ask you to define yourself.

Then ask about FYP in detail. How many members, what technology,members etc
OOP
1. Difference between Abstract and Interface class, when to use which?

2. What is Heap vs stack memory allocation, disadvantage and advantages of both


3. What is Final variable?
Database
1. What is views and when to use it?
2. Advantages and disadvantages of too many indexes.
3. Differences between procedure and function
4. ERD diagram of your database project
5. Foreign Key constraints.
6. Can Foreign Key be NULL.
7. Inner and Outer Join, difference between both
8. How to find the second highest salary from an employee table
9. What is normalization of Database?
10. Why do we need to de-normalization
Programming
1. How to find if string is palindrome?
2. How to find if number is power of two?
3. Can you find square root of a number using arithmetic operation?
IQ question
1. 9 ball with 8 have same weight, you have to find the heavy ball using weight
three times.
2. Lion tell lie on first three days of the week, unicorn tell lie on next three days,
both tell truth on sunday. One day lion says that i was telling lie yesterday, unicorn
said, so do i. What is this day
Behavioral Questions
Your goals
Why CS
Why FAST
What is your weakness
What is your strength

What do you prefer between working on new technology or mastering the old.
Hobbies
What you do in leisure time.
Apart from domain you are interested, what else you want to do

After both interview, they ask if I have any questions about the company or so
Techlogix two technical interview questions
8 Define yourself,
Make Library Database System, with two tables, (student and books) and query it
using join
When to normalize and when to denormalize database.
Write program of finding square root of a number.
What are your fav subject,
What technologies have you work on,

When to use stored procedure and when to use user defined procedure in databse.
Why need RDMS.
Why RDMS are slow.
What is your FYP
Make database of your project
How will you prevent race condtion. If you implement a lock, it will not be scalable
anymore.what will you do ?
Define inheritance to a 3 year old child
Define ACID properties of database
9 You have 4 pillars of OOP. What is the feature of programming language that you will want
to add as a 5th pillar of OOP
What is MVC ?
What is Web Service ?
Why Techlogix ?
Any Questions ?
Answers

1
1
1
1
Do mention the questions asked while going for another job switching interview
Question
hile going for another job switching interview
Answer
1

3
4
5
6
7
8
9

10
11

12

13

14
15

16

17
18
19

20
21

22
23
24
25

26
27
28
armstrong=armstrong*armstrong*armstrong;
result=result+armstrong;
}
if(result==check){
cout<<check<<" is an Armstrong Number";
}
else{ C++ Codes
C++ cout<<check<<"
PROGRAM TO CHECK is NOT GIVEN
an Armstrong
NUMBER Number";
IS ARMSTRONG NUMBER OR NOT
}
return 0;
}
/*
program : Decimal to binary.
description : to convert decimal number between 0 to 255 to binary */
# include <iostream>
#include <math.h>
using namespace std ;
int main()
{
unsigned short int x=0,b=128 ,z=0,a=8 ;
cout<<"please enter the number between 0 and 255 \n";
cin >> x;
if (x>255)
cout<<" out of range ";
else
{
cout << x <<" converted to binary number :" ;
while (a!=0)
{
z=x*b ;
if (z==128)
cout << "1" ;
else
cout << "0";
x=(x << 1);
a-- ;
}
}
cout<<"\n";
system("pause");
return 0 ;
}
Hexadecimal number to Decimal Number

#include"conio.h"
#include"stdio.h"
#include"string.h"
#include"math.h"
int main()
{
char hex[25];
int i,j,num,len,counter=0;
long int sum=0; //value can cross range of int
printf("\nEnter the hexadecimal number: ");
gets(hex);
strupr(hex); //so the program becomes independent of string case
len=strlen(hex);
for(i=len-1;i>=0;i--)
{
if(hex[i]>='0'&&hex[i]<='9')
num=hex[i]-'0'; //the character is number in between 0 to 9
else
{
if(hex[i]>='A'&&hex[i]<='F')
num=hex[i]-55; //the character is either a,b,c,d,e or f
else
{
printf("The Entered number is not hexadecimal number");
getch();// If the character is beyond 'f'
return 1;
}
}
sum=sum+pow(16,counter)*num; //according to formula given by the link
counter++;
}
printf("Hexadecimal conversion of %s to decimal is %ld",hex,sum);
return 0;
}
Binary Tree
class BSTNode
{
private:
int value;
BSTNode *left;
BSTNode *right;
public:
BSTNode (int x)
{
value = x;
left = right = NULL;
}
int GetValue ()
{
return value;
}
BSTNode *leftchild ()
{
return left;
}
BSTNode *rightchild ()
{
return right;
}
void Addleftchild (BSTNode *node)
{
left = node;
}
void Addrightchild (BSTNode *node)
{
right = node;
}
bool isleaf ()
{
return ((left==NULL) && (right==NULL));
}
bool isleftchild(BSTNode *node)
{
bool found = false;
if (node != NULL)
{
if (this->leftchild() == node)
{
return true;
found = true;
}
else
{
return found;
}
}
}
bool isrightchild(BSTNode *node)
{
bool found = false;
if (node != NULL)
{
if (this -> rightchild() == node)
{
return true;
found = true;
}
else
{
return found;
}
}
}
};
class BSTree
{
private:
BSTNode *root;
void PreorderVisit (BSTNode *node)
{
if (node != NULL)
{
Visit (node);
PreorderVisit (node -> leftchild ());
PreorderVisit (node -> rightchild ());
}
}
void Visit (BSTNode *node)
{
cout << node -> GetValue () << " " ;
}

public:
BSTree ()
{
root = NULL;
}
void Add (int x)
{
bool inserted;
BSTNode *node, *curr;
node = new BSTNode (x);
if (root == NULL)
{
root = node;
}
else
{
inserted = false;
curr = root ;
while (!inserted)
{
if (node -> GetValue() < curr -> GetValue())
{
if (curr -> leftchild() == NULL)
{
curr -> Addleftchild (node);
inserted = true;
}
else
{
curr = curr->leftchild ();
}
}
else
{
if (curr->rightchild() == NULL)
{
curr->Addrightchild (node);
inserted = true ;
}
else
{
curr = curr -> rightchild ();
}
}
}
}
}
void PreorderTraversal ()
{
BSTNode *node ;
node = root;
PreorderVisit (node);
}
};
Singly Link List

class LinkNode
{
private:
int info;
LinkNode *link;
public:
LinkNode(int x)
{
info=x;
link=NULL;
}
int GetValue ()
{
return info;
}
LinkNode* next1()
{
return link;
}
void Link (LinkNode *node)
{
link=node;
}
};
class SingleLinkList
{
private:
LinkNode *head;
public:
SingleLinkList()
{
head = NULL;
}
void AddToHead (int x)
{
LinkNode *curr, *node;
if (head == NULL)
{
head = new LinkNode (x);
}
else
{
curr = head;
node = new LinkNode (x);
head = node;
node->Link(curr);
}
}
void DeleteFromHead ()
{
LinkNode *temp;
temp = head;
head = temp->next1();
delete temp;
}
void AddToTail (int x)
{
LinkNode *curr,*node;
curr = head;
node = new LinkNode(x);
if(head == NULL)
{
head = node;
}
else
{
while (curr->next1()!= NULL)
{
curr = curr->next1();
}
curr->Link(node);
node->Link(NULL);
}
}
void DeleteFromTail ()
{
LinkNode *curr, *temp;
curr = head;
while (curr->next1()->next1() != NULL)
{
curr = curr->next1();
}
temp = curr;
temp = temp->next1();
curr->Link(NULL);
delete temp;
}
void SearchList (int x)
{
LinkNode *curr;
int index = 0;
int n = 1;
bool found = false;
curr = head;
while ((curr != NULL) && (!found))
{
index++;
if (curr->GetValue() == x)
{
found = true;
}
else
{
curr = curr->next1();
}

}
if (found == true)
{
cout << "Number " << x << " Is Present At Index " << index << " !!" << endl;
}
else
{
cout << "Number Not Found!!" << endl;
}
}
void CountElements ()
{
LinkNode *curr;
int count = 0;
curr = head;
while (curr != NULL)
{
curr = curr->next1();
count++;
}
cout << "Total Elements In a List Is: " << count << endl;
}
void GetElementAt (int x)
{
LinkNode *curr;
int count = 0;
curr = head;
while (curr != NULL)
{
count++;
curr = curr->next1();
}
if (count > x)
{
LinkNode *temp;
temp = head;
for (int i = 0; i < x ; i++)
{
temp = temp->next1();
}
cout << "At Index " << x << " Element " << temp->GetValue() << " Is Present!!" << endl;
}
else
{
cout << x << " Index Is Not Present!!" << endl;
}
}
void DeleteElement (int x)
{
LinkNode *temp,*curr,*temp2;
int counter = 0;
bool found = false;
temp = head;
while ((temp != NULL) && (!found))
{
counter++;
if (temp->GetValue() == x)
{
found = true;
}
else
{
temp = temp->next1();
}
}
if ((found) && (counter == 1))
{
LinkNode *temp;
temp = head;
head = head->next1();
delete temp;
cout << "The Element With Info " << x << " is Deleted!!" << endl;
}
if ((found)&& (counter > 1))
{
curr = head;
while((curr->next1() != temp) && (curr != temp))
{
curr = curr->next1();
}
temp2 = temp;
temp2 = temp2->next1();
curr->Link(temp2);
delete temp;
cout << "The Element With Info " << x << " Is Deleted!!" << endl;
}
else if (!found)
{
cout << "No Element With Info " << x << " Is Found!!" << endl;
}
}
void InsertSorted (int x)
{
LinkNode *curr, *prev, *node;
bool found = false;
node = new LinkNode (x);
if (head == NULL)
{
head = node;
}
else
{
curr = head;
while ((curr != NULL) && (!found))
{
if (node->GetValue() >= curr->GetValue())
{
prev = curr;
curr = curr->next1();
}
else
{
found = true;
}
}
}
if (curr == head)
{
AddToHead(x);
}
else
{
prev->Link(node);
node->Link(curr);
}
}
void Print ()
{
LinkNode *temp;
temp = head;
while (temp != NULL)
{
cout << temp->GetValue() << " ";
temp = temp->next1();
}
}
};
Doubly Link List
class Node
{
private:
int value;
Node *next;
Node *prev;
public:
Node(int e1)
{
value=e1;
next=NULL;
prev=NULL;
}
int GetValue ()
{
return value;
}
Node* next1()
{
return next;
}
Node* prev1()
{
return prev;
}
void Link (Node *node)
{
next=node;
}
void plink(Node *node)
{
prev=node;
}
};
class DoubleLinkList
{
private:
Node *head;
public:
DoubleLinkList ()
{
head=NULL;
}
void AddToHead (int e1)
{
Node *temp, *node;
if (head == NULL)
{
head = new Node (e1);
}
else
{
temp = head;
node = new Node (e1);
head = node;
node->Link(temp);
temp->plink(node);
}
}
void DeleteFromHead (int e1)
{
Node *temp;
temp=head;
head = temp->next1();
delete temp;
}
void AddToTail (int e1)
{
Node *curr, *node, *temp2;
curr = head;
node = new Node(e1);
if(head == NULL)
{
head = node;
}
else
{
while(curr->next1()!= NULL)
{
curr = curr->next1();
}
curr->Link(new Node(e1));
temp2 = curr->next1();
temp2->plink(curr);
}
}
void DeleteFromTail ()
{
Node *curr, *temp;
curr = head;
while (curr->next1()->next1()!= NULL)
{
curr = curr->next1();
}
temp = curr;
temp = temp->next1();
curr->Link(NULL);
delete temp;
}
void SearchList (int x)
{
Node *curr;
int index = 0;
bool found = false;
curr = head;
while ((curr != NULL) && (!found))
{
index++;
if (curr->GetValue() == x)
{
found = true;
}
else
{
curr = curr->next1();
}
}
if(found == true)
{
cout << "Number " << x << " Is Present At Index " << index << " !!" << endl;
}
else
{
cout << "Number Not Found!!" << endl;
}
}
void CountElements ()
{
Node *curr;
int count = 0;
curr = head;
while (curr != NULL)
{
curr = curr->next1();
count++;
}
cout << "Total Elements In a List Is: " << count << endl;
}
void GetElementAt (int x)
{
Node *curr;
int count = 0;
curr = head;
while(curr != NULL)
{
count++;
curr = curr->next1();
}
if(count > x)
{
Node *temp;
temp = head;
for (int i=0;i<x;i++)
{
temp = temp->next1();
}
cout << "At Index " << x << " Element " << temp->GetValue() << " Is Present!!" << endl;
}
else
{
cout << x << " Index Is Not Present!!" << endl;
}
}
void DeleteElement (int e1)
{
Node *temp, *curr, *temp2;
int counter = 0;
bool found = false;
temp = head;
while ((temp != NULL) && (!found))
{
counter++;
if (temp->GetValue()== e1)
{
found = true;
}
else
{
temp = temp->next1();
}
}
if ((found) && (counter == 1))
{
Node *temp;
temp = head;
head = head->next1();
delete temp;
cout << "The Element With Info " << e1 << " is Deleted!!" << endl;
}
if ((found) && (counter>1))
{
curr = head;
while((curr->next1() != temp) && (curr != temp))
{
curr = curr->next1();
}
temp2 = temp;
temp2 = temp2->next1();
curr->Link(temp2);
temp2->plink(curr);
delete temp;
cout << "The Element With Info " << e1 << " is Deleted!!" << endl;
}
else if (!found)
{
cout << "No Element With Info " << e1 << " Is Found!!" << endl;
}
}
void print ()
{
Node *curr;
curr = head;
while (curr != NULL)
{
cout << curr->GetValue() << endl;
curr = curr->next1();
}
}
};
Stack
#include <iostream>
using namespace std;
const int LIMIT = 10;
class stack
{
private:
int topposition;
int contents [LIMIT];
public:
stack ()
{
topposition = 0;
}
bool Isfull ()
{
if (topposition >= LIMIT)
{
return true;
}
else
{
return false;
}
}
bool Isempty ()
{
if (topposition==0)
{
return true;
}
else
{
return false;
}
}
int stacktop ()
{
if (!Isempty())
{
return contents[topposition -1];
}
}
void push (int x)
{
if (!Isfull())
{
contents [topposition]=x;
topposition ++;
}
}
int pop ()
{
int k = 0;
if (!Isempty())
{
topposition--;
k=contents [topposition];
return k;
}
}
};
int main ()
{
stack s;
s.push (2);
s.push (3);
s.push (4);
cout << "Top Position: " << endl;
cout << s.stacktop() << endl;
cout << "Pop" << endl;
cout << s.pop() << endl;
cout << s.pop() << endl;
cout << s.pop() << endl;

system ("pause");
return 0;
}
Queue
#include <iostream>
using namespace std;
const int LIMIT = 10;
class queue
{
private:
int Qlast;
int Qfirst;
int contents [LIMIT];
public :
queue ()
{
Qlast = 0;

}
bool Isfull ()
{
if (Qlast>=LIMIT)
return true;
else
return false;
}
bool Isempty()
{
if (Qfirst==Qlast)
{
return true;
}
else
{
return false;
}
}
void Insert (int x)
{
if (!Isfull())
{
contents [Qlast] = x;
Qlast++;
}
}
int Remove ()
{
if (!Isempty())
{
Qfirst++;
int k=contents [Qfirst];
return k;
}
}

};
int main ()
{
queue q;
q.Insert (2);
q.Insert (3);
q.Insert (4);

cout << "Remove: " << endl;


cout << q.Remove() << endl;
cout << q.Remove() << endl;
cout << q.Remove() << endl;

system ("pause");
return 0;
}

int power(int base, int basePow){


if(basePow==0) return 1;
else if(basePow==1) return base;
else if(basePow>1) return base*power(base,basePow-1);
else return 1/power(base, -1 * basePow);
}

public boolean isPrime(int n) {


int i;
for (i = 2; i < n; i++){
if (n % i == 0)
return false;
}
return true;
}
Check_Palindrome()
{
String original = "madam";
String reverse="";
int length = original.length();
for ( int i = length - 1 ; i >= 0 ; i-- )
reverse = reverse + original.charAt(i);

if (original.equals(reverse))
System.out.println("Entered string is a palindrome.");
else
System.out.println("Entered string is not a palindrome.");
}

Sort_alphabetical(){
string s = "cbba";
for(int i=0; i<s.length(); i++)
for(int j=i+1; j<s.length(); j++)
if(s[j]<s[i]){
char temp = s[i];
s[i]=s[j]; s[j]=temp;
}
}

int Reverse_numbers(int n) {
int multiply = 10, remainder = 0, result = 0;
while(n>0) {
remainder = n%10;
result = result*multiply + remainder;
n= n/10;
}
return result;
}

Node *ListDelete(Node *currP, State value)


{
/* See if we are at end of list. */
if (currP == NULL)
return NULL;

if (currP->state == value) {
Node *tempNextP;

tempNextP = currP->next;

/* Deallocate the node. */


free(currP);
return tempNextP;
}

currP->next = ListDelete(currP->next, value);


return currP;
}

int Recursive_factorialfinder(int x)
{
if (x == 1) // HERE 5 is not equal to 1 so goes to else
{
return 1;
}else
{
return x*Recursive_factorialfinder(x-1);
}
}

public void bfs()


{
// BFS uses Queue data structure
Queue queue = new LinkedList();
queue.add(this.rootNode);
printNode(this.rootNode);
rootNode.visited = true;
while(!queue.isEmpty()) {
Node node = (Node)queue.remove();
Node child=null;
while((child=getUnvisitedChildNode(node))!=null) {
child.visited=true;
printNode(child);
queue.add(child);
}
}
// Clear visited property of nodes
clearNodes();
}

public void dfs() {


// DFS uses Stack data structure
Stack stack = new Stack();
stack.push(this.rootNode);
rootNode.visited=true;
printNode(rootNode);
while(!stack.isEmpty()) {
Node node = (Node)s.peek();
Node child = getUnvisitedChildNode(n);
if(child != null) {
child.visited = true;
printNode(child);
s.push(child);
}
else {
s.pop();
}
}
// Clear visited property of nodes
clearNodes();
}
}

Recursion Codes
Power Power using Recursion

#include<iostream.h>
#include<conio.h>

int power(int,int);

void main()
{
int x,y,p;
clrscr();
cout<<"\n\n\t calculating power of a number using recursion";
cout<<"\n\n\t Enter base ";
cin>>x;
cout<<"\n\n\t enter index";
cin>>y;
if(y==0)
{
cout<<"\n\n\tpower is 1";
}
if(y<0)
{
y=y*(-1);
p=power(x,y);
cout<<"\n\n\t power is"<<1/p;
}
p=power(x,y);
cout<<"\n\n\t the power is"<<p;
getch();
}

int power(int x1,int y1)


{
if(y1==1)
return(x1);
else
return(x1*power(x1,y1-1));
}
Print reverse of a string using recursion
Write a recursive C function to print reverse of a given string.

Program:

# include <stdio.h>

/* Function to print reverse of the passed string */


void reverse(char *str)
{
if(*str)
{
reverse(str+1);
printf("%c", *str);
}
// you can also put here the print statement.
//printf("%c", *str);
}

/* Driver program to test above function */


int main()
{
char a[] = "Geeks for Geeks";
reverse(a);
getchar();
return 0;
}
Input: Fasih Rehman
output: namheR hisaf

Explanation: Recursive function (reverse) takes string pointer (str) as input and calls itself with next location to passed pointer (s

Time Complexity: O(n)

Sum of Digits

#include <iostream>
using namespace std;
int sumdigits (int num)
{
if (num == 0)
{
return 0;
}
else
{
return (num % 10) + sumdigits (num / 10);
}
}
int main ()
{
int n = sumdigits (553);
cout << n ;
return 0;
}

input = 553
output = 13

Count of vowels in a string

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

using namespace std;

int isVowel (char c)


{
switch (tolower (c))
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
return 1;
default:
return 0;
}
}
int countVowels (char *str)
{
if (strlen(str) == 0)
return 0;
else
return isVowel(str[0]) + countVowels(str + 1);
}
int main ()
{
printf ("%i\n", countVowels("fasih rehman"));
return 0;
}

output: 4

Factorial

#include <iostream>
using namespace std;

int factorial (int num)


{
if (num <= 1)
{
return 1;
}
else
{
return num * factorial (num - 1);
}
}

int main ()
{
int n = factorial (5);
cout << n ;
return 0;
}
output: 120

Write a program to reverse an array

Recursive Way:
1) Initialize start and end indexes
start = 0, end = n-1
2) Swap arr[start] with arr[end]
3) Recursively call reverse for rest of the array.

/* Function to reverse arr[] from start to end*/


void rvereseArray(int arr[], int start, int end)
{
int temp;
if(start >= end)
return;
temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
rvereseArray(arr, start+1, end-1);
}

/* Utility that prints out an array on a line */


void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);

printf("\n");
}

/* Driver function to test above functions */


int main()
{
int arr[] = {1, 2, 3, 4, 5};
printArray(arr, 5);
rvereseArray(arr, 0, 4);
printf("Reversed array is \n");
printArray(arr, 5);
getchar();
return 0;
}
Time Complexity: O(n)

Recursive Permutation

#include <iostream>

using namespace std;

// helper dynamic array


int *nums;

// exchange two integers


inline void swap(int &i, int &j)
{
int t = i;
i = j;
j = t;
}

// full permutation
void perm(int n, int i)
{
if (i == n - 1) // check if reach the end of iteration
{
// print out the iteration
for (int j = 0; j < n; j ++)
{
cout << nums[j];
}
cout << endl;
}
else
{
for (int j = i; j < n; j ++)
{
swap(nums[i], nums[j]); // swap
perm(n, i + 1); // recursive
swap(nums[i], nums[j]); // swap it back
}
}
}

// main entry
int main()
{
int n;
cin >> n;
nums = new int[n]; // declare a dynamic array
for (int i = 0; i < n; i ++)
{
// and fill it with numbers as 1, 2, 3, ... n
nums[i] = i + 1;
}
perm(n, 0);
cin >> n; // pause
return 0;

Recursive Prime Number

int test_prime(unsigned n, unsigned d)


{
if (n < 2)
{
return 0;
}

if (d == 1)
{
return 1;
}
else
{
if (n % d == 0)
{
return 0;
}
else
{
return test_prime(n, d - 1);
}
}
}

second code
#include <iostream>
using namespace std;

bool isPrimeRecursive(int num, int divisor)


{
cout << "Checking to see if " << num << " is divisible by " << divisor << endl;
if(divisor == 1)
{
cout << num << " must be a prime number, as we got to the case where divisor = 1";
return true;
}
if(num % divisor == 0)
{
cout << num << " is evenly divisble by " << divisor << " thus it must not be a prime number" << endl;
return false;
}
else
{
cout << num << " is not evenly divisible by " << divisor << ", recurse deeper" << endl;
return isPrimeRecursive(num, divisor - 1);
}
}

bool isPrime(int num)


{
cout << "Checking to see if " << num << " is prime" << endl;

//1 is not a prime number.


if(num <= 1)
{
cout << num << " is not prime" << endl;
return false;
}

return isPrimeRecursive(num, num - 1);


}

int main()
{
isPrime(2);
cout << endl << endl;
isPrime(6);
cout << endl << endl;
isPrime(11);
return 0;
}

Fibonacci Series

#include <iostream>
using namespace std;
int fib(int num)
{
cout << "Finding the fib of " << num << endl;

//The rules of Fibonacii states that F0 = 0 and F1 = 1.


//These are our termination cases.
if(num == 0)
{
cout << "We have reached the termination case of 0. Returning 0" << endl;
return 0;
}
if(num == 1)
{
cout << "We have reached the termination case of 1. Returning 1" << endl;
return 1;
}

int result = fib(num - 1) + fib(num - 2);


cout << "Fib of " << num << " is " << result << endl;
return result;
}

int main()
{
fib(6);
return 0;
}

Tribonacci Series

#include <iostream>
using namespace std;
int f (int n)
{
if (n<3)
return 1;
if (n>=3)
return f(n-1) + f(n-2) + f(n-3);
}
main()
{
int n;
printf ("Enter a number: ");
scanf ("%d", &n);
printf ("%d\n", f(n));
}
esent!!" << endl;
s Present!!" << endl;
Qfirst = -1;
f with next location to passed pointer (str+1). Recursion continues this way, when pointer reaches ‘\0', all functions accumulated in stack pr
umber" << endl;
ctions accumulated in stack print char at passed location (str) and return one by one.
Interview # Question

1 -About urserlf.
-Fyp.
-ERD.
-Atleast 10 queries.
-Overriding and overloading code.
-Static variable,functions.
-Difference b/w class and struct.
-Different patterns code.
-Normalization.
-DB questions.
-MVC.
-Session and Cookie.
Answers
Interview # Question

1 oop: 1) what is static class and static objects?


2) does static class have non static members?
3) what is static constructor and when to use it?
Data structure: 1) quick sort and its complexity
2) breadth
3) Given and depth
a binary searchfirst
treesearch and breadth
if we apply its complexity
first search to search an element what
would be the complexity?
DB: 1) what are views?
2) what are locks and its type?
AI: 1) what is neuro networks?
2) what is heuristics?
3) what are decision tress?
Web: what is ajax?
how to do
mostly secure
from CV, data
askedtransform usingDB,
a lot about get DS,
method?
iOS, FYP, and some stuff about OOP.
2 Went in details of everything, so be prepared.
DS: All data structures and why/where should be used.
DB: Joins and there types. Aggregate functions.Define krwai thein.
iOS: Mainly threading.
FYP: My role and how I'm doing stuff.
OOP: 4 pillars definitions.

3 FYP
Polymorphism
abstraction
inheritance
access modifiers
processes
threads
locks and its types
DB transaction
how to recover transaction if system fails in between
UNION and INTERSECTION based queries
Goodcoresoft interview + test
4 Test :

1)write program for summing up integers like int a = 3456 its sum will be 18
2) write program for counting the occurrence of words in a string " dil dil pakistan
jan jan pakistan"
dil = 2
jan = 2
pakistan = 2

Query part: a table salesperson contains IDs and names of customers and
another table personOrder contains number of orders each customer have placed
Q : write a query to return customer names who have placed more than one
orders
Q : write a query to return customer names starting with 'D' or 'd'
Interview :
define polymorphism, inheritance?
difference between structure and class?
Overriding and overloading?
what is interface ?
why deadlock occurs how we prevent it?
Data structure of OS that maintains memory? <- dont exactly remember it, I
answered heap
abbreviation of LAMP? tongue emoticon
what data structure is used for hashtable, how it works?
Difference between truncate and delete?
when transaction ends?
what rollback does?
Answers
Interview # Question

1 introduce your self


write a code for string reverse
define aggregation relationship in class
what is encapsulation? and form wala scenerio
difference between sequence diagram and activity diagram
what is system diagram
difference between abstract and abstract factory
difference between json and jsonp
Normalization and its type

Define your FYP (features and you role)


Triggers concept in database
Multiple Inheritance
First there Concept
was a small test. ( hardly took 5 mins tongue emoticon ) 2
2 questions were asked to do on a paper..
Q1) Recursive function to reverse a string (you can use any language)
Q2)
ThenDefine aggregation
an interview wasrelationship
conducted by 2 persons (only one of them asked
questions the other one just listened)
Q1) Introduce yourself..
Q2) Rate yourself out of 10 (10 being the most skilled) in:
a. Functional programming
b. OOP
c. Databases
Q3) Define your FYP.. FYP features and your role in FYP.
Q4) 4 pillars of OOP... Encapsulation concept? Why is it done?
Q5) What is trigger?
Q6) Multiple inheritance concept?
3 Screening Test
Difference between overriding and overloading
Difference between spawning a thread and forking a process
What is the time to retrieve an element in hashtable,binary tree, linked list? how
does it change for 1 million records
recursively print Nth fibonnacci number
you have a table named emp having empid(PK),mgrid(FK refering to empid in
this table mtlb recursive relationship),name. write a query to get all employees
who are not managers.
logical question
Answers
Interview # Question
Answers
Interview # Question

1 Biznussoft (initial 30 mins interview)


-Introduce your self.
-Explain FYP indetail.
-Adavantages of Obect oriented programming.
-Question regarding OOP pillars.
-implementation of 4 pillars of OOp in java.
-some codes in java were given . what will be the output?
-conditional loop vs unconditional loop.
-code wrapping design patterns.
-why need constructors, can their be multiple constructor in a class.
-what is cloud computing . why need cloud?
-protocols to implement cloud on web in detail.
-(AND else i forgot)
Answers
Interview # Question

1 Binary Vibes 1.5 hours interview


1. Oop vs structural
2. Why OOP
3. Pillars of OOP
4. Can 1 interface extends other interface?
5. Diff bt interface and abstract
6. Db queries
7. Db design
8. VIEWS
9. Diamond problem
10. Complexitiez
11. Code of pascal theorem
12. Reverse string
13. Sum of values between x and y in less thn O(N)
14. 0-N ka loop hai
Usko 4 threads me break kra
Ab kia complexity hogi
15. Linklist, tree, hashtables
Answers
Interview #

1
Question
MarketLytics 2nd Interview:
Kinda HR Questions like:
1. kahan se ho orginally?
2. expected salary kitni?
3. suppose agar zindgi m koi restriction na ho to kia karna chahoge?
4. Bike chala letay ho? aur Khi me tongue emoticon ?
6. CS q choose ki aur kese pata chala - ye bohat mast sawal tha aur pechhla bi jaha se
5. 5 saal
mene baad
poory khud kokakaha
interview dekhna
direction chahty kardiya
e change ho ya kuch
phiridea
usnehe kia plan
wohe he?
sawal pooche jo
mene
5. Farigusey
timepoochne ko kahy
m kia kartay ho?grin emoticon
mene indirectly
kaha mostly m wink
Google emoticon
pe hota hoo, kuch parh rha
7. phir
hota narain
koishru hogya, jawab to bht
rhalamba tha mene kaha behavioral PsychoLogy
6. to hu
usne
related,
yakaha
tech
youtube
kia parhty
related,
videos
programming
dekh
ho aur konsi hota hoo..
videos
blogs, tongue
kabi kabi emoticon ?religions,
camparative issi wajayoutube
se mene
ooper
videos nh jawab
me kuch diya tha poora
log hprojects mjhe
jin ki baatein pata tha
achi hoti yhi poochega.. grin emoticon
8. aur bech m kahin ka poocha tha, he
koiwo sunta
aesa hoo,jis
project kafi
m kuch naeeaya
bht maza chezzein
ho?,
pata lagti he..aur etc.
aur aj tak sab se bara project knsa tha? i said i think FYP, aur phir FYP k ooper
discussion.
9. Tools kon kon se use kartay ho ya ache lagty hen...
Answers
Interview # Question

1 TEST OF TEXT
Write a query to retrieve last two rows of the table.
Write query to make indexes of a column.
Why we use indexes and its impact on CRUD.
Difference between
Given an array of allsubqueries, inner
database rows joins, outer
retrieve joins,
last two rows with your fav
programming lang
Given a list of all database rows in C# retrieve last two rows.
Hobby.
Skills rating out of 5 on programming, web, web service, and database.
Given a method write code to get last two rows Using LINQ.
Answers
Interview # Question
1 1. difference b/w final and const
2. defien polymorphism.
3. what is meant
4. Program by static
to make and its
any string use.
a palindrome. (we could do it by reversing and append it
with origanal)
5. Count the number of character in a string with out using predefiend functions.
Answers
Interview # Question

1 couple of oop related questions


couple of standard db queries
Android life cycle
What AndroidManifest.xml does
what are permissions and why we used them
What are activities, services,broadcast receivers, async task
question about Intent, Shared Preferences
Explain Linear Layout Relative Layout and Frame Layout when to use which
questions about view pager,fragments,adapters
how to manage different screen resolutions
how push notification and google map works
questions about my apps that are published on play store what difficulties I had etc
iOS app states
couple of questions about AppDelegate and ViewController lifecycle
how permissions are managed in iOS
how to trace and fix memory leaks
difference b.w atomic and non atomic , strong and weak properties
how nil is handled in objective C
Explain ARC
how auto release pool works
explain auto layout and how it works
explain how Push notification and Code signing works
In the end few questions about my future plans , expectations etc etc
Answers
Interview # Question

1 DGSWorld technical Interview:


Codes:
1) write code of bubble sort
2) code of binary search on array
3) find whether num is prime or not
4) 9 7 5 3 1
9753
9/7/2005
9/7/2015
9
Query:
emp table
id, name, score, gender
1) update the score of id = 3
1) get name of highest scorer
2) print sum of scores of male and sum of scores of female.
Expected Salary
aur kaha kaha test diye aur koi offer waghera ?
Answers
Interview # Question

1 osi layers
what is nosql
map reduce (asked because i said it)

2 The easiest interview you will give in ur life. 15 mins. networks parh lena
Answers
http://en.wikipedia.org/wiki/OSI_model
http://en.wikipedia.org/wiki/NoSQL
Interview # Question
Answers
Interview # Question

1 - What is DML AND DDL?


- What are commands in sql ? Like Insert
- In which we do autocommit and manual commit ? DDL or DML?
- Character Functions -(Why to use)
- Conversion functions
- Aggregrate Functions ? what are they?
- What is PL/SQL?
- What is SQL?
- Defination of class and object likhwae
- Print 2 ka table and koi range dae hai us tak 2 ka table print karwao?
- Indexing
- Create ki statement chal lae agr logout hojae to wo rahe ge ?
- Insert ki statement chal lae agr logout hojae to wo rahe ge ?
- Primary key
- FOreign Key
- Foreign key ( kiya tab bante hai jab dusre table ki ka col primary ho ) ?
- Insert kaise karo gae table jis 6 cols hn aur tumhn sirf 3 mein values dalne ho ?
- oracle kai kunse version par kam kara hai and kunsa ide use kara tha ?
- Peoplesoft kiya hota hai ? koi idea hai ?
Answers
Interview # Question
Answers
Interview # Question
Answers
Interview for associate software engineer
1 Describe fyp
2 technologies used in fyp
3 Difference between unique key and primary key
4 Tell your experience about .NET technoloies
5 what is Asp.net mvc
6 Describe relationship between student and course
7 What is internal in c#
8 Recusively print 1 to 10
9 Code of design pattern is given and tell which design pattern is used here
10 Difference b/w delegates and event
11 Difference between var==4 and var===4 in java script
12 What is stored procedure
13 What is indexes
Interview # Question
Answers
Interview # Question
Answers
Interview # Question
Answers

You might also like