Top 30 Wipro interview questions for freshers

Top 30 Wipro interview questions for freshers

  1. Do you know what is an IP address and what is it used for?
    Ans. Each computer connected to the internet has a unique number assigned which distinguishes its presence in the network. This number is referred as IP address. If a computer does not have one then it won’t be able to communicate with other computers in the network. It serves few important functions like host or network interface identification and location addressing.
  2. What is the difference between HTTP and HTTPS?
    Ans.
HTTP HTTPS
Hyper Text Transfer Protocol is a less secure as the data is vulnerable to attacks. Hyper Text Transfer Protocol Secure is more secure and prevents information from being attacked.
It uses the port 80 by default It uses the port 443 by default
HTTP does not scramble the data to be transmitted It scrambles the data before transmission and upon receiving it descrambles the data
HTTP website do not need SSL It needs SSL encryption
It does not improve search rankings As it is more secure and preferred it improves search rankings
Faster than HTTPS network protocol Slower than HTTP but more secure
More vulnerable to attacks Highly secure due to encryption
  1. What is a primary key?
    Ans. A primary key is used to uniquely identify each record in a table. It must contain unique values and cannot be null. A table can have only one primary key. It is defined by mentioning primary key constraint.
  2. Write a program to print the pattern:
    1*2*3*4*17*18*19*20 
    5*6*7*14*15*16
    8*9*12*13 
     10*11

    Ans.

    #include <stdio.h>  
    #include<conio.h>  
    int main(void) {  
    int a=0,b=0,i,j,N=4,k,l;    
    for(i=N; i >=1;i--)   
    {  
    for(j=N; j>i; j--)  
    printf(" ");  
    for(k=1;k<=i; k++)  
    printf("%d%s",++a, "*");    
    for(l=1;l<=i; l++)   
    {  
    printf("%d", ++b + i * i);  
    if(l!=i)  
    printf("*");  
    }  
    printf("\n");  
    }     
    return 0;  
    }  
  3. What are the functionalities of an operating system?
    Ans. The various functionalities of OS are –

    • It acts as an interface between the computer and user using GUI, command lines etc.
    • It assigns the process to a CPU and hence optimises any task performed by the computer.
    • It also manages peripheral devices and improves I/O operations.
    • It provides file management system which stores data for future access and improves the access time.
  4. What is difference between SQL and No SQl database?
    Ans.
SQL NoSQL
These are relational databases These are known as non-relational database
These use structured query language and have a schema These have dynamic schema
SQL databases are table based These are document based, graph based
SQL databases are good for multirow transactions These are good for unstructured data or JSON.
  1. What do you mean by SQL profiler?
    Ans. SQL profiler is a utility service provided by SQL to check whether the connection to SQL server is set up or not and which SQL scripts are running and which one is getting failed.
  2. What do you mean by process and thread?
    Ans. A thread is a light weighted sub process which is also considered as the smallest processing unit. It has a different path of execution and share resources with different other threads of the same process. The process is a heavy weight program consisting of multiple threads.
  3. What are Multi-Processing and Multitasking?
    • Multitasking: As the name indicates multiple tasks run on a single CPU. We use multitasking to utilize the CPU.
    • Multitasking can be achieved in two ways:
      • Process-based Multitasking (Multiprocessing)
      • Thread-based Multitasking (Multithreading)
    • Multi-processing: Multi-processing refers to the ability of a system to support more than one central processing unit at the same time.
      • Multithreading: As the name indicates multiple threads run concurrently.
  4. What are the conditions for deadlock?
    Ans. The following conditions if satisfied then the process is considered to be in deadlock –

    • Mutual Exclusion: When two process share same resource and both of the process are different then each of them wait for the other to utilise the resource.
    • Hold and Wait: When two resources wait for each other and do not get executed.
    • No pre-emption: This means we cannot force stop or remove one process among the waiting processes.
    • Circular Wait: When a process is waiting for a resource being hold by another process which is again waiting for a resource hold by the first one, this cyclic wait is called circular wait. This leads to deadlock.
  5. What are the objects in DBMS you know about?
    Ans. Database uses various kind of objects to store the elements. There can be various objects for this like –

    • View: This is basically a virtual table It can be derived from multiple tables and assist in faster modifications of the table elements.
    • Table: This is use to create a table using CREATE TABLE statement.
    • Index: Index provides a key value type of storage which gives optimised and faster lookup time in the database.
    • Sequence: This command is used to create a sequence in the database.
    • Synonym: This object is also used for creating indexes in database.
  6. What is the difference between left join and right join?
    Ans. Left join refers to the join when all the rows of the left table is shown corresponding to the right table and also those tuples where the left table does not match with right table. Those values are left as null. Right join is basically just the opposite, all of tuples of the right table are included along with whose left values are not present and such values are kept as null.
  7. What is Polymorphism?
    Ans. In object-oriented programming languages, polymorphism means the same code can be used for a different object very differently. It basically means many forms, so the same function can have different type of implementation with various other arguments and parameters.
  8. Can a class inherit the constructors of its super class?
    Ans. A class cannot inherit the constructors from any of its super class.
  9. What is the difference between truncate and delete commands in sql?
    Ans. While truncate removes the data permanently and cannot be rolled back, delete provides the option of rolling back after deletion of data.
  10. Now when you know to reverse a number, can you try to check whether a number is a palindrome or not?
    Ans. (Palindrome is a number which when reversed we get the same value)

    #include <iostream>
    using namespace std;
    int reverse(int a){
    int res = 0;
    while(a!=0){
        int dig = a%10;
        res = res*10 + dig;
        a =a/10;
    }
    return res;
    }
    int main() {
    int a = 1221;
    int b = reverse(a);
    if(a == b)
        cout<<"Palindrome";
    else
        cout<<"Not palindrome";
    return 0;
    }
    Output: Palindrome
  11. What is the difference between malloc() and calloc()?
    Ans.
