Publicis Sapient
10+ McCain Foods Interview Questions and Answers
Q1. What is limit for no of arguments passed to functions? if limit is 10 den how to pass more parameters? Ans:- either Array or Structure
The limit for the number of arguments passed to functions is not fixed. Arrays or structures can be used to pass more parameters.
The limit for the number of arguments passed to functions is not fixed and depends on the programming language and system architecture.
In C programming language, there is no limit on the number of arguments that can be passed to a function.
In Java, the maximum number of arguments that can be passed to a method is 255.
To pass more parameters than the...read more
Q2. There is 2 pot one red and one blue. one pot contains tressure. Two statement are given 1. only one of the statement is correct. 2. Blue pot has the tressure. Find the tressure?
The treasure is in the red pot.
The statement 'only one of the statement is correct' means that one statement is true and the other is false.
If the blue pot has the treasure, then both statements would be true, which contradicts the given information.
Therefore, the statement 'Blue pot has the treasure' must be false, and the treasure must be in the other pot, which is the red pot.
Q3. What is difference between Static and Global Vaiable?
Static variables have local scope but retain their value between function calls, while global variables have global scope.
Static variables are declared inside a function and retain their value between function calls
Global variables are declared outside of any function and can be accessed from any part of the program
Static variables have local scope, while global variables have global scope
Static variables are initialized only once, while global variables are initialized at th...read more
Q4. What is difference between if else and switch case statements?
if else is used for simple conditions while switch case is used for multiple conditions.
if else is a sequential decision-making statement while switch case is a multi-branch decision-making statement
if else is used when there are only a few conditions to be checked while switch case is used when there are multiple conditions to be checked
if else can have multiple conditions in a single statement while switch case can only have one condition per case
if else is more readable an...read more
Q5. Plant 10 plants in 5 rows such that each row has 4 plants
10 plants can be planted in 5 rows with 4 plants in each row.
Divide the plants into groups of 4.
Arrange the groups in 5 rows.
Each row will have 4 plants.
Q6. what are 3 steps for using function in c?
Three steps for using functions in C.
Declare the function with its return type, name, and parameters.
Define the function by writing the code for it.
Call the function by using its name and passing arguments if necessary.
Q7. What is a stack and various operations on it?
A stack is a data structure that follows the Last In First Out (LIFO) principle.
Push: adds an element to the top of the stack
Pop: removes the top element from the stack
Peek: returns the top element without removing it
IsEmpty: checks if the stack is empty
Size: returns the number of elements in the stack
Q8. What is Difference between C,C++?
C is a procedural programming language while C++ is an object-oriented programming language.
C is a low-level language while C++ is a high-level language.
C++ supports object-oriented programming concepts like classes, inheritance, and polymorphism.
C++ has better support for exception handling and templates.
C++ is more complex than C and requires more memory.
C++ is used for developing applications like video games, while C is used for developing operating systems and system sof...read more
Q9. Find the output:- a=5;b=4;c=++a+b--; find c?
Find the output of c=++a+b-- where a=5 and b=4.
The value of a is incremented by 1 before the addition operation
The value of b is decremented by 1 after the addition operation
The final value of c is 10
The value of a becomes 6 and the value of b becomes 3
Q10. What is static variable?
A variable that is associated with a class rather than with instances of the class.
Static variables are declared using the static keyword.
They are initialized only once, at the start of the program execution.
They retain their value throughout the program's execution.
They can be accessed without creating an instance of the class.
Example: public static int count = 0;
Q11. What are member functions?
Member functions are functions that are defined inside a class and can access the class's private and protected members.
Member functions are also known as methods.
They can be used to manipulate the data members of an object.
They can be overloaded, meaning multiple functions with the same name but different parameters can exist within a class.
They can be declared as const, meaning they do not modify the object's state.
Example: class Car { void start(); void stop(); };
Example: ...read more
Q12. What is a class?
A class is a blueprint for creating objects that have similar attributes and behaviors.
Classes are used in object-oriented programming.
They define the properties and methods that objects of that class will have.
Objects are instances of a class.
Classes can inherit properties and methods from other classes.
Examples of classes include 'Person', 'Car', and 'Animal'.
Q13. What is an object?
An object is a self-contained entity that contains data and behavior.
An object is an instance of a class.
It has attributes (data) and methods (behavior).
Objects can interact with each other through their methods.
Examples include a car object with attributes like color and model, and methods like start and stop.
Another example is a person object with attributes like name and age, and methods like walk and talk.
Q14. What are pointers?
Pointers are variables that store memory addresses of other variables.
Pointers allow for dynamic memory allocation and manipulation.
They are commonly used in programming languages like C and C++.
Example: int *ptr; // declares a pointer to an integer variable
Example: ptr = # // assigns the memory address of num to ptr
Example: *ptr = 5; // assigns the value 5 to the variable pointed to by ptr
Q15. what are structures?
Structures are arrangements of elements that form a framework or framework-like support.
Structures can be found in various fields such as engineering, architecture, and biology.
They can be made of different materials such as steel, wood, or bone.
Examples include bridges, buildings, and the skeletal system.
Structures can be designed to withstand different types of forces such as compression, tension, or bending.
Q16. What is union?
A union is an organization formed by workers to protect their rights and interests in the workplace.
Unions negotiate with employers for better wages, benefits, and working conditions.
They also provide support and representation for workers in disputes with management.
Membership in a union is voluntary, but members pay dues to support the union's activities.
Unions can be industry-specific, such as the United Auto Workers, or general, such as the AFL-CIO.
Unions have played a si...read more
Q17. Exceptions handling in java?
Exceptions handling is a mechanism to handle runtime errors in Java programs.
Exceptions are objects that are thrown at runtime when an error occurs
Java provides try-catch-finally blocks to handle exceptions
Checked exceptions must be handled or declared in the method signature
Unchecked exceptions can be handled or left unhandled
Custom exceptions can be created by extending the Exception class
Top Consultant Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month