Showing posts with label Interview Questions. Show all posts
Showing posts with label Interview Questions. Show all posts

SEO Interview Questions, Latest SEO Interview Questions


SEO Interview Questions

1. What SEO results can you show?

2. What do you believe are important things to take into consideration when optimising a site?

3. Who do you respect in the industry?

4. What web analytics programs are you familiar with?

5. List On-Page SEO factors

6. List 5 link building techniques.

7. What is page segmentation? (Ever heard of VIPS?)

8. What’s the difference between PageRank and ToolBar PageRank?

9. What is Latent Semantic Analysis (LSI - Indexing)?

10. What is Phrase Based Indexing and Retrieval and what roles does it play?

11. What is sandbox?

12. How long does it take to get out of sandbox?

13. How can you track your rankings?

14. What services does the wordtracker offer, and how do they relate to seo?

15. What are the common factors between google/yahoo/msn?

16. How can you keep your PPC bids from cannibalizing your search efforts on other (non pay per click) search engines?

17. What percentage of your pay per click budget should go to each search engine?

18. Does either Google Adwords or Overture work better for your particular product or service? Or, perhaps neither one is appropriate from a return on investment (ROI) perspective.

19. Give me a description of your general SEO experience.

20. Do you currently do SEO on your own sites and give me some examples. Do you operate any blogs? Do you currently do any freelance work and do you plan on continuing it?

22. Where do you think the SEO industry is headed?

23. What industry sites, blogs, and forums do you regularly read?

24. Have you attended any search related conferences?

25. What SEO tools do you regularly use?

25. What SEO areas are you weak and strong in, and give examples of both.

26. What areas do you think are currently the most important in organically ranking a site?

28. What kind of strategies do you normally implement for backlinks? What do you think about link buying, link bait, and other specific backlink strategies?

29. What are your thoughts on the direction of Web 2.0 technologies with regards to SEO?
blogs, rss, podcasting

30. Are you familiar with search arbitrage?

31. Are you familiar with enterprise web analytics and what packages are your familiar with?

32. Are you familiar with A/B testing and multivariate testing?

33. Do you have experience in email marketing, banner advertising, other types of media buys and other forms of online advertising?

34. Are you experienced in managing PPC campaigns? To what extent and on what platforms?

35. Do you have experience in bid management tools, API tools, and click fraud issues?

36. Do you have experience in extensive competitive analysis and what techniques do you use?

37. What technologies are you familiar with? (We primarily use HTML, CSS, ASP, .net, PHP, SQL, and JavaScript)

38. Why are you moving from your current position and/or leaving any current projects?

39. Do you know who Matt Cutts is?

44. In Google Lore - what are ‘Hilltop’ Florida’ and ‘Big Daddy’?

45. What changes did you make and what ranking effect did it have?

46. What is sticky content?

Read more...

ASP .NET Interview Questions


ASP .NET Interview Questions- Part 1
  
    Differences between DLL and EXE?
    Can an assembly have EXE?
    Can a DLL be changed to an EXE?
    Compare & contrast rich client (smart clients or Windows-based) & browser-based Web application
    Compare Client server application with n-Tier application
    Can a try block have more than one catch block?
    Can a try block have nested try blocks?
    How do you load an assembly at runtime?
    If I am writing in a language like VB or C++, what are the procedures to be followed to support .NET?
    How do you view the methods and members of a DLL?
    What is shadowing?
    What are the collections you’ve used?

ASP .NET Interview Questions- Part 2

    Explain the life cycle of an ASP .NET page.

    Explain the .NET architecture.

    What are object-oriented concepts?

    How do you create multiple inheritance in c# and .NET?

    When is web.config called?

    How many weg.configs can an application have?

    How do you set language in weg.config?

    What does connection string consist of?

    Where do you store connection string?

    What is abstract class?

    What is difference between interface inhertance and class inheritance?

    What are the collection classes?

    What are the types of threading models?

    What inheritance does VB.NET support?

    What is a runtime host?

    Describe the techniques for optimizing your application?

    Differences between application and session

    What is web application virtual directory?

    Differences between Active.exe and Dll

    Connection pooling in MTS?

    If cookies is disabled in client browser, will session tracking work?

    How do you make your site SSL-enabled?

    Will the following code execute successfully: response.write(’value of i=’+i);

    What are the provides available with VB.NET?

    What is a Process, Sesion and Cookie?

    What are Abstract base classes?

    What are the Difference between bstract base classes and Abstrat classes

    What are interface in .NET?

    How is Polymorphism supports in .NET?

    What are the 2 types of polymorphism supports in .NET?

    Types of compatibilities and explain them.

    What is aggregative? How can it be implements in .NET?

    Difference between COM components and .NET components?how to register it

    Difference between early binding and late binding?

    ASP.NET OBJECTS?

    Asp.NET life cycle? When request mode

    Explain ADO and its objects.

    What is side by side execution?

    Explain serialization?

    Explain a class access specifiers and method acess specifiers.

    What is the difference between overloading and overriding ? how can this be .NET

    Explain virtual function and its usage.

    How do you implement inhetance in .NET?

    If I want to override a method 1 of class A and this class B then how do you declared

    Explain friend and protected friend.

    Explain multiple and multi_level inheritance in .NET?

    Name all kind of access specifiers for a class and for methods?

    On ODP.NET

    What is non-derterministic finalization?

    What is isPostback property?

    What is dictionary base class?

    How can a class be extended and how is this mechanism difff from that of implementation an interface?

    What are indexes .NET?

    How can indexes be implemented in .NET?

ASP .NET Interview Questions- Part 1

What are steps in an asp .net page lifecycle?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

2.What is the main difference between Response.Write() and Response.Output.Write()?
With Response.Outout.Write options are available to you to write the formatted out put.

3.When implementing classes what are the specifics of an abstract method?
An Abstract method does not provide any implementation. The class containing it can not be instantiated it must be inherited. The deriving class must override abstract methods declared in parent class, unless it is an abstract class it self.

4.List all Validation Controls available in asp .net?
RequiredFieldValidator : Checks if a control has a value.
RangeValidator : Checks if the control’s value is within a certain range.
RegularExpressionValidator : Checks whether the value of an input control matches a certain pattern
CompareValidator : Checks a control’s value against a constant or another control value.
CustomValidator : Checks a control’s value against a customized validation logic.
ValidationSummary : Displays a list of all validation errors

5.What data types do the RangeValidator control support?
Integer, String, and Date.

6.Is C# .net case sensitive?
Yes it is.

7.What is the difference between a class and struct ?
A struct is a value type while a class is a reference type. There’s no inheritance with
struct.

8.When passing a variable by reference to a method what is the difference between keywords ref and out?
When using the key word ref the variable must be initialize before calling the method,
while initialization is not mandatory when using out.

9.What are specifics for Static class?
Static class is implemented with the Keyword Static in the class definition.
It must contain only static members and methods. Public members of static class can be accessed without the class instantiation. Static class are sealed by default therefore can not be inherited. Static class cannot be instantiated.

10.What part of the code is usually called Code-Behind?
The Server side code is usually called Code-behind as reference to the fact that in a web application it is actually the part of the code handling the large part of the execution.

11.What part of the code is called Inline Code?
The asp .net client side code is usually call inline code. From most browsers it can be
view by choosing 'View source' from the page menu.

12.What is the difference between doing a Dataset.Clone() and Dataset.Copy()?
Dataset.Clone() will copy just the dataset structure including all the datatables,
schemas, relations and constraints; it will not copy the data. Dataset.Copy() will copy
both dataset structure and data.

13.What is the role of Global.asax file?
The Global.asax include its code behind file Global.asax.cs, it is use to implement
application and session level events.

14.What utility is used to manually deploy an assembly?
The GacUtil is a utility tool that comes with visual studio, it is use to deploy an
assembly by adding it into the GAC(Global Assembly Cache).

Ex: Type at the command line prompt
C:\gacutil /i ASPMyComponent.dll
will install ASPMyComponent into the GAC

15.Define MSIL. How is it use in the .Net framework?
MSIL stand for Microsoft Intermediate Language. During the compilation process, code written in any .NET compatible languages(J#, C#, VB,C++) is converted into MSIL. MSIL then create a compatibility bridge among these language before execution by the virtual machine.

16. What are differences between ASP.Net and Classic ASP?
-ASP programming is based on scripting languages like Jscript or VBScript which evolves around a mixture of scripting and HTML. ASP .net is base on an advance structured compiled language.
-ASP .net gives the option of separating the code behind (compiled code) from the design code or client code (HTML).
-ASP .net with visual studio .net provides an advanced application and session state
management, while ASP performs poorly at providing it.
-ASP has a poor error handling capability compare to ASP .net which has it much completed and much advanced.
-ASP does not have a built-in mechanism for XML while ASP .net comes with a full XML capability support.
-ASP .net has a fully distributed data source support which is missing from classic ASP

17.What property is use to set alternate color scheme in a Repeater control?
AlternatingItemTemplate.

18.What is the base class for Web Forms?
The System.Web.UI.Page class.

19.What are the meaning of terms boxing and un-boxing?
Boxing: Implicit conversion of a value type into a reference type.
Un-Boxing: Explicit conversion of a reference type into a value type. Can also be call
casting.

20.Give a brief description of how the heap and stack are managed in .Net.
Stack and heap are memory sections of the .net application. The CLR(Common Language Runtime) is in charge of managing those sections.
Value type variables are stored in the stack where storing order is Last in first out.
When a variable is out of scope it basically fall off the stack.
Refence type variable are stored on the heap where storing order is First in first out.
When a variable becomes out of scope it is mark for collection.

The GC(Garbage Collector) is the part of the CLR responsible for cleaning up the heap releasing resources occupied by Reference type variables.

Read more...

C Programming Variables Interview Questions

    What is the difference between the declaration and the definition of a variable?

    The definition is the one that actually allocates space, and provides an initialization value, if any.
    There can be many declarations, but there must be exactly one definition. A definition tells the compiler to set aside storage for the variable. A declaration makes the variable known to parts of the program that may wish to use it. A variable might be defined and declared in the same statement.
    
Do Global variables start out as zero?

    Un initialized variables declared with the "static" keyword are initialized to zero. Such variables are implicitly initialized to the null pointer if they are pointers, and to 0.0F if they are floating point numbers.
    Local variables start out containing garbage, unless they are explicitly initialized.
    Memory obtained with malloc() and realloc() is likely to contain junk, and must be initialized. Memory obtained with calloc() is all-bits-0, but this is not necessarily useful for pointer or floating-point values (This is in contrast to Global pointers and Global floating point numbers, which start as zeroes of the right type).
    Does C have boolean variable type?

    No, C does not have a boolean variable type. One can use ints, chars, #defines or enums to achieve the same in C.

    #define TRUE 1
    #define FALSE 0
    enum bool {false, true};

    An enum may be good if the debugger shows the names of enum constants when examining variables.
    Where may variables be defined in C?


    Outside a function definition (global scope, from the point of definition downward in the source code). Inside a block before any statements other than variable declarations (local scope with respect to the block).
    To what does the term storage class refer? What are auto, static, extern, volatile, const classes?

    This is a part of a variable declaration that tells the compiler how to interpret the variable's symbol. It does not in itself allocate storage, but it usually tells the compiler how the variable should be stored. Storage class specifiers help you to specify the type of storage used for data objects. Only one storage class specifier is permitted in a declaration this makes sense, as there is only one way of storing things and if you omit the storage class specifier in a declaration, a default is chosen. The default depends on whether the declaration is made outside a function (external declarations) or inside a function (internal declarations). For external declarations the default storage class specifier will be extern and for internal declarations it will be auto. The only exception to this rule is the declaration of functions, whose default storage class specifier is always extern.
    Here are C's storage classes and what they signify:
        auto - local variables.
        static - variables are defined in a nonvolatile region of memory such that they retain their contents though out the program's execution.
        register - asks the compiler to devote a processor register to this variable in order to speed the program's execution. The compiler may not comply and the variable looses it contents and identity when the function it which it is defined terminates.
        extern - tells the compiler that the variable is defined in another module.

    In C, const and volatile are type qualifiers. The const and volatile type qualifiers are completely independent. A common misconception is to imagine that somehow const is the opposite of volatile and vice versa. This is wrong. The keywords const and volatile can be applied to any declaration, including those of structures, unions, enumerated types or typedef names. Applying them to a declaration is called qualifying the declaration?that's why const and volatile are called type qualifiers, rather than type specifiers.
        const means that something is not modifiable, so a data object that is declared with const as a part of its type specification must not be assigned to in any way during the run of a program. The main intention of introducing const objects was to allow them to be put into read-only store, and to permit compilers to do extra consistency checking in a program. Unless you defeat the intent by doing naughty things with pointers, a compiler is able to check that const objects are not modified explicitly by the user. It is very likely that the definition of the object will contain an initializer (otherwise, since you can't assign to it, how would it ever get a value?), but this is not always the case. For example, if you were accessing a hardware port at a fixed memory address and promised only to read from it, then it would be declared to be const but not initialized.
        volatile tells the compiler that other programs will be modifying this variable in addition to the program being compiled. For example, an I/O device might need write directly into a program or data space. Meanwhile, the program itself may never directly access the memory area in question. In such a case, we would not want the compiler to optimize-out this data area that never seems to be used by the program, yet must exist for the program to function correctly in a larger context. It tells the compiler that the object is subject to sudden change for reasons which cannot be predicted from a study of the program itself, and forces every reference to such an object to be a genuine reference.
        const volatile - Both constant and volatile.

    The "volatile" modifier
    The volatile modifier is a directive to the compiler?s optimizer that operations involving this variable should not be optimized in certain ways. There are two special cases in which use of the volatile modifier is desirable. The first case involves memory-mapped hardware (a device such as a graphics adaptor that appears to the computer?s hardware as if it were part of the computer?s memory), and the second involves shared memory (memory used by two or more programs running simultaneously). Most computers have a set of registers that can be accessed faster than the computer?s main memory. A good compiler will perform a kind of optimization called ?redundant load and store removal.? The compiler looks for places in the code where it can either remove an instruction to load data from memory because the value is already in a register, or remove an instruction to store data to memory because the value can stay in a register until it is changed again anyway.
    If a variable is a pointer to something other than normal memory, such as memory-mapped ports on a
    peripheral, redundant load and store optimizations might be detrimental. For instance, here?s a piece of code that might be used to time some operation:

    time_t time_addition(volatile const struct timer *t, int a)
    {
      int n;
      int x;
      time_t then;
      x = 0;
      then = t->value;
      for (n = 0; n < 1000; n++)
      {
        x = x + a;
      }
      return t->value - then;
    }

    In this code, the variable t->value is actually a hardware counter that is being incremented as time passes. The function adds the value of a to x 1000 times, and it returns the amount the timer was incremented by while the 1000 additions were being performed. Without the volatile modifier, a clever optimizer might assume that the value of t does not change during the execution of the function, because there is no statement that explicitly changes it. In that case, there?s no need to read it from memory a second time and subtract it, because the answer will always be 0. The compiler might therefore ?optimize? the function by making it always return 0. If a variable points to data in shared memory, you also don?t want the compiler to perform redundant load and store optimizations. Shared memory is normally used to enable two programs to communicate with each other by having one program store data in the shared portion of memory and the other program read the same portion of memory. If the compiler optimizes away a load or store of shared memory, communication between the two programs will be affected.
    What does the typedef keyword do?

    This keyword provides a short-hand way to write variable declarations. It is not a true data typing mechanism, rather, it is syntactic "sugar coating".
    For example

    typedef struct node
    {
      int value;
      struct node *next;
    }mynode;

    This can later be used to declare variables like this

    mynode *ptr1;
    and not by the lengthy expression
    struct node *ptr1;

    There are three main reasons for using typedefs:
        It makes the writing of complicated declarations a lot easier. This helps in eliminating a lot of clutter in the code.
        It helps in achieving portability in programs. That is, if we use typedefs for data types that are machine dependent, only the typedefs need to change when the program is ported to a new platform.
        It helps in providing better documentation for a program. For example, a node of a doubly linked list is better understood as ptrToList than just a pointer to a complicated structure.
    What is the difference between constants defined through #define and the constant keyword?

    A constant is similar to a variable in the sense that it represents a memory location (or simply, a value). It is different from a normal variable, in that it cannot change it's value in the proram - it must stay for ever stay constant. In general, constants are a useful because they can prevent program bugs and logical errors(errors are explained later). Unintended modifications are prevented from occurring. The compiler will catch attempts to reassign new values to constants.
    Constants may be defined using the preprocessor directive #define. They may also be defined using the const keyword.
    
So whats the difference between these two?

    #define ABC 5
    and
    const int abc = 5;

    There are two main advantages of the second one over the first technique. First, the type of the constant is defined. "pi" is float. This allows for some type checking by the compiler. Second, these constants are variables with a definite scope. The scope of a variable relates to parts of your program in which it is defined.
    There is also one good use of the important use of the const keyword. Suppose you want to make use of some structure data in some function. You will pass a pointer to that structure as argument to that function. But to make sure that your structure is readonly inside the function you can declare the structure argument as const in function prototype. This will prevent any accidental modification of the structure values inside the function.
  
  What are Trigraph characters?

    These are used when you keyboard does not support some special characters

        ??=    #
        ??(    [
        ??)    ]
        ??<    {
        ??>    }
        ??!    |
        ??/    \
        ??'    ^
        ??-    ~
    How are floating point numbers stored? Whats the IEEE format?

    IEEE Standard 754 floating point is the most common representation today for real numbers on computers, including Intel-based PC's, Macintoshes, and most Unix platforms.
    IEEE floating point numbers have three basic components: the sign, the exponent, and the mantissa. The mantissa is composed of the fraction and an implicit leading digit (explained below). The exponent base(2) is implicit and need not be stored.
    The following figure shows the layout for single (32-bit) and double (64-bit) precision floating-point values. The number of bits for each field are shown (bit ranges are in square brackets):

                     Sign   Exponent   Fraction   Bias
    --------------------------------------------------
    Single Precision 1 [31] 8 [30-23]  23 [22-00] 127
    Double Precision 1 [63] 11 [62-52] 52 [51-00] 1023

    The sign bit is as simple as it gets. 0 denotes a positive number; 1 denotes a negative number. Flipping the value of this bit flips the sign of the number.
    The exponent field needs to represent both positive and negative exponents. To do this, a bias is added to the actual exponent in order to get the stored exponent. For IEEE single-precision floats, this value is 127. Thus, an exponent of zero means that 127 is stored in the exponent field. A stored value of 200 indicates an exponent of (200-127), or 73. For reasons discussed later, exponents of -127 (all 0s) and +128 (all 1s) are reserved for special numbers. For double precision, the exponent field is 11 bits, and has a bias of 1023.
    The mantissa, also known as the significand, represents the precision bits of the number. It is composed of an implicit leading bit and the fraction bits. To find out the value of the implicit leading bit, consider that any number can be expressed in scientific notation in many different ways. For example, the number five can be represented as any of these:

            5.00 × 100
            0.05 × 10 ^ 2
            5000 × 10 ^ -3

    In order to maximize the quantity of representable numbers, floating-point numbers are typically stored in normalized form. This basically puts the radix point after the first non-zero digit. In normalized form, five is represented as 5.0 × 100. A nice little optimization is available to us in base two, since the only possible non-zero digit is 1. Thus, we can just assume a leading digit of 1, and don't need to represent it explicitly. As a result, the mantissa has effectively 24 bits of resolution, by way of 23 fraction bits.
    So, to sum up:

    1. The sign bit is 0 for positive, 1 for negative.
    2. The exponent's base is two.
    3. The exponent field contains 127 plus the true exponent for single-precision,
       or 1023 plus the true exponent for double precision.
    4. The first bit of the mantissa is typically assumed to be 1.f, where f is the
       field of fraction bits.
   
When should the register modifier be used?

    The register modifier hints to the compiler that the variable will be heavily used and should be kept in the CPU?s registers, if possible, so that it can be accessed faster. There are several restrictions on the use of the register modifier.
    First, the variable must be of a type that can be held in the CPU?s register. This usually means a single value of a size less than or equal to the size of an integer. Some machines have registers that can hold floating-point numbers as well. Second, because the variable might not be stored in memory, its address cannot be taken with the unary & operator. An attempt to do so is flagged as an error by the compiler. Some additional rules affect how useful the register modifier is. Because the number of registers is limited, and because some registers can hold only certain types of data (such as pointers or floating-point numbers), the number and types of register modifiers that will actually have any effect are dependent on what machine the program will run on. Any additional register modifiers are silently ignored by the compiler. Also, in some cases, it might actually be slower to keep a variable in a register because that register then becomes unavailable for other purposes or because the variable isn?t used enough to justify the overhead of loading and storing it. So when should the register modifier be used? The answer is never, with most modern compilers. Early C compilers did not keep any variables in registers unless directed to do so, and the register modifier was a valuable addition to the language. C compiler design has advanced to the point, however, where the compiler will usually make better decisions than the programmer about which variables should be stored in registers. In fact, many compilers actually ignore the register modifier, which is perfectly legal, because it is only a hint and not a directive.
    When should a type cast be used?

    There are two situations in which to use a type cast.
    The first use is to change the type of an operand to an arithmetic operation so that the operation will be performed properly.
    The second case is to cast pointer types to and from void * in order to interface with functions that expect or return void pointers. For example, the following line type casts the return value of the call to malloc() to be a pointer to a foo structure.

    struct foo *p = (struct foo *) malloc(sizeof(struct foo));

    A type cast should not be used to override a const or volatile declaration. Overriding these type modifiers can cause the program to fail to run correctly. A type cast should not be used to turn a pointer to one type of structure or data type into another. In the
    rare events in which this action is beneficial, using a union to hold the values makes the programmer?s intentions clearer.


    Can structures be assigned to variables and passed to and from functions?

    Yes, they can!
    But note that when structures are passed, returned or assigned, the copying is done only at one level (The data pointed to by any pointer fields is not copied!.


    These Questions are taken from CrackTheInterview team.

Read more...

Google latest Interview Questions For Fresher's, Google telephonic Interview


Google telephonic Interview

    Asked about my project. Prepare well to answer any type of questions that may arise in your project.They will just ask to explain about any one of the projects listed in your resume.
    In a plane, n points are given i.e. the input is (x1,y1), (x2,y2)... (xn,yn). Now given these n points.Find the maximum number of collinear points.
    Solution:
    The duality algorithm would work. Find the point of intersection with maximum no of lines incident on it in the dual plane. It works in O(n^2).
    Write the code for finding the min of n number.

    I gave:

    for(i=0;i<n;i++)
    {
       if( a[i]<min )
       {
             min = a[i] ---- eq(i)
       }
    }


    Given that n numbers are from random sampling how many times (probability) does the line (i) be executed


    Solution:

    min=a[0];
    for(i=1;i<n;i++)
    {
        if( a[i]<min )   
        {

            min = a[i]; -------eq(i) 
        }

    }


    Once the variable min is initialized,the probability of a[i] < min is 1/2. So the expected number of occurances of equation i is (n-1)/2 .


Google Interview Round 2:



    What is Bottom up parsing and what is top down parsing?

    Solution:


    Bottom-up parsing is a strategy for analyzing unknown data relationships that attempts to identify the most fundamental units first, and then to infer higher-order structures from them. It attempts to build trees upward toward the start symbol. It occurs in the analysis of both natural languages and computer languages.


    Top-down parsing is a strategy of analyzing unknown data relationships by hypothesizing general parse tree structures and then considering whether the known fundamental structures are compatible with the hypothesis. It occurs in the analysis of both natural languages and computer languages. Please refer to these links for much better information.


    http://en.wikipedia.org/wiki/Bottom-up_parsing


    http://en.wikipedia.org/wiki/Top-down_parsing


    What is a symbol table?

    Solution:
    In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is associated with information relating to its declaration or appearance in the source, such as its type, scope level and sometimes its location.
    Check out
    http://en.wikipedia.org/wiki/Symbol_table



    There is a portal with two billion users registered. If you store all the 2 billion users in a conventional databases it will take more time to retrieve the data about a particular user when that user tries to login. How do you handle this situation to make sure that the user gets the response quickly.


    Solution:
    Every row has a primary key. Suppose the primary key for this
    particular database is the name of the user then we can sort the names based
    on alphabets and do secondary indexing based on the starting alphabet . If
    the data is uniformly distributed we can go for multilevel indexing or
    hashing.Similarly if we have a registration number as the primary key then
    we can sort the table based on registration number and then do indexing
    either secondary level or multilevel or apply hashing techniques based on
    the distribution of data. Many efficient algorithms are available for
    indexing and hashing.



    There are 8 identical balls. One of them is defective. It could be either heavier of lighter. Given a common balance how do you find the defective ball in least number of weighings.


    Solution:
    Weigh 3 balls against 3 others.
    Case A: If, on the first weighing, the balls balance, then the defective is among the 2 remaining balls and can be determined using 2 weighings making it a total of 3.

    Case B:

    Step1: If, on the first weighing, the balls don't balance.
    If the balls do not balance on the first weighing, we know that the odd ball is one of the 6 balls that was weighed. We also know that the group of 2 unweighed balls are normal, and that one of the sides, let's say Side A, is heavier than the other (although we don't know whether the odd ball is heavy or light).
    Step 2 : Take 2 balls from the unweighed group and use them to replace 2 balls on Side A (the heavy side). Take the 2 balls from Side A and use them to replace 2 balls on Side B (which are removed from the scale).

    I. If the scale balances, we know that one of the 2 balls removed from the scale was the odd one. In this case, we know that the ball is also light. We can proceed with the third weighing amd determine the lighter of the 2 balls ,hance the defective.

    II. If the scale tilts to the other side, so that Side B is now the heavy side, we know that one of the three balls moved from Side A to Side B is the odd ball, and that it is heavy. We proceed with the third weighing and determine the heavier one ,the defective.

    III. If the scale remains the same, we know that one of the two balls on the scale that was not shifted in our second weighing is the odd ball. We also know that the unmoved ball from Side A is heavier than the unmoved ball on Side B (though we don't know whether the odd ball is heavy or light).




    Step 3 (for Case B): Weigh the ball from Side A against a normal ball. If the scale balances, the ball from Side B is the odd one, and is light. If the scale does not balance, the ball from Side A is the odd one, and is heavy.



    You have all the English words with you. you would like to manage a dictionary so that you can look up when ever you have doubt. Which data structure would you like to use and why?


    Solution:
    Dozens of different data structures have been proposed for implementing dictionaries including hash tables, skip lists, and balanced/unbalanced binary search trees -- so choosing the right one can be tricky. Depending on the application, it is also a decision that can significantly impact performance. In practice, it is more important to avoid using a bad data structure than to identify the single best option available.As the frequency of look ups for a word is also important,weighted binary search tree with weights in proportion to the frequency of lookups and determining the depth, can be effective.


    Asked me about all the details of hash table and heaps.


    Write code for finding number of zeros in n!


    Solution:

    A zero in n! typically occurs when a multiple of 5 gets multiplied to an even number.We use this simple yet effective information to solve this problem.In the first n natural numbers,those divisible by 5 are always less than the no of even numbers.So it all boils down to the power of 5 in the prime factorization of n! .
    This simple formula works for finding it floor(n/5)+floor(n/25)+floor(n/125)+......


    function zeros(int n)
    {
      int count=0,k=5;
    while(n>=k)
    {
     count+=n/k;
            k*=5;
    }
    return count;
    }


    this count is the number of o's in n!.




Google Interview Round 3 :




    Write C++ class for the game Connect Four. [Connect Four (also known as Plot Four, Four In A Row, and Four In A Line) is a two-player board game in which the players take turns in dropping discs into a seven column grid with the objective of getting four of one's own discs in a line.]


    Given a stack and an input string of 1234.At any point you can do anyone of the follow

    i. take the next input symbol and Enque.
    ii. you can pop as many as you can. When ever you
    pop an element it will be printed
                (you cannot pop from an empty stack)


    How many such permutations are possible on an input of size N?


    Solution:
    It is Nth catalan number.For a detailed solution look at question5 of Stacks and Queues



    Give an example of one permutation that this data structure cannot generate.

    For Example:

    1234 is input.

    First push all 1,2,3,4 on to stack and pop all.
        output will be 4321.


    It means that this data structure can generate 4321.


    Solution:
    3124
    for a detailed solution please look at question7 of the post
    Stacks and Queues



    Question 2 was pretty easy right? Now do again the same question but the data structure this time around is a Deque.

    Input: 12345
    Data Structure: Deque ( Doubly Que )

    Note: Deque is a data structure into which you can do enque
        and deque from both sides.Some thing like this
    __________________________________
    enque ---> <----enque dequeue <---- ----->dequeue
    __________________________________




    Solution:
    It is N!. Guess why?(no constraints).Convince yourself by proving that every permutation can be generated by a set of valid operations.This prove can be using the principle of strong mathematical induction.So for this specific input the answer is 120.


    Classic Egg Puzzle Problem You are given 2 eggs.You have access to a 100-store building. Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical.You need to figure out the highest floor of a 100-store building an egg can be dropped without breaking. Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process.


    Solution:
    Let "d" be the number of drops required to find out the max floor.we need to get the value of d.

    let's say if we drop from height d then if it breaks then we have d-1 floors to check for the second egg . so max of "d" drops, so first we will drop it from height "d" if it doesn't break at a height "d" then we are left with "d-1" drops,so lets drop it from d + 'd-2' + 1 height suppose if it break there then you are left with 'd-2' drops.
    and so on until that sum is less than 100, it's like a linear search,

    in equations,

    (1+(d-1))+ (1+(d-2)) + .... >= 100

    here we need to find out d

    from the above equation

    d(d + 1)/2 >= 100


    from above d is 14





Google Interview Round 4 :



    Given n non overlapping intervals and an element. Find the interval into which this element falls.


    Solution:
    we can extend binary search to intervals.(Assuming the intervals are sorted)
    consider interval [a,b].
    if (a-x)(b-x) <=0
    then x belongs to [a,b].
    else
    if x>a
    element can be present only in the intervals to its right.
    so select the middle interval among them to it's right
    and repeat the procedure.
    else
    element can be present only in the intervals to its left.
    so select the middle interval among them to it's left
    and repeat the procedure.

    The complexity of this problem is log(N) where N is the number of sorted non-overlapping intervals.


    Worst case is take all intervals one at a time and see whether the element lies in the interval or not.It will take O(n). So please give a solution that will do better than O(n).


    Now given that the n intervals are overlapping then how do you solve? The interviewer was concentrating more on the complexities (running, memory ..)


    Solution:
    If the above intervals are overlapping ,then they can be merged in O(N) and then the exact intervals can be resolved later.Otherwise ,we can identify one correct interval and then linear search on its left and right neighbourhood to find the other solutions.




    Write code for Random Sort?

    Algorithm  is explained:

    Given an input array of size n. Random sort is sampling
    a new array from the given array and check whether the
    sampled array is sorted or not. If sorted return else
    sample again. The stress was on the
    code.





Google Interview Round 5: This is Manager Round



    Tell me an achievement that you have done in your non academics


    Tell me about one of your project


    Take a feature of C++ and tell me how you have implemented it in one of your project


    By taking one of your project as example tell me how you have taken care of software engineering where you would have handled more data


    There is a routine already written to find the subtraction of two sets ( set A - set B) . Write test cases for testing it.Tell me how do you test the test cases you have written?


    There is a printed book. The page numbers are not printed. Now the printing of page numbers is being done separately. If the total number of digits printed is 1095 then how many pages does the book have?


    Solution: Well people,this is too simple a question ..so do give it a try..(no malice,too simple).Any queries then do shoot a comment.

Read more...

Google Interview Questions, Google Interview


Google Interview Questions ::

Total there are five Technical Interviews followed by Management round.

So here are the questions.

Google Interview Round 1 ::


    What is the Space complexity of quick sort algorithm? how do find it?

    Solution: Quicksort has a space complexity of O(logn), even in the worst case, when it is carefully implemented such that
    * in-place partitioning is used. This requires O(1).
    * After partitioning, the partition with the fewest elements is (recursively) sorted first, requiring at most O(logn) space. Then the other partition is sorted using tail-recursion or iteration.
    The version of quicksort with in-place partitioning uses only constant additional space before making any recursive call. However, if it has made O(logn) nested recursive calls, it needs to store a constant amount of information from each of them. Since the best case makes at most O(logn) nested recursive calls, it uses O(logn) space. The worst case makes O(n) nested recursive calls, and so needs O(n) space.

    However, if we consider sorting arbitrarily large lists, we have to keep in mind that our variables like left and right can no longer be considered to occupy constant space; it takes O(logn) bits to index into a list of n items. Because we have variables like this in every stack frame, in reality quicksort requires O(log2n) bits of space in the best and average case and O(nlogn) space in the worst case. This isn't too terrible, though, since if the list contains mostly distinct elements, the list itself will also occupy O(nlogn) bits of space.


    What are dangling pointers?
    Solution: A dangling pointer is a pointer to storage that is no longer allocated. Dangling pointers are nasty bugs because they seldom crash the program until long after they have been created, which makes them hard to find. Programs that create dangling pointers often appear to work on small inputs, but are likely to fail on large or complex inputs.


    Given that you can take one step or two steps forward from a given step. So find the total number of ways of reaching Nth step.

    Solution:The simple recurrence relation governing this problem is f(N)=f(N-1) +f(N-2)(why?),which is a fibonacci sequence.
    Nth state can be arrived directly by taking 2 step movement from N-2 or 1 step from N-1.Remember N-2 -> N-1 -> N is not a direct path from N-2th state to Nth state.Hence the no of solutions is no of ways to reach N-2th step and then directly taking a 2 jump step to N + no of ways to reach N-1th step and then taking 1 step advance.


    You are given biased coin. Find unbiased decision out of it?

    Solution:Throw the biased coin twice.Classify it as true for HT and false for TH.Both of these occur with probability=p*(1-p),hence unbiased. Ignore the other 2 events namely HH and TT.



    On a empty chessboard, a horse starts from a point( say location x,y) and it starts moving randomly, but once it moves out of board, it cant come inside. So what is the total probability that it stays within the board after N steps.




Google Interview Round 2 ::

    You have 1 to N-1 array and 1 to N numbers, and one number is missing, you need to find the missing the number. Now you have 1 to N-2 numbers, and two numbers missing. Find them.

    Solution:
    The question can be elucidated as follows.Given an array of size N-1 containing numbers less than N and with out any duplicates!! We knew that there is a number missing from the array say K .Let S be the sum of the elements of the array.

    Sum of first N natural numbers=N*(N+1)/2

    and S=N*(N+1)/2 - K.Now putting this other way around we get K=N*(N+1)/2 -S !!



    Now the second part of the question says that there are 2 of the first N numbers missing.Let they be X and Y.

    We solve this problem by solving 2 essential equations.



    They are X+Y=N*(N+1)/2 -S---------->(1)

    X*Y=N!/P-------------------(2) where S and P are the cumulative sum and product of the array entries.

    You have cycle in linked list. Find it. Prove that time complexity is linear. Also find the node at which looping takes place.
    Solution:

    The problem of checking whether there is a cycle or not can be solved using 2 pointers one moving in increments of 1 and the other in increments of 2.If there is a cycle then these 2 pointers meet at some node say N1 inside the cycle otherwise the fast pointer reaches the end of the list.This is a O(N) solution.

    Now coming to the identification of the node at which looping took place.After our identification of cycle ,both the pointers P1 and P2 are at node N1.Now iterate the slow pointer to count the no of nodes in the cycle.(After traversing the whole cycle P1 and P2 shall again be at the same node).Let this size be K.Now take one of the pointers to the head node and count the no of nodes till N1.Let this number be X.Now use one of these pointers to reverse the cycle starting from N1.Only the cycle gets reversed.Now again traverse from head node to N1.Let the number of nodes this time be Y.Let the no of nodes from head to the start node of the cycle be Z

    Now X+Y=2*Z+K .Hence solve for K and then having figured out the start node N2 of the cycle.Now as the cycle is reversed having figured out this start node its next node is the looping nodes so set the looping nodes next pointer to NULL and reverse the list further till you reach N2.


    Questions on my project please be prepare well about your project


    How do you search for a word in a large database.
    How do you build address bar in say gmail. i.e. if you press 'r' then you get all email starting from 'r', and if you press 'ra' then you will get emails starting from 'ra'.


Google Interview Round 3 ::

    You have given an array. Find the maximum and minimum numbers in less number of comparisons.


    Solution:
    only 3n/2 comparisons are necessary to find both the minimum and the maximum. To do this, we maintain the minimum and maximum elements seen thus far. Rather than processing each element of the input by comparing it against the current minimum and maximum, however, at a cost of two comparisons per element, we process elements in pairs. We compare pairs of elements from the input first with each other, and then compare the smaller to the current minimum and the larger to the current maximum, at a cost of three comparisons for every two elements.

    You have given an array from 1 to N and numbers also from 1 to N. But more than one number is missing and some numbers have repeated more than once. Find the algo with running time O(n).

    Solution:All the numbers are positive to start with.Now, For each A[i], Check the sign of A[A[i]]. Make A[A[i]] negative if it's positive. Report a repetition if it's negative.Finally all those entries i,for which A[i] is negative are present and those i for which A[i] is positive are absent.


Google Interview Round 4 ::

    Three strings say A,B,C are given to you. Check weather 3rd string is interleaved from string A and B.

           Ex: A="abcd" B="xyz" C="axybczd". answer is yes.




    Solution:

    bool test(A,B,C)
    {
      i=j=k=0;
      while(k < C.size())
      {
        if(i < A.size() && C[k]==A[i])
         {i++,k++;
         }
        else if(j < B.size() && C[k]==B[j])
        {
          j++,k++;
        }
        else
        return false 
      }
      return (i == A.size() && j == B.size());
    }


    The above algorithm doesn't work when C[k]=A[i]=B[j], essentially throwing one in to a dilemma whether to accept the character from A or B.


    Given two sorted arrays A and B.
        Find the intersection of these arrays A and B.

        Solution:The intersection can be found by using a variation of merge routine of the merge sort.


        If array A is small and array B is too large. how will you proceed for getting intersection of those two arrays?

        Solution:In this case for each entry of smaller array,we can run a binary search routine on the larger one to know its presence.


Google Interview Round 5 ::

    If you get into Google, which products are you going to work on?
    What is TCP, UDP. what is reliability, unreliability, give examples of these?



    What is http protocol?

   

    How does Google search engine works?
    What is indexing, what is the input and output to it. how Google does that?

Read more...

Questions at Google Job Interview - Solutions to Crazy - Google Interview


How many golf balls can fit in a school bus?

Solution:
The point of the question isn't to see how golf balls you think are in the bus, but to see what your deduction skills are like. Do you just make a random guess or try to cop out by saying a lot, or do you actually try to come up with a legitimate answer by going through a logical series of steps.


You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do?


Solution:
You simply jump out. As you are scaled down, the ratio of muscle mass to total mass remains the same. Potential energy is given by E = mgh. So, if E/m is unchanged (where E is the energy expended in expanding your leg muscles, and m is your mass), then h is unchanged. Mini-me jumps as high as me. This is the reason why grass-hoppers can jump about as high as people.


How much should you charge to wash all the windows in Seattle?

Solution:
As crazy as it might sound, questions like these demonstrate your ability to think through a complex problem with little or no information. They expect you to take an educated guess. Most of the time you can ask them questions like - how many buildings are there in Seattle.


How would you find out if a machine’s stack grows up or down in memory?

Solution:
Instantiate a local variable. Call another function with a local. Look at the address of that function and then compare. If the function's local is higher, the stack grows away from address location 0; if the function's local is lower, the stack grows towards address location 0.


Explain a database in three sentences to your eight-year-old nephew.

Solution:
A database is like a file cabinet. The files, or data, is stored in it and can be arranged in categories. But unlike an actual file cabinet, you can do a lot more cool stuff with a database like being able to make it accessible through the internet.


How many times a day does a clock’s hands overlap?


Solution:The Hour hand and Minute hand would be meeting exactly 11 times in 12 hours (Hour hand would have taken 1 clockwise round and Minute hand would have taken 12 clockwise rounds, so 12 - 1 = 11 rounds).

result:
First time hour and minute hands overlap will be 12 Hours / 11 = 01:05:27.27. So at this time only hour and minute hands would be overlapping and second hand will not be any near to them. Similarly for 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th and 10th overlap of hour and minute hand the Second hand wont be any nearby. So all 3 hands (hour, minute and Second) overlap only 2 times i.e. (0:0:0 and 12:0:0).

Also we all know when we get our watches repaired, normally the repairman overlaps all the three hands to 12.

If we are considering that the second hand is not present, then the rest two overlaps 22 times in 24 hours.

There again is a catch, if we check the angles by which the hour hand and minute hand moves.

The second hand moves 6 degree in a second. In that time the minute hand will move 6/60 degrees. and the hour hand will move 6/(60*12) degrees. now taking these things in the considerations. if we check the positions of the hour and minute hand in terms of angle from the marker 12, for our first rendezvous time, i.e. 01:05:27.27 sec.
first thing that comes to my mind is that, there is fraction in the seconds. So that time can’t be measured. there will be no exact overlap. now lets calculate the angles:

1 hour 5 mins and 27 seconds = 3600 + 5*60 + 27 = 3927 seconds.

angle of hour hand = 3927 * 6/(60*12) = 32.725 degree.
angle of minute hand = 3927 * 6/60 = 392.7 degree
subtracting 360 degree from it we get - 32.7 degree.

So at 01:05:27 both hands don’t overlap. Now for 01:05:28 :
Angles : hour hand - 32.73333
minute hand - 32.8
so obviously they dont meet at 01:05:28 either.

So they overlap at 12:00 and 24:00 only. So the answer is 2 only.



You have to get from point A to point B. You don’t know if you can get there. What would you do?


Solution:Utilizing a “learn as you go” approach and applying collected knowledge and data along the way is the best way to proceed. Let’s break this down farther.

Determine the amount of time you have to go from point A to point B. Spend the initial 20% of that time making a 360° search with the largest circumference possible with the in the time you have allowed.

During that time, ask people, look for maps, clues, collect data, and knowledge. At the end of the initial 360° search take an objective look at all the information you have obtained and you calculate the risk of failure you are willing to live with. Create a plan and a strategy based on your assessment of where you believe point B to be. Then you proceed on implementing your plan with predetermined intervals of reassessment and strategy improvements.

This is the best chance you have reaching point B if you don’t know if you can get there.


Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organize your shirts for easy retrieval?

Solution:
Let’s suppose there are
a set of attributes of each shirt you are interested in: e.g. sleeve length, color, buttons (no buttons, fully button, partially buttoned from collar to chest level).
Let’s say the closet is a simple wall closet with a single closet rod running the entire length of closet. On the left you put all the short sleeve shirts, and on the right the long sleeve shorts. You separate then long and short sleeve sides with a specially marked coat hanger. Then you separate each group into no buttonoed, partially buttoned, and fully button, using more specially marked hangers. Then each sub group is separated into colored and monochrome sub-sub-groups (specially marked hangers aren’t needed for separators unless you are color blind) Then each colored group is sorted left to right according to the color spectrum: ROYGBIV: red, orange, yellow, green, blue, indigo, violet. Each monochrome ggroup is sorted left to right: white on the left, black on the right, and shades of grey in the middle, the darker greys on the right, the lighter on the left.


Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announces that at least one husband has been unfaithful. What happens?

Solution:1. There is only one cheat husband
- If it is so then 99 wives knew it before. So the cheated wife got the idea from queen that her husband is cheating. So she will kill him. Next morning every wife will know there is no cheat husbands anymore.


2. There are more than one cheat husbands


- In this case, all of the wives already had the idea prior to queen's information. Its just that the cheated wives knew the count which is one less than what the non-cheated wives' knew - thats all. i.e. if there were 2 cheat husbands then their wives knew the count is 1 and others knew its 2. So the queen just repeated the info saying "at least 1". Same goes to 2,3,4...100 cheat husbands. So in this case no wife kills her husband.


In a country in which people only want boys, every family continues to have children until they have a boy. if they have a girl, they have another child. if they have a boy, they stop. what is the proportion of boys to girls in the country?
Solution:From pure probability,we get the expected number of girls born to be 1/2 with that of boys being 1.So the ratio is 2:1


If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)?


Solution:If the chance to see the car is 10 percent per minute, the first minute you have 10% chance, the second minute you have 10% of 90% = 9% (so total 19%), the third minute 10% of 81% (= 8,1%, total 27,1 %) ......
As the chance for 30 minutes is 95 percent, the chance for 1 minute is 9.5% and for 10 minute 63.1 %.


If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? (The answer to this is not zero!)

Solution:7.5 degrees (the hour hand is 1/4th of the way between 3 and 4, the angle measure of that is 360/12 = 30 degrees between hours / 4 = 7.5 degrees).


Four people need to cross a rickety rope bridge to get back to their camp at night. Unfortunately, they only have one flashlight and it only has enough light left for seventeen minutes. The bridge is too dangerous to cross without a flashlight, and it�s only strong enough to support two people at any given time. Each of the campers walks at a different speed. One can cross the bridge in 1 minute, another in 2 minutes, the third in 5 minutes, and the slow poke takes 10 minutes to cross. How do the campers make it across in 17 minutes?

Solution:1 and 2 cross, taking 2 minutes, 1 goes back carrying the flashlight total=3 minutes. 5 and 10 cross, taking 10 minutes totaltime now= 13 minutes, 2 goes back,total time now = 15 minutes. 1 and 2 cross again, taking 2 minutes making it 17 minutes.


You are at a party with a friend and 10 people are present including you and the friend. your friend makes you a wager that for every person you find that has the same birthday as you, you get $1; for every person he finds that does not have the same birthday as you, he gets $2. would you accept the wager?

Solution:No.


How many piano tuners are there in the entire world?

Solution:1) At first list out all the piano manufacturing companies in the world.
2) Then look into their purchase records and find out the piano purchasers information.
3) i) If the purchase is made by an individual or a house hold then the piano is played at best case by all the people of the house.
ii) Else if the piano is purchased for school then list out the students that opted the piano course in their music curriculum.
iii) If the piano is purchased by a Church then count the no of major or minor events of the church and count the piano users.
sum up all the numbers to get more or less accurate piano users count.


