Hello everyone, in this article we have covered some very important interview questions for sapient interview to help you in boosting your prepration.
Sapient Interview Questions for Freshers
Go through the below written questions for sapient interview to do your prepprations well.
Question 1. What Is the Difference Between Static and Dynamic Loading?
Answer. Static class loading involves the creation of objects and instances using new keywords, and dynamic class loading is done when the name of the class is not known at compile time.
Question 2. Explain public static void main(String args) in Java.
Answer. main() in Java is the entry point for any Java program. It is always written as public static void main(String args).
public: Public is an access modifier, which is used to specify who can access this method. Public means that this Method will be accessible by any Class.
static: It is a keyword in java which identifies it is class-based. main() is made static in Java so that it can be accessed without creating the instance of a Class. In case, main is not made static then the compiler will throw an error as main() is called by the JVM before any objects are made and only static methods can be directly invoked via the class.
void: It is the return type of the method. Void defines the method which will not return any value.
main: It is the name of the method which is searched by JVM as a starting point for an application with a particular signature only. It is the method where the main execution occurs.
String args: It is the parameter passed to the main method.
Question 3. How will you measure the Euclidean distance between the two arrays in numpy?
Answer. In order to measure the Euclidean distance between the two arrays, we will first initialize our two arrays, then we will use the linalg.norm() function provided by the numpy library. Here, numpy is imported as np.
a = np.array([1,2,3,4,5])
b = np.array([6,7,8,9,10])
e_dist = np.linalg.norm(a-b)
With data integrity, we can define the accuracy as well as the consistency of the data. This integrity is to be ensured over the entire life-cycle.
Question 4. What does a ‘?’ sign in device manager indicate?
Answer. When this sign appears, it indicates the device is not properly installed. Such problem arises in case of brand new plug-in cards.
Question 5. When and by Whom was Java Developed?
Answer. Java was developed by James Gosling in Sun Microsystem in 1995.
Question 6. Why Java is not 100% Object-oriented?
Answer. Java is not 100% Object-oriented because it makes use of eight primitive data types such as boolean, byte, char, int, float, double, long, short which are not objects.
Question 7. You had mentioned Python as one of the tools for solving data science problems, can you tell me the various libraries of Python that are used in Data Science?
Answer. Some of the important libraries of Python that are used in Data Science are –
Question 8. How you keep yourself updated with the current technology?
Answer. I keep myself connected with social networking sites, the first platform for any technological advancement news and also keep surfing on the latest technology on internet.
Question 9. Does Java Use Pointers?
Answer. No. Java doesn’t use pointers. It has a tough security. Instead of pointers, references are used in Java as they are safer and more secure when compared to a pointer.
Question 10. What are constructors in Java?
Answer. In Java, constructor refers to a block of code which is used to initialize an object. It must have the same name as that of the class. Also, it has no return type and it is automatically called when an object is created.
There are two types of constructors:
Default Constructor: In Java, a default constructor is the one which does not take any inputs. In other words, default constructors are the no argument constructors which will be created by default in case you no other constructor is defined by the user. Its main purpose is to initialize the instance variables with the default values. Also, it is majorly used for object creation.
Parameterized Constructor: The parameterized constructor in Java, is the constructor which is capable of initializing the instance variables with the provided values. In other words, the constructors which take the arguments are called parameterized constructors.
Question 11. What function of numpy will you use to find maximum value from each row in a 2D numpy array?
Answer. In order to find the maximum value from each row in a 2D numpy array, we will use the amax() function as follows –
Where numpy is imported as np and input is the input array.
Question 12. What is the expected period of an average call while dealing with the customers?
Answer. The expected period of an average call would be around 2-3 minutes, sometimes less or more depending on the problem complexity.
Question 13. Why 8085 processor is called 8 bit processor?
Answer. It is called 8 bit processor as it has 8 bit ALU (Arithmetic Logic Unit).
Question 14. How will you create an identity matrix using numpy?
Answer. In order to create the identity matrix with numpy, we will use the identity() function. Numpy is imported as np
We will obtain the output as –
array([[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.]])
Questions 15. What is stack and can we use ROM as stack?
Answer. Stack is a portion of RAM used for saving the content of the program counter and general purpose registers. ROM cannot be used as a stack, as it is not possible to write on ROM.
Question 16. What Is the Difference Between Overloading and Overriding?
Answer. When there are two methods of the same name but different properties, it is overloading. Overriding occurs when there are two methods of the same name and properties, one is in the child class and the other is in the parent class.
Question 17. What is a package in Java? List down various advantages of packages.
Answer. Packages in Java, are the collection of related classes and interfaces which are bundled together. By using packages, developers can easily modularize the code and optimize its reuse. Also, the code within the packages can be imported by other classes and reused. Below I have listed down a few of its advantages:
Packages help in avoiding name clashes
They provide easier access control on the code
Packages can also contain hidden classes which are not visible to the outer classes and only used within the package
Creates a proper hierarchical structure which makes it easier to locate the related classes
Question 18. How to add a border that is filled with 0s around an existing array?
Answer. In order to add a border to an array that is filled with 0s, we first make an array Z and initialize it with zeroes. We first import numpy as np.
Z = np.ones((5,5))
Then, we perform padding on it with the help of pad() function.
Z = np.pad(Z, pad_width=1, mode=’constant’, constant_values=0)
Question 19. What does it mean by interrupt?
Answer. To perform a particular task, interrupt is a signal send by external device to the processor.
Question 20. What Is a Package?
Answer. A package is a collection of related classes and interfaces.
We have given some very important interview questions above. If you have still any queries then you can comment below or you can contact us. We here at Alpingi are always happy to help you.