Technical Questions asked in Zomato

  1. What will be output of following program?
    #include

    int main(){
    int i = 100;
    printf("value of i : %d addresss of i : %u",i,&i);
    i++;
    printf("\nvalue of i : %d addresss of i : %u",i,&i);
    return 0;
    }


     
    1. A. value of i : 100 addresss of i : Address value of i : 101 addresss of i : Address
    2. value of i : 100 addresss of i : Address value of i : 100 addresss of i : Address
    3. value of i : 101 addresss of i : Address value of i : 101 addresss of i : Address
    4. Compilation error
    Answer: Option A.
    Within the scope of any variable, value of variable may change but its address will never change in any modification of variable.
  2.  What is meaning of following declaration? int(*ptr[5])();
    1. ptr is pointer to function.
    2. ptr is pointer to array of function.
    3. ptr is pointer to such function which return type is array.
    4. ptr is pointer to array of function.
    Answer: Option B.
    Here ptr is array not pointer.
deloitte article
  1. What will be output if you will compile and execute the following c code? #include
    int main(){
    const int x=25;
    int * const p=&x;
    *p=2*x;
    printf("%d",x);
    return 0;
    }

     
    1. 25
    2. 50
    3. 0
    4. Compiler error
    Answer: Option B.
  2. Analyse the following code snippet and choose the answer:-
    #include Class Temp { private:
    int m_ival;
    public:
    Temp()
    {
    Cout<<"OBJECT CREATED\n"< }
    ~Temp()
    {
    Cout<<"OBJECT DESTROYED\n"< }
    };
    void fnRead()
    {
    Temp oTempObj;
    }
    int main()
    {
    fnRead();
    cout<<"IN MAIN \n"< return 0;
    }
    1. OBJECT CREATED OBJECT DESTROYED
    2. OBJECT CREATED OBJECT DESTROYED IN MAIN
    3. OBJECT CREATED IN MAIN
    4. Compilation Error
    Answer: Option B.
  3. Observe the following code and chose the correct statement(s)
    class Name
    {
    const char *s ;.
    };
    class Table
    {
    Name *p; size_t sz ; public :
    Table(size_ts = 15) {p = new Name [sz = s]; }
    ~Table() {delete [ ]p ;}
    Name * lookup(const char *);
    bool insert(Name *);
    };
    1. ~Table() is a destructor
    2. p is of Table type
    3. Both A and B
    4. insert() is a method which returns nothing
    Answer: Option A
  4. Which of the following are essential features of object-oriented programming languages? 
    • Abstraction and encapsulation
    • Strictly-typedness
    • Type-safe property coupled with sub-type rule
    • Polymorphism in the presence of inheritance
    1. 1. 1 and 2 only
    2. 1 and 4 only
    3. 1,2 and 4 only
    4. 1,3 and 4 only
    Answer: Option B.
    Object oriented programming language is Object based PL+Abstraction + Inheritance. The last two (abstraction and inheritance) are must for any L to be OOPL.
Campus Placement ad
Rate Us
Views:5683