Join Regular Classroom : Visit ClassroomTech

Capgemini Overall Interview Questions + Coding solutions – codewindow.in

Hot Topics

Capgemini Solution

Technical Round

What can you do to a method in a parent class so that it’s not overridden by a method in child class with same name?

If we put a final keyword before the method then method overriding can be avoided.

Describe some real life applications of machine learning.

Machine learning in real life can be used for
  • Image recognition
  • Speech recognition
  • Predictive analysis

What is static method?

Static is keyword and by putting it in front of any method we do not need to create an object of the class to access the method. 

Swap two numbers without using temp variable.

#include <stdio.h>

int main() {
    int a,b;
    printf("Enter the value of a: ");
    scanf("%d",&a);
    printf("Enter the value of b: ");
    scanf("%d",&b);
    a=a-b;
    b=a+b;
    a=b-a;
    
    printf("After swapping the value of a is:%d\n",a);
    printf("After swapping the value of b is:%d",b);

    return 0;
}

/*
INPUT:
Enter the value of a: 5
Enter the value of b: 4

OUTPUT:
After swapping the value of a is:4
After swapping the value of b is:5
*/

What is the use of pass in Python?

In Python pass statement is used as a placeholder for the future code i.e. if we write a function and put pass in it then the code will be executed without giving an error.

What is an IP address?

IP stands for internet protocol address which is a numeric value assigned to a network for identification and location of a network device. There are two types of IP:
  • Static IP
  • Dynamic IP

Write a code to determine if a string has duplicate characters.

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

bool uniqueCharacters(char str[]);

int main() {
    
    char str[] = "CodeWindow";
    
    if (uniqueCharacters(str)) {
         printf("String has no duplicate characters");
    }
    else {
         printf("String has duplicate characters");
    }
    
    return 0;
}

bool uniqueCharacters(char str[])
{
 
    for(int i=0;i<strlen(str);i++){
        for (int j = i + 1; j < strlen(str); j++) {
            if (str[i] == str[j]) {
                return false;
            }
        }
    }
    return true;
}
/*
output:
String has duplicate characters
*/

A company has a share of 100 $. It went down by 20 %. Again it went down by 20%. How much increase in percentage is required to get back to 100$.

If the company's share initially was 100 $ and it went down by 20%, then it is now at 100 - (100 * 20%) = 100 - 20 = 80 $.
Then, if the share went down by another 20%, it is now at 80 - (80 * 20%) = 80 - 16 = 64 $.
So, to get back to 100 $, the share price needs to increase by 100/64 - 1 = 56.25%.

What is OOPs inheritance and overloading?

In Java OOPs inheritance is a concept of Object Oriented Programming in which a new class is created from the existing one. Overloading is achieved when we create multiple methods with the same name inside a single class and each method works differently.

What is <include> in C language and can we use something else instead of <> this angular bracket?

<include> here means we are adding the code in the header file to the source code.
Yes we can use double quotation “ ” instead of <>.
What is the difference between String Builder and String Buffer?
String Builder
String Buffer
1.    String Builder was introduced in Java 5
String Buffer was introduced when Java program was launched
2.    It is not synchronized
It is synchronized
3.    String builder is faster than string buffer as it is not thread safe
String buffer is slower as it is thread safe i.e. it can’t access multiple threads at the same time
 
Can we have static method in abstract class?
Yes we can have static method in abstract class

What was your final year project?

Tell your project topic & describe it.

What was your role in the project?

Tell about your project role.

What is malloc() function? 

malloc function in C is used to dynamically allocate a single large block of memory with the specified size. It returns a pointer of type void which can be cast into a pointer of any form. It initializes each block with default garbage value. 

What is the difference between interface and abstract class?

Interface
Abstract class
1.    Interface supports the concept of multiple inheritance.
Abstract class doesn’t support the concept of multiple inheritance.
2.    Interface has only abstract methods.
Abstract class can have non-abstract method but it must have at least one abstract method.
3.    Interface keyword is used to declare interface
Abstract keyword is used to declare Abstract class.
4.    Interface has members as public by default.
Abstract class in Java can have private, protected, public and default class members.
5.    Interface supports multiple inheritance.
Abstract class does not support multiple inheritance.
 

A SQL query to write tables and to join those tables by right and left joins.

Here's an example of how you can write a SQL query to join two tables using both right and left join:
SELECT *
FROM table1
LEFT JOIN table2
ON table1.column1 = table2.column2
UNION
SELECT *
FROM table1
RIGHT JOIN table2
ON table1.column1 = table2.column2;

How can you do dynamic memory allocation in C?

In C programming language dynamic memory allocation can be done by using the following methods:
  • malloc() – It is also known as memory allocation. It is a method used in C to dynamically allocate a single large block of memory with the specified size.
Syntax: ptr = (caste_type*)malloc(byte size);
  • calloc() – It is also known as contiguous allocation. It is a method used in C to dynamically allocate the specified number of blocks of memory of the specified type.
Syntax: ptr= (caste_type*)calloc(n, ele_size);
  • realloc() – Modify the size of previously allocated space.
Syntax: ptr= realloc(ptr.newsize);
  • free() – free is previously allocated space.
Syntax: ptr=free(ptr);

The logic of Armstrong number program.

A positive integer of n digits is called an Armstrong number of order n (order is number of digits) if. 
abcd… = pow(a,n) + pow(b,n) + pow(c,n) + pow(d,n) + …. 

Nagarro Solved

Automata Fixing

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories