Open In App

InfoEdge Interview Experience | Set 2 (For PHP-MySQL Developer Profile)

Last Updated : 24 Jun, 2015
Improve
Improve
Like Article
Like
Save
Share
Report

Recently I got interviewed at infoedge for PHP-MYSQL (LAMP) developer profile their naukri .com site.

Round 1
It was a written round:
7 ques, 20 marks in total, 40 mins
Q1. Write a program to find intersection of 2 strings with non-repeating characters.
Q2. Mention the differences between primary key and unique key.
Q3. Write a function which intakes an integer array. Swap the max element and the second
Lowest element of the array keeping the position of rest of the elements as previous i.e unchanged.
Q4. Puzzle: 9 balls with 1 heavier ball in them and a 2 pan balance is provided, find the minimum number of attempts required to find the heavier ball.
Ans: 2 (According to me)
Q5: How many print statements for f(4,a,b,c) :

    f(n,a,b,c)
    {
      if (n==0)
      {
           printf(“\n a=%d b= %d c= %d”,a,b,c);
      }
      else
      {
           F(n-1,c,a,b);
           printf(“\n a=%d b= %d c= %d”,a,b,c);
           F(n-1,b,c,a);
       }
    } 

Ans: 31 (According to me)

Q6. Find Value of f(3,2)

 
  f(int m,int n)
  {
      int  val = 1;
      if (n%2==1)
         val = val*m;
      else if (n/2 ==1)
         val = val*f(m*m,n/2);
      return val;
   }

Ans: 9 (According to me)

Q7. Write Sql queries to do following task:
a) Find all teachers who have courses other than math.
b) Find all student names who have atleast one subject taken by a lady teacher

Tables such as COURSE, TEACHER, STUDENT etc were given.

Round 2
Interview with VP-Tech
After introducing himself as Abhishek he began his chain of questions which encompassed
OOPS, RDBMS, DS, ALGO
Q1. Can constructors be private. If yes then how to get an instance of such a class
Basically a question about singleton class
Q2. Write a query to fetch all the people with their birthdays today from a table which is as follows:
NAME | DAY OF BIRTH (INT) |MONTH OF BIRTH (INT)|YEAR OF BIRTH

Ans: Select Name from table T where( DAY_OF_BIRTH=today AND MONTH_OF_BIRTH=this_month)
Q3. What is indexing. How you will index the above table data.
Q4. Remove extra parenthesis to form the correct equation, write full working code .
Note: Redundant parenthesis are not to be removed only extra ones are to be removed

e.g.    input :	(((((a+b)*c))+((d+e)))))*f))))))))))
        output: (((((a+b)*c))+((d+e)))))*f 

Ans . Javacode: done in O(n)




package remove_extra_parenthesis;
import java.util.*;
  
class stackelement
{
    char element;
    int index;
    stackelement()
    {
        element = 'a';
        index = 0;
    }
    stackelement(char cc, int in)
    {
        element = cc;
        index = in;
    }
}
  
public class removal
{
    public static void main(String[] args)
    {
        // TODO Auto-generated method stub
        Scanner sc=new Scanner(System.in);
        stackelement se = new stackelement();
        stackelement check = new stackelement();
        System.out.println("Please enter elements...");
        String s= sc.nextLine();
        char a[]= new char[s.length()];
        Stack<stackelement> st = new Stack();
        for(int i=0; i<s.length(); i++)
        {
            a[i]= s.charAt(i);
            se.element=s.charAt(i);
            se.index=i;
  
            if( se.element == '(' )
            {
                st.push(new stackelement(se.element,se.index));
                System.out.printf("pushing %c which was at index %d 
                                   inside \n",se.element,se.index);
            }
  
            if(se.element == ')')
            {
                if (st.isEmpty())
                {
                    a[se.index]='$';
                }
                else if(st.peek().element != '(')
                {
                    a[se.index]='$';
                    System.out.printf("peeking  %c which was at index %d inside, 
                    setting dollar to %c at index %d \n",
                    st.peek().element,st.peek().index,se.element,se.index);
                }
                else
                {
                    check=st.pop();
                    System.out.printf("poping1 %c which was at index %d inside \n",
                                       check.element,check.index);
                }
            }
        }
        while(!st.isEmpty())
        {
            check=st.pop();
            a[check.index]='$';
            System.out.printf("poping2 %c which was at index %d inside \n",
                               check.element,check.index);
        }
  
        //char first=st.pop().element;
        for(int i=0; i<s.length(); i++)
        {
            if(a[i]!='$')
                System.out.printf("%c",a[i]);
        }
        //System.out.printf("idiot %c",first);
    }
}


Some other variants of this question which I found online:
http://stackoverflow.com/questions/13204483/remove-extra-parenthesis
http://www.careercup.com/question?id=12011927

Q5. Write full working code for pattern

                                    	1
                                1   	2       1       	
                 	1  	2       3    	2 	1
           	1 	2       3    	4   	3      2	1
                   	1	2        3   	2  	1
                         	1     	2    	1
                                    	1

After this round they told me to leave for the day and for next rounds we will let me know you, if I am through this round at a later date.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads