ZS Associates Technical Interview Questions

ZS Associates Technical Interview Questions and Answers 2023

This page includes the most recently asked technical questions in the ZS Associates Interview 2023.

Page Highlights:

  • Top 20 ZS Associates Technical Interview Questions

  • ZS Associates Technical Interview Questions

    Top 20 ZS Associates Technical Interview Questions

    Question 1: What is the difference between JAVA and C++?

    C++Java
    C++ is platform-dependent and must be compiled on each platform.Java is platform-independent. It can be executed on any platform once it has been compiled into bytecode.
    Manual memory management is required in C++.The operating system handles memory management in Java.
    Documentation comments are not supported in C++.Java includes comments support, allowing developers to include documentation in their source code.
    C++ is an object-oriented and procedural programming language.Java is a completely object-oriented programming language.
    The source code of C++ is unrelated to filenames.File names should correspond to any classes because the Java source code treats files as classes.

    Question 2:- Why is C not an OOP language?

    Answer:

    C is not strictly object-oriented since it lacks a built-in syntax that allows object-oriented capabilities such as classes, inheritance, and so on.

    Question 3: What are polymorphism and abstraction?

    Answer:

    Abstraction means that there is no particular detail of something.

    Polymorphism refers to techniques that are shared by multiple objects yet perform different tasks.

    Questions 4: Discuss garbage collectors in Java.

    Answer:

    Garbage in Java refers to unreferenced objects. Garbage collection is the process of automatically reclaiming runtime unneeded memory. In other terms, it is a method of disposing of unwanted items. To do this, we used the free() function in C and delete() in C++. However, in Java, it is done automatically.

    Question 5: Write a program to demonstrate a switch statement.

    main()
    {
     char op;
     float num1, num2;
     cout << "Enter operator either + or - or * or /: ";
     cin >> op;
     cout << "Enter two operands: ";
     cin >> num1 >> num2;
    
     switch(op)
     {
       case '+': cout << num1+num2;
                 break;
       case '-': cout << num1-num2;
                 break;
       case '*': cout << num1*num2;
                 break;
       case '/': cout << num1/num2;
                 break;
       default: //if case label not available
                 cout << "select valid choice";
                 break;
    }
    }
    						

    Question 6: What is the advantage of using #define to declare a constant?

    Answer:

    Declaring a constant with the #define method allows you to declare it once and use it throughout your program. This makes your programs easier to maintain because you only need to keep the #define statement and not many instances of individual constants throughout your program.

    Question 7: What is a stream?

    Answer:

    A stream can be defined as a data sequence. There are two kinds of streams.

    InputStream: This class is used to read data from a source.

    OutPut Stream: A data stream that is used to write data to a destination.

    Question 8: Define scheduling in OS.

    Answer:

    Scheduling is a process for allocating important computer resources, such as processor time, bandwidth, and memory, to the processes, threads, data flows, and applications that require them.

    Questions 9: List various phases of the SDLC.

    Answer:

    Various phases of the Software Development Life Cycle are:

    • Planning
    • Analysis
    • Design
    • Development
    • Testing
    • Implementation
    • Maintainance

    Question 10: What are inner and outer joins?

    Answer

    Inner Joins: When there are matching values in a field shared by both tables, an inner join is used to combine records from both tables.

    Outer Joins: Outer joins return both matched and unmatched values from any or both tables.

    Question 11: Define paging and deadlock.

    Answer

    Paging is a memory management strategy that avoids the necessity for contiguous allocation of physical memory. This protocol enables processes to have non-contiguous physical address spaces. 

    A deadlock occurs when two computer programs that share the same resource effectively prevent each other from accessing the resource, resulting in both programs ceasing to operate. The first computer operating systems could only run one program at a time.

    Question 12: Is the exit() function the same as the return statement? Explain.

    Answer:

    No. You can end your program and give the operating system back control by using the exit() function. The return statement is used to exit a function and hand control back to the caller function.

    Question 13: What is the function of this pointer?

    Answer:

    This pointer is a pointer that may be accessed exclusively from non-static member functions of a class, struct, or union type. It denotes the object for which the member function is invoked. In static member functions, this pointer does not exist.

    Question 14: Tell us the difference between merge and quick sort.

    Quick SortMerge Sort
    An effective sorting algorithm is a systematic way of arranging the elements of an array.A comparison-based sorting algorithm that is efficient and general-purpose.
    Sorts the items by comparing them all to the pivot.Divides the array into two subarrays (n/2) until there is only one element left in the array.
    Ideal for small arraysWorks with any array type.
    For small data sets, it works faster.Works with a constant speed across all datasets.
    Space is limited.More space is required.
    Large arrays are inefficient.More effective.

    Question 15: What is a memory leak in C++?

    Answer:

    A memory leak is a form of esource leak in computer science that occurs when a computer software wrongly manages memory allocations in such a way that no longer needed memory is not released. A memory leak can also occur when an object is saved in memory but is inaccessible to the executing process.

    Question 16: Briefly explain the concept of Virtual Memory.

    Answer:

    Virtual memory is a method that is commonly utilized in computer operating systems (OS). Virtual memory enables a computer to compensate for physical memory shortages by temporarily shifting data from random access memory (RAM) to disc storage.

    Question 17: Discuss iteration statements in C++.

    Answer:

    C++ has four iteration statements: while, do, for, and range-based for. 

    Each of these loops iterates either until the termination expression evaluates to zero (false) or until a break statement forces the loop to end.

    Question 18: Write a program in C to print Fibonacci Series.

    #include 
    int main()
    {
    int n, first = 0, second = 1, next, c;
    printf("Enter the number of terms\n");
    scanf("%d", &n);
    printf("First %d terms of Fibonacci series are:\n", n);
    for (c = 0; c < n; c++)
    {
    if (c <= 1)
    next = c;
    else
    {
    next = first + second;
    first = second;
    second = next;
    }
    printf("%d\n", next);
    }
    return 0;
    }
    						

    Question 19: Write a program to calculate the factorial of an integer.

    #include
    int main ()
    {
        int num = 5, fact = 1;
        
        // Can't calculate factorial of a negative number
        if(num < 0)
            printf("Error");
        else
        {
            for(int i = 1; i <= num; i++)
                fact = fact * i;
        }
        
        printf("Fact %d: %d",num, fact);
    }
    // Time complexity: O(N)
    // Space complexity: O(1)
    						

    Question 20: Define array in Java.

    Answer:

    An array in Java is an object that includes components of the same data type. Array elements are kept in a contiguous memory area. It is a data structure in which comparable elements are stored. A Java array can only hold a fixed number of elements.