You have eight balls all of the same size. 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings?

Solution:choose 6 balls and weigh 3 against 3
- if they weigh the same, you have another weighing for the remaining 2 balls and you can find the heavier one
- if they don’t weigh the same, from the group of 3 which was heavier, choose any 2 balls and weigh them:
- if they weigh the same, the remaining ball is the heavier one; otherwise you just found the heavier one by weighing the 2 chosen balls.


You have five pirates, ranked from 5 to 1 in descending order. The top pirate has the right to propose how 100 gold coins should be divided among them. But the others get to vote on his plan, and if fewer than half agree with him, he gets killed. How should he allocate the gold in order to maximize his share but live to enjoy it? (Hint: One pirate ends up with 98 percent of the gold.)


Solution:The highest ranked pirate gets 98 gold coins
---Two pirates get 1 gold coin each
---The other 2 pirates get nothing.

Read more...

Latest Amazon Interview Questions , Amazon Job Interview Questions


Latest Amazon Interview Questions -3


1. How would you find the second largest element in an array using minimum no of comparisons?

2. Write a C program for level order traversal of a tree?

3. You are given: 3 types of vehicles: Motorbike, Car, and a special type of car for the handicapped.
3 types of parking: Motorbike parking, Car parking, handicapped car parking.

Motorbikes and cars can only park in their designated parkings, while the handicapped cars can park either in their own parking or the regular car parking.
How would you model this as classes? Explain your methods.


4. Given 2 tables: Employee(Employee_Name,Dept_No) Department(Dept_No, Dept_Name)

Write an SQL query which outputs all the employees, and their department nos and names, including all those departments which have no employees working for them.

6. Explain about Inodes?

7.Give a Linux shell command to find all files in a directory which contain ip addresses.

8. Given a table Employee which has columns name and salary, write an SQL query to find the employee with the second highest salary.

9. Given a table of Player which contains Sno and player name, write a query which finds all possible Table Tennis doubles pairings.

10.Given a string A, and a string B, and a dictionary, how would you convert A to B in the minimum no of operations, given that:

i) All the intermediate words must be from the dictionary

ii) An ‘operation’ is defined as:

a) Delete any character from a string ex dog → do

b) Insert any character into a string ex cat → cart

c) Replace any character in the string with another ex cat → cot


---------------------------------------------------------------------

Latest Amazon Interview Questions -2


1.Given a string,find the first un-repeated character in it? Give some test cases

2.You are given a dictionary of all valid words. You have the following 3 operations permitted on a word:

a) Delete a character

b) Insert a character

c) Replace a character

Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.)


3.Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension.

4.What is a C array and illustrate the how is it different from a list.

5. What is the time and space complexities of merge sort and when is it preferred over quick sort?

6. Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

7. Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.

8.Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

9. Given an array of size n ,containing every element from 1 to n+1, except one. Find the missing element.

------------------------------------------------------------------------


Latest Amazon Interview Questions -1



1. How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

2. Explain polymorphism citing an example.

3. What are the 4 basics of OOP?

4. Define Data Abstraction. What is its importance?

5. Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array.

Eg.

i) 3 2 7 10 should return 13 (sum of 3 and 10)

ii) 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)


6. Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can’t pass the value k to any function also.

7.You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?

8.Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number.

9.Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers.

10.Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren't present.

---------------------------------------------------------

Read more...

DE Shaw Interview Questions


Question1: Differentiate HTTP and HTTPS

Question2: Discuss ACID properties of a database system.

Question3: Given a table Employee with only one field: Names, report all names with multiple entries.

Question4:Given two sequences s1,s2 and another sequence s3, find if s3 is formed by interleaving s1 and s2.[Example: s1:abcd s2:bcaa s3:abbccdaa].

Question5: If a class B is inherited from a class A, B has a function foo which is also in A, how do you call foo function in A??

Question6: If a class B is inherited public from a class A, what all the variables that can be accesses and those that cannot be.

Question7: List out the additional features of C++ over C when the latter is already available as a good programming language?

Question8: Can classes,protected variables or other features in C++ be implemented using C?

Question9: Define Deadlock

Question11:What are the Differences between a const char * and char const *?

Question12:What are the Differences between a reference variable and pointer variable in C++?

Question13:What is a register variable and what are the limitations on it? What is an automatic variable?

Question14:What are the Differences in memory allocation in array and pointer(stack and heap)?

Question15:Find the missing element in a sorted array in most optimum running time (O(log n))

Question20:Given a multi-threaded program How can you make it run on a system that supports only a single thread execution?

Read more...

Yahoo Jobs Interview Questions, Yahoo Questions



  • Design a data structure such that given a stream of numbers, you can find the maximum of the numbers at any point and also all the numbers.


  • Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions.

  • Find the common ancestor of two given nodes in a binary tree, how do you exploit the properties of a given BST for the same problem.

  • Given a function getsort(data),that sorts the data given. The function sorts in place and does not use any extra memory. How do you validate the function with respect to 1)it sorts 2) it does not use extra memory

  • Explain the Traveling Salesman problem? What is an NP-complete problem? What is the Hamiltonian cycle problem?

  • Find out the least common ancestor in a binary tree.

Read more...

MicroSoft Interview Questions, MicroSoft Interview


1)Given a Parent -Child binary tree ,build the child -sibling version of it?
Minimize the space requirements wherever possible.