Malloc() Calloc ()
Malloc () function will create a single block of memory specified by the user. Calloc () can assign multiple blocks of memory.
Malloc() is faster but less secure It is slower but more secure
It does not initialize memory It initialises memory to 0
Returns only the starting address but does not make it 0 Returns the starting address and makes it 0
  1. Do you know what is JVM?
    Ans. JVM is called the Java Virtual Machine is an engine that provides run time environment to java programs. It converts Java machine code to byte code. It is platform independent as byte code is platform independent. It is also a prat of the JRE java run time environment.

  2. What do you mean by DOM?
    Ans. DOM or Document Object Model is basically a cross platform and language independent interface that treats a html or xml data as a tree data structure. For example, to understand when we write an html script the header, body etc are considered as a branch of tree and each of these branches can have various other listed branches in it.

  3. Write the Bubble sort algorithm.
    Ans. CPP Code -

    #include<iostream>
    using namespace std;
    void bubbleSort(int *array, int size) 
    {
    for(int i = 0; i<size; i++) {
      int swaps = 0;          
      for(int j = 0; j<size-i-1; j++) 
      {
         if(array[j] > array[j+1])
         {
             swap(array[j], array[j+1]);
            swaps = 1;    
         }
      }
      if(!swaps)
         break;      
    }
    }
    int main() 
    {
    int n;
    cin >> n;
    int arr[n];     
    for(int i = 0; i<n; i++) 
      cin >> arr[i];
    bubbleSort(arr, n);
    for(int i = 0; i<n; i++) 
    cout<<arr[i];
    return 0;
    }
    Input: 4 3 5 2 1
    Output: 1 2 3 4 5

    Time Complexity:O(n2)

  4. Find whether a number is prime or not.
    Ans. Idea is to check for all the numbers below it and check if it divides our given number.

    #include <iostream>
    using namespace std;
    int main() {
    int a = 23;
    int b = 2;
    //start from b as 1 can divide any number
    bool prime = true;
    while(b!=a){
        if(a%b == 0)
            {
                prime = false;
                break;
            }
        b++;
    }
    if(prime)
    cout<<"prime";
    else cout<<"not prime";
    return 0;
    }
    Output: prime
  5. Write a program to find the reverse of a number.
    Ans. (try to get each digit and multiply with its corresponding power of 10)

    #include <iostream>
    using namespace std;
    int main() {
    int a = 1223;
    int res = 0;
    while(a!=0){
        int dig = a%10;
        res = res*10 + dig;
        a =a/10;
    }
    cout<<res;
    return 0;
    }
    Output: 3221
  6. Write a program to convert a binary number to octal.
    Ans. First convert binary to decimal and then we can convert the decimal to octal easily.

    #include<stdio.h>
    #include<math.h>
    int Binary2Octal(int number){
    int octal=0,value, i=1,lastDigit;
    while( number != 0){
        lastDigit = number % 1000;
        value = Binary2Decimal(lastDigit);
        octal = octal + value * i;
        i = i * 10;
        number = number / 1000;
    }
    return octal;
    }
    int Binary2Decimal(int number){
    int decimal=0, i=0,lastDigit;
    while( number != 0){
        lastDigit = number % 10;
        number = number / 10;
        decimal = decimal + lastDigit * pow(2,i);
        i++;
    }
    return decimal;
    }
    int main(){
    int number,octal;
    scanf("%d",&number);
    octal = Binary2Octal(number);
    printf( "" %d \n",octal);
    }
  7. an you write a program to find the second largest element? Do not use sorting.
    Ans.

    #include<stdio.h>
    #include<limits.h>
    int main(){ 
    int arr[] = {2,25,12};
    int largest,second_largest,i;
    int arr_size = sizeof(arr)/sizeof(int); 
    for(i=0;i<arr_size;i++){
        printf("arr[%d] = %d\n",i,arr[i]);
    }
    largest = second_largest = INT_MIN;
    for(i=0;i< arr_size;i++){
        if(largest < arr[i]){
            second_largest = largest;
            largest = arr[i];
        }else if( arr[i] < largest && arr[i] > second_largest)
        {
            second_largest = arr[i];
        }
    }printf("%d\n", second_largest);
    }
  8. Write a program to merge two unsorted order in sorted order.
    Ans.

    #include <bits/stdc++.h>
    using namespace std; 
    void sortedMerge(int a[], int b[], int res[], int n, int m)
    {
    int i = 0, j = 0, k = 0;
    while (i < n) 
    {
    res[k] = a[i];
    i += 1;
    k += 1;
    }
    while (j < m) {
    res[k] = b[j];
    j += 1;
    k += 1;
    } 
    sort(res, res + n + m);
    } 
    int main()
    {
    int a[] = { 10, 5, 15 };
    int b[] = { 20, 3, 2, 12 };
    int n = sizeof(a) / sizeof(a[0]);
    int m = sizeof(b) / sizeof(b[0]); 
    int res[n + m];
    sortedMerge(a, b, res, n, m); 
    for (int i = 0; i < n + m; i++)
    cout << ” ” << res[i];
    return 0;
    }
  9. What are the conditions for deadlock?
    Ans. The following conditions if satisfied then the process is considered to be in deadlock –

    • Mutual Exclusion: When two process share same resource and both of the process are different then each of them wait for the other to utilise the resource.
    • Hold and Wait: When two resources wait for each other and do not get executed.
    • No pre-emption: This means we cannot force stop or remove one process among the waiting processes.
    • Circular Wait: When a process is waiting for a resource being hold by another process which is again waiting for a resource hold by the first one, this cyclic wait is called circular wait. This leads to deadlock.
  10. Write a program to find the sum of the digits of a number.
    Ans. Extract each digits and add them.

    #include<bits/stdc++.h>
    using namespace std;
    int digitSum(int n)
    {
    int sum = 0;
    while(n > 0 || sum > 9)
    {
        if(n == 0)
        {
            n = sum;
            sum = 0;
        }
        sum += n % 10;
        n /= 10;
    }
    return sum;
    } 
    // Driver program to test the above function
    int main()
    {
    int n = 145;
    cout << digitSum(n);
    return 0;
    }
    Output: 10
  11. What is difference between UNIQUE and PRIMARY KEY constraints?
    Ans. We can have more than one unique key in a table but we can have only one primary key to uniquely identify a tuple. Primary key cannot accept null as an input while unique key can but for only once. Primary key is defined by placing PRIMARY KEY constraint while UNIQUE is used to specify a column as unique key.

  12. Do you know about active and passive objects?
    Ans. Active objects are those which can interact with control its own threads whereas a passive object is one which waits for the message to be processed.

  13. Write a program to find the nth Fibonacci number.
    Ans.

    long nthFibonacci (int input1) {
        long first = 0, second = 1, sum;
        for (int i = 1; i < input1; i++) {
            sum = first + second;
            first = second;
            second = sum;
        }
        return first;
    }    
    int main(){
        int n;
        cin>>n;
        cout<<    nthFibonacci(n);
        return 0;
    }

    Hope these questions will help you prepare well before Wipro Interview and to crack it.

Previous post Practice java programs for interview
Next post Linked list on C++

Leave a Reply

Your email address will not be published. Required fields are marked *