Cognizant
Vintech Computer Interview Questions and Answers
Q1. What is object oriented programming language and explain ?
Object oriented programming is a programming paradigm that uses objects to represent and manipulate data.
Object oriented programming focuses on creating reusable code by organizing data and behavior into objects.
Objects have attributes (data) and methods (behavior) that can be accessed and modified through the object's interface.
Inheritance allows objects to inherit attributes and methods from parent objects, promoting code reuse and reducing redundancy.
Polymorphism allows ob...read more
Q2. What is difference between static and final?
Static and final are both keywords in Java with different meanings.
Static is used to define a class-level variable or method that can be accessed without creating an instance of the class.
Final is used to define a constant value that cannot be changed once assigned.
Static can also be used to define a block of code that is executed only once when the class is loaded.
Final can also be used to define a class or method that cannot be overridden by a subclass.
Q3. How to handle exception in java?
Exceptions in Java can be handled using try-catch blocks.
Enclose the code that may throw an exception in a try block.
Catch the exception using catch block and handle it appropriately.
Finally block can be used to execute code regardless of whether an exception is thrown or not.
Multiple catch blocks can be used to handle different types of exceptions.
Throwing an exception can be done using the throw keyword.
Q4. How to achieve multiple inheritance?
Multiple inheritance can be achieved through interfaces or mixins.
Interfaces allow a class to implement multiple interfaces, each with its own set of methods and properties.
Mixins are classes that contain a set of methods and properties that can be added to other classes.
Example of interfaces: class MyClass implements Interface1, Interface2 {}
Example of mixins: class MyClass extends Mixin1(Mixin2(MyBaseClass)) {}
Q5. What is delete truncate in sql
DELETE and TRUNCATE are SQL commands used to remove data from a table.
DELETE removes specific rows from a table based on a condition
TRUNCATE removes all rows from a table
DELETE is slower than TRUNCATE
TRUNCATE resets the identity of the table
DELETE can be rolled back, but TRUNCATE cannot
Q6. What is collection framework?
Collection framework is a set of classes and interfaces that provide a standard way to store and manipulate groups of objects.
It provides interfaces like List, Set, Queue, etc. to store and manipulate collections of objects.
It also provides classes like ArrayList, HashSet, PriorityQueue, etc. that implement these interfaces.
It simplifies the process of storing, searching, sorting, and manipulating collections of objects.
It is a part of the Java API and is widely used in Java ...read more
Q7. What is foreign key?
A foreign key is a column or set of columns in a database table that refers to the primary key of another table.
It is used to establish a relationship between two tables in a database.
It ensures referential integrity by preventing invalid data from being inserted into the table.
It can be used to join tables together to retrieve data from multiple tables.
For example, a customer table may have a foreign key that refers to the primary key of an orders table.
Q8. Explain types of polymorphism?
Polymorphism refers to the ability of an object to take on multiple forms.
Compile-time polymorphism: Function overloading and operator overloading
Run-time polymorphism: Virtual functions and function overriding
Ad-hoc polymorphism: Function templates and operator overloading
Parametric polymorphism: Templates in C++ and generics in Java
More about working at Cognizant
Reviews
Interviews
Salaries
Users/Month