2)Given a binary tree build a linked list of all its nodes such that the nodes of a level appear before the nodes of the next level?

3)Given an infinite stream of bits with the bits being appended at the highest significant position. give an algorithm to to say whether the number formed by using the sequence of bits that had been processed till then, is divisible by 3 or not?

4)Given a string S of words and no of character per line m ,with m being greater than the longest word in S,print S in a set of lines so that each line contains no more than m characters and no word split between 2 lines.

5)Given an expression remove the unnecessary brackets in it with out creating an ambiguity in its execution.
input output
ex1: (a+(b)+c) a+b+c


ex2: (a*b)+c a*b+c


6)Propose a tree based data structure to identify a node with nth rank with maximum efficiency .

7)Given a string S of alphabets and 2 characters a,b find the minimum distance between instances of them such that position of a <= position of b.

8)Given an array of size n with first l positions filled with characters and a string s ,replace all the instances of ’%’ with this string s,given that the lengh of the array is sufficient to handle these substitutions.

input output

eg: abcdef%ghi%—— and “ppp” abcdefpppghippp

9)Given a binary tree verify whether it is a binary search tree or not?

10)Write a C code to merge 2 binary search trees and do the same 2 merge linked lists.How is the former different when compared to the later.(Discuss the issues)

Read more...

Ikoa semiconductors Interview Questions, Ikoa Interview Question


1st round : Aptitude (written test) - 30 min

There were total 30 Multiple Choice questions. 2 for correct and -1 for wrong, pretty simple questions… doing PPTP questions would be more then enough for it.



2nd round : Technical (written test) - 60 min

It was a descriptive paper, there were 12 questions covering topics from C/C++, Digital Logic Design, Computer Organization, Microprocessors (they were in impression that we have been taught C++ here)

1. Define a structure class in C++.

2. one question based on OOPS.

3. A circuit diagram using CMOS was given and we were asked to find the logic expression.

4. Three questions on State Diagram.

5. Some questions on solving logic expressions

6. write a C code for strlen().

7. question on memory - like build a 2M X 32 memory using 64K X 8 memory cell.

(Tips :- Don't attempt the question if you are not sure of the answer)

Read more...

Fractural Analysis Placements, Fractural Analysis Interview Questions


Written test

In the written test few questions were asked based on the english and general knowledge and math aptitude.

Technical Interview

1. This interview was purely based on nlp and knowledge in information retrieval areas.

2. Algorithm to implement IR systems using semantics. Example: If a user gives a query “book-review”. We need to retrieve web-pages that are really book-reviews of some other pages but not those web pages which contains the word book review.

3. A scenario was given like this and i was to implement a search system. In that interview he gave me “food scenario”. If u r building a search engine what r things u will do. (We need to explain from initial steps such as raw data collection and structure data storage until search algorithm)…. These questions purely based on IEIR - NLP.

4. If u r building a search engine what r all the problems u will face as a programmer (plan-design).

5. Will u be fit for this company. so be aware of job profile carefully what r the things u know about work in fractal?

6. In language translation questions regarding Machine-Translation systems /Rule based systems were asked ?

Read more...

ADP Campus Interview, ADP Interview Questions - Technical & HR Interview


Technical Interview

1) What are the ways of representing floating point nos?

2) What are various Datatypes?

3) Write the code for tic-tac-toe game, 8 queens problem.

4) Write the psuedo code for towers of hanoi and what if there were 4 towers instead of 3.

HR Interview

1) What do you know about ADP?

2) What is your dream company? and Why?

3) How did you come to know about ADP? If you heard about this from your seniors, who are they and what did they tell you?

4) And some common questions like Tell about yourself, Family Background etc.. and also the interviewer asks if you have any questions for him.

Read more...

CapitalIQ HR Interview Questions, CapitalIQ HR Questions


1.General introduction stuff.?

2.Why capitalIQ ?

3.What are the different challenges faced in general?

4. What challenges did you face?

5. What would you do if you were given 10 lakhs.

6. What are your Past time activities.

Director Round

1. Explained about his company and work and the asked me to explain how I am a suitable candidate for the job.

Read more...
Related Posts Plugin for WordPress, Blogger...

